(function($){
     configSWD = function() {

		var newsNum = 0;
		var newsSlide = 615;
		var newsSlideiTab = 534;	
		var slideVar;
		var mapLoaded = 0;
  		 $("#newsPrev").addClass('disabledPrev');
  		 $("#newsPreviTab").addClass('disabledPrev');

		$("#newsLoad").load("/_assets/php/twitter-rss.php");    
		setInterval( "slideSwitch()",5000);
		setTimeout(function() { setInterval( "slideSwitch2()",5000); }, 1000);		
		setTimeout(function() { setInterval( "slideSwitch3()",5000); }, 2000);			
		setTimeout(function() { setInterval( "slideSwitch4()",5000); }, 3000);		
		setTimeout(function() { setInterval( "slideSwitch5()",5000); }, 4000);		


// Next News Function		
		
				$('#newsNext').click(function(){
				   newsNum++;
				   if(newsNum < 7){
				     slideVar = newsSlide * newsNum;
					 $("#newsContainer").animate({ scrollLeft: slideVar }, "slow");
  		 			 $("#newsPrev").removeClass('disabledPrev');
				   }
				   if(newsNum == 6){
  		 			  $("#newsNext").addClass('disabledNext');					 
				   }
				});		
				
// Previous News Function					
				
				$('#newsPrev').click(function(){
				   if(newsNum > 0){
				     newsNum--;
				     slideVar = newsSlide * newsNum;
					 $("#newsContainer").animate({ scrollLeft: slideVar }, "slow");
					 	 if(newsNum == 0){
  		 					 $("#newsPrev").addClass('disabledPrev');
					 	 }
						 if(newsNum < 6){
  		 					 $("#newsNext").removeClass('disabledNext');
						 }					 	 
				   }
				});	

				$('.boxContainer').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'132px'},{queue:false,duration:160});
				});


// Next News Function		
		
				$('#newsNextiTab').click(function(){
				   newsNum++;
				   if(newsNum < 7){
				     slideVar = newsSlideiTab * newsNum;
					 $("#newsContainer").animate({ scrollLeft: slideVar }, "slow");
  		 			 $("#newsPreviTab").removeClass('disabledPrev');
				   }
				   if(newsNum == 6){
  		 			  $("#newsNextiTab").addClass('disabledNext');					 
				   }
				});		
				
// Previous News Function					
				
				$('#newsPreviTab').click(function(){
				   if(newsNum > 0){
				     newsNum--;
				     slideVar = newsSlideiTab * newsNum;
					 $("#newsContainer").animate({ scrollLeft: slideVar }, "slow");
					 	 if(newsNum == 0){
  		 					 $("#newsPreviTab").addClass('disabledPrev');
					 	 }
						 if(newsNum < 6){
  		 					 $("#newsNextiTab").removeClass('disabledNext');
						 }					 	 
				   }
				});	

				$('.boxContainer').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'132px'},{queue:false,duration:160});
				});



     };



// Leaderboard Banner Function




// Slide Function

     slideSwitch = function() {
		var $active = jQuery('#slideshow IMG.active');
		if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    
		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
        
		// uncomment the 3 lines below to pull the images in random order
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
			$active.removeClass('active last-active');
        });
     };

// Slide Function

     slideSwitch2 = function() {
		var $active = jQuery('#slideshow2 IMG.active');
		if ( $active.length == 0 ) $active = $('#slideshow2 IMG:last');
    
		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
        : $('#slideshow2 IMG:first');
        
		// uncomment the 3 lines below to pull the images in random order
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
			$active.removeClass('active last-active');
        });
     };
     
// Slide Function

     slideSwitch3 = function() {
		var $active = jQuery('#slideshow3 IMG.active');
		if ( $active.length == 0 ) $active = $('#slideshow3 IMG:last');
    
		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
        : $('#slideshow3 IMG:first');
        
		// uncomment the 3 lines below to pull the images in random order
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
			$active.removeClass('active last-active');
        });
     };
     
// Slide Function

     slideSwitch4 = function() {
		var $active = jQuery('#slideshow4 IMG.active');
		if ( $active.length == 0 ) $active = $('#slideshow4 IMG:last');
    
		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
        : $('#slideshow4 IMG:first');
        
		// uncomment the 3 lines below to pull the images in random order
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
			$active.removeClass('active last-active');
        });
     };     
   

     slideSwitch5 = function() {
		var $active = jQuery('#slideshow5 IMG.active');
		if ( $active.length == 0 ) $active = $('#slideshow5 IMG:last');
    
		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
        : $('#slideshow5 IMG:first');
        
		// uncomment the 3 lines below to pull the images in random order
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );
		$active.addClass('last-active');
		$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 500, function() {
			$active.removeClass('active last-active');
        });
     };        
  
})(jQuery);

