$(document).ready(initHero);

function initHero() {
	/* initExpandContent(); //collapsible content below hero  */
	
	//get number of slides in current hero
	var numSlides = $("#home #heroContainer .slides").children().length;
	
	/* ******** HOME HERO ******** */
	var randomnumber = Math.floor(Math.random()*numSlides-1) // Generate a random number from 0 to numslides-1
	
	switch(randomnumber)
	{
		case 0:
			heroThumbs("Amazing Tooth Bus");
			$('div.slides').attr({"style": 'left: 0px'});
			autoRotation(0);//initialize rotation
			break;
	    case 1:		
			heroThumbs("Alberta");	
			$('div.slides').attr({"style": 'left: -950px'});			
			autoRotation(1);//initialize rotation
			break;
		case 2:		
			heroThumbs("Colgate");	
			$('div.slides').attr({"style": 'left: -1900px'});			
			autoRotation(2);//initialize rotation
			break;
		case 3:		
			heroThumbs("HealthDelivery");	
			$('div.slides').attr({"style": 'left: -2850px'});		
			autoRotation(3);//initialize rotation
			break;
		case 4:		
			heroThumbs("ToothTaxi");	
			$('div.slides').attr({"style": 'left: 950px'});		
			autoRotation(4);//initialize rotation
			break;
		case 5:		
			heroThumbs("TzuChi");	
			$('div.slides').attr({"style": 'left: 0px'});		
			autoRotation(5);//initialize rotation
			break;
		default:
			break;
	}			
	
	//Hero Thumbs click actions
	$("#heroThumbs li a").click(function() {									 
		$("#heroThumbs").find("span").animate({opacity: 0}, {queue:false, duration:400}, "linear",
			function(){
				$(this).find("span").attr({"style": 'display:none'});			
			}
		);										 
		heroThumbs($(this).attr("title"));
	});
	
	/* ** FOR Home Module */	
	//show gear icon div
	$("#home_news-and-events .item .btn_news-drop-down").click(function() {
		//alert( $(this).attr("title") );
		$("#home_news-and-events .item #"+$(this).attr("title")).attr({"style": 'visibility: visible'});


	});
	//hide gear icon div
	$("#home_news-and-events .item .btn_news-drop-down_in").click(function() {
		//alert( $(this).attr("title") );
		$("#home_news-and-events .item #"+$(this).attr("title")).attr({"style": 'visibility: hidden'});
    
        
	});			
}



