	$(function() {  
		
		/* Customer Spotlight */
		$("#spotlight a").hover(function() {$(this).find('img:eq(1)').fadeOut(300);}, function() {$(this).find('img:eq(1)').fadeIn(300);});			

		/* News Slider */
		var newsPosition = 0;
		var lines = $('#news div');
		var newsTot = lines.length;
		$('#news div:eq(0)').fadeIn();

		function news_rotate() {
			if(newsPosition >= 9) {
				newsPosition = 0;
			}
			$('#news div').hide();
			$('#news div:eq(' + newsPosition + ')').fadeIn();
		}	

		$(document).everyTime(7500, "movenews",function() { newsPosition ++; news_rotate(); }, 0);  
		

		/* We're loading the secondary hero images now so we don't slow down the entire page load */



		$('#hero div.slide:eq(1)').prepend('<img src="/images/uploads_hero/hero_slide2.jpg" />');

		$('#hero div.slide:eq(2)').prepend('<img src="/images/uploads_hero/hero_slide3_1.jpg" />');

		$('#hero div.slide:eq(3)').prepend('<img src="/images/uploads_hero/hero_slide4.jpg" />');

		$('#hero div.slide:eq(4)').prepend('<img src="/images/uploads_hero/hero_slide5.jpg" />');




		/* HOME HERO */
		var currentPosition = 0;
		/* Hide hero on image controls */		
		$('#controls div').find('img:eq(1)').hide();
		$('#controls div:eq(0)').find('img:eq(1)').show();
		$('#hero div.slide').hide();
		$('#hero div.slide:eq(0)').show();		
		
		/* When the user is mouse is hovering over the the hero area, disable the timer */
		$("#hero").hover(function() {$(document).stopTime("movetime");}, function() {
			$(document).everyTime(8500, "movetime",function() { currentPosition++; hero_rotate(); }, 0); 
		});			
		$("#controls div").click(function(event){
			currentPosition = $(this).index();
			hero_rotate();
		});		
		

		/* rotate all the hero elements */
        function hero_rotate() {
            if(currentPosition >= 5) {
                currentPosition = 0;
            }
			$('#hero div.slide').fadeOut();
            $('#hero div.slide:eq(' + currentPosition + ')').fadeIn(300);
			$('#controls div').find('img:eq(1)').fadeOut(300);
			$('#controls div:eq(' + currentPosition + ')').find('img:eq(1)').fadeIn(300);		
        }			
		/* start the timer */
		$(document).everyTime(8500, "movetime",function() { currentPosition++; hero_rotate(); }, 0);  
        
	});

