jQuery(document).ready(function(){
jQuery(function(jQuery) {
		
		var timer;
		
		function highlight_1_hover(event) { 
				
				jQuery(".newsstory:not(#highlight_thumbnail_1)").stop().animate({ marginTop: "0px", backgroundColor: "#222222"}, 100, function() { 
					jQuery(this).find("h4 a").stop().animate({ color: "#0099ee" }, 100 ); } );						   
				jQuery("#highlight_thumbnail_1").stop().animate({ marginTop: "-20px", backgroundColor: "#0099ee"}, 400, function(){
					jQuery(this).find("h4 a").stop().animate({ color: "#ffffff" }, 200);} );
				
				jQuery(".hidden_highlight:not(#highlight_1)").animate({ opacity: 0 }, 100 );
				jQuery(".hidden_highlight:not(#highlight_1)").css("visibility" , "hidden");
				jQuery("#highlight_1").css("visibility" , "visible");
				jQuery("#highlight_1").stop().animate({opacity: 1}, 400);
					
				clearTimeout(timer);
				timer = setTimeout(eval("highlight_2_hover"),"5000");
		}
		
		function highlight_2_hover(event) { 
				
				jQuery(".newsstory:not(#highlight_thumbnail_2)").stop().animate({ marginTop: "0px", backgroundColor: "#222222"}, 100, function() { 
					jQuery(this).find("h4 a").stop().animate({ color: "#0099ee" }, 100 ); } );						   
				jQuery("#highlight_thumbnail_2").stop().animate({ marginTop: "-20px", backgroundColor: "#0099ee"}, 400, function(){
					jQuery(this).find("h4 a").stop().animate({ color: "#ffffff" }, 200);} );
				
				jQuery(".hidden_highlight:not(#highlight_2)").animate({ opacity: 0 }, 100 );
				jQuery(".hidden_highlight:not(#highlight_2)").css("visibility" , "hidden");
				jQuery("#highlight_2").css("visibility" , "visible");
				jQuery("#highlight_2").stop().animate({opacity: 1}, 400);
					
				clearTimeout(timer);
				timer = setTimeout(eval("highlight_3_hover"),"5000");
		}
		
		function highlight_3_hover(event) { 
				
				jQuery(".newsstory:not(#highlight_thumbnail_3)").stop().animate({ marginTop: "0px", backgroundColor: "#222222"}, 100, function() { 
					jQuery(this).find("h4 a").stop().animate({ color: "#0099ee" }, 100 ); } );						   
				jQuery("#highlight_thumbnail_3").stop().animate({ marginTop: "-20px", backgroundColor: "#0099ee"}, 400, function(){
					jQuery(this).find("h4 a").stop().animate({ color: "#ffffff" }, 200);} );
				
				jQuery(".hidden_highlight:not(#highlight_3)").animate({ opacity: 0 }, 100 );
				jQuery(".hidden_highlight:not(#highlight_3)").css("visibility" , "hidden");
				jQuery("#highlight_3").css("visibility" , "visible");
				jQuery("#highlight_3").stop().animate({opacity: 1}, 400);
					
				clearTimeout(timer);
				timer = setTimeout(eval("highlight_4_hover"),"5000");
		}
		
		function highlight_4_hover(event) { 
				
				jQuery(".newsstory:not(#highlight_thumbnail_4)").stop().animate({ marginTop: "0px", backgroundColor: "#222222"}, 100, function() { 
					jQuery(this).find("h4 a").stop().animate({ color: "#0099ee" }, 100 ); } );						   
				jQuery("#highlight_thumbnail_4").stop().animate({ marginTop: "-20px", backgroundColor: "#0099ee"}, 400, function(){
					jQuery(this).find("h4 a").stop().animate({ color: "#ffffff" }, 200);} );
				
				jQuery(".hidden_highlight:not(#highlight_4)").animate({ opacity: 0 }, 100 );
				jQuery(".hidden_highlight:not(#highlight_4)").css("visibility" , "hidden");
				jQuery("#highlight_4").css("visibility" , "visible");
				jQuery("#highlight_4").stop().animate({opacity: 1}, 400);
					
				clearTimeout(timer);
				timer = setTimeout(eval("highlight_5_hover"),"5000");
		}
		
		function highlight_5_hover(event) { 
				
				jQuery(".newsstory:not(#highlight_thumbnail_5)").stop().animate({ marginTop: "0px", backgroundColor: "#222222"}, 100, function() { 
					jQuery(this).find("h4 a").stop().animate({ color: "#0099ee" }, 100 ); } );						   
				jQuery("#highlight_thumbnail_5").stop().animate({ marginTop: "-20px", backgroundColor: "#0099ee"}, 400, function(){
					jQuery(this).find("h4 a").stop().animate({ color: "#ffffff" }, 200);} );
				
				jQuery(".hidden_highlight:not(#highlight_5)").animate({ opacity: 0 }, 100 );
				jQuery(".hidden_highlight:not(#highlight_5)").css("visibility" , "hidden");
				jQuery("#highlight_5").css("visibility" , "visible");
				jQuery("#highlight_5").stop().animate({opacity: 1}, 400);
					
				clearTimeout(timer);
				timer = setTimeout(eval("highlight_1_hover"),"5000");
		}
		
		function OnLoad(event) {
			clearTimeout(timer);
			timer = setTimeout(eval("highlight_1_hover"));
		}

		jQuery('#highlight_thumbnail_1').bind('click', highlight_1_hover);
		
		jQuery('#highlight_thumbnail_2').bind('click', highlight_2_hover);
		
		jQuery('#highlight_thumbnail_3').bind('click', highlight_3_hover);
		
		jQuery('#highlight_thumbnail_4').bind('click', highlight_4_hover);
		
		jQuery('#highlight_thumbnail_5').bind('click', highlight_5_hover);

		OnLoad();
		
		jQuery(".newsstory").hover(function() {
			jQuery(this).stop().animate({ backgroundColor: "#333" }, 200);
		}, function () {
			jQuery(this).stop().animate({ backgroundColor: "#222" }, 50);
		});
		
		jQuery(".hidden_highlight").hover(function() {
			jQuery(this).stop().animate({ opacity: 1, backgroundColor: "#fff"}, 200).find('p').stop().animate({color: "#111"}, 200);
		}, function () {
			jQuery(this).stop().animate({ opacity: 1, backgroundColor: "#111"}, 50).find('p').stop().animate({color: "#eee"}, 50);
		});
		
		jQuery(".hidden_highlight").click(function() {
			jQuery(this).stop().animate({ opacity: 1, backgroundColor: "#777"}, 50).unbind('mouseenter mouseleave');
			clearTimeout(timer);
			window.location=jQuery(this).find("a").attr("href"); return false;
		});
		
});
});

