﻿	$(document).ready (function () {
		//###### Header Slideshow
		$(window).load(function() {
		    $('#slider').nivoSlider({
		        effect:'slideInRight', // Specify sets like: 'fold,fade,sliceDown'
		        animSpeed:500, // Slide transition speed
		        pauseTime:5000, // How long each slide will show
		        captionOpacity:1.0 // Universal caption opacity
		    });
		});
		
		//###### Current Year for Copyright
		$('#year').text ( (new Date).getFullYear() );
		
		
		//##### Newsletter Archive Sidebar Accordion & Webinar Accordion
		  $('#SideBar ul > li ul, #WebinarBody ul > li ul')
		    .click(function(e){
		      e.stopPropagation();
		    })
		    .filter(':not(:first)')
		    .hide();
		    
		  $('#WebinarBody ul > li ul')
		    .click(function(e){
		      e.stopPropagation();
		    })
		    //.filter(':not(:first)')
		    .hide();
		  
		$('#SideBar ul > li, #WebinarBody ul > li').click(accord);
		function accord (){
		    var selfClick = $(this).find('ul:first').is(':visible');
		    if(!selfClick) {
		      $(this)
		        .parent()
		        .find('> li ul:visible')
		        .slideToggle('fast');
		    }
		    $(this)
		      .find('ul:first')
		      .stop(true, true)
		      .slideToggle('fast');
		}
		  //#### Newsletter Signup and Unsubscribe Buttons
		  $('#SignUp, #unsubscribe').mouseover(function () {
		  	$(this).stop().animate({height: '86px', width: '86px'}, 200);		  
		  	});
		  $('#SignUp, #unsubscribe').mouseout(function () {
		  	$(this).stop().animate({height: '65px', width: '65px'}, 200);		  
		  	});
		  	
		  $('#SideBar ul > li').hover(function(){
		  	$(this).toggleClass('BgHover');
		  });

		//##### Load New Newsletter page on click
		$('#newsLink a').click (function (e) {
			var url = $(this).attr('href');
			$('#Newsbody').load(url, function () { 
				$('#Newsbody h3').addClass('headerBG');
			});
			e.preventDefault();
		});
		//##### Load First Newsletter Link in Newsletter Page
		$(window).load(function() {
			var url = $('#newsLink li a:first').attr('href');
			$('#Newsbody').load(url, function () {
				$('#Newsbody h3').addClass('headerBG');
			});
		});
			$('#Newsbody h3').live('click', function () { 
				$('#Newsbody h3').addClass('headerBG');
			});
		//###### SideBar Links Animation - (Coding Analyzer Link & Resources Link)
		$('#analyzerText').hide();
		$('#analyzerDiv').stop().hover(function(){
			$('#analyzerText').toggle();
		});
		$('#resourceText').hide();
		$('#resourceDiv').stop().hover(function () {
			$('#resourceText').toggle();
		});
		//Load Video on home page
		$('#LoadVideo').attr('src','http://player.vimeo.com/video/18688874?portrait=0');
	});

