$(document).ready(function(){
	MM_preloadImages('/images/s_layer_bg.png');
	//animation for sub menus												 
	$("#s_layer_1").hoverIntent(function(){$("#l_layer_1").animate({height: "toggle"}, 200);}, function(){$("#l_layer_1").animate({height: "toggle"}, 200);});
	//$("#s_layer_2").hoverIntent(function(){$("#txt_2").addClass("s_layer_bg"); $("#l_layer_2").animate({height: "toggle"}, 200);}, function(){$("#l_layer_2").animate({height: "toggle"}, 200, function(){$("#txt_2").removeClass("s_layer_bg");}); });
	$("#s_layer_2").hoverIntent(function(){$("#l_layer_2").animate({height: "toggle"}, 200);}, function(){$("#l_layer_2").animate({height: "toggle"}, 200);});
	$("#s_layer_3").hoverIntent(function(){$("#l_layer_3").animate({height: "toggle"}, 200);}, function(){$("#l_layer_3").animate({height: "toggle"}, 200);});
	$("#s_layer_4").hoverIntent(function(){$("#l_layer_4").animate({height: "toggle"}, 200);}, function(){$("#l_layer_4").animate({height: "toggle"}, 200);});
	$("#s_layer_5").hoverIntent(function(){$("#l_layer_5").animate({height: "toggle"}, 200);}, function(){$("#l_layer_5").animate({height: "toggle"}, 200);});
	$("#s_layer_6").hoverIntent(function(){$("#l_layer_6").animate({height: "toggle"}, 200);}, function(){$("#l_layer_6").animate({height: "toggle"}, 200);});
	
	$("#sub_1").hoverIntent(function(){
		$("#sub_1_pic_2").stop().css({width:'0px',marginLeft:'70px',opacity:'0.5'});
		$("#sub_1_pic_1").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_1_pic_2").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	}, function(){
		$("#sub_1_pic_2").stop().css({width:'139px',marginLeft:'0px',opacity:'1'});
		$("#sub_1_pic_2").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_1_pic_1").animate({width:'139', marginLeft:'0',opacity:'1'},200);});	
	});
		
	$("#sub_2").hoverIntent(function(){
		$("#sub_2_pic_2").stop().css({width:'0px',marginLeft:'70px',opacity:'0.5'});
		$("#sub_2_pic_1").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_2_pic_2").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	}, function(){
		$("#sub_2_pic_2").stop().css({width:'139px',marginLeft:'0px',opacity:'1'});
		$("#sub_2_pic_2").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_2_pic_1").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	});
	
	$("#sub_3").hoverIntent(function(){
		$("#sub_3_pic_2").stop().css({width:'0px',marginLeft:'70px',opacity:'0.5'});
		$("#sub_3_pic_1").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_3_pic_2").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	}, function(){
		$("#sub_3_pic_2").stop().css({width:'139px',marginLeft:'0px',opacity:'1'});
		$("#sub_3_pic_2").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_3_pic_1").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	});	
	
	$("#sub_4").hoverIntent(function(){
		$("#sub_4_pic_2").stop().css({width:'0px',marginLeft:'70px',opacity:'0.5'});
		$("#sub_4_pic_1").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_4_pic_2").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	}, function(){
		$("#sub_4_pic_2").stop().css({width:'139px',marginLeft:'0px',opacity:'1'});
		$("#sub_4_pic_2").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_4_pic_1").animate({width:'139', marginLeft:'0',opacity:'1'},200);});			
	});
	
	$("#sub_5").hoverIntent(function(){
		$("#sub_5_pic_2").stop().css({width:'0px',marginLeft:'70px',opacity:'0.5'});
		$("#sub_5_pic_1").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_5_pic_2").animate({width:'139', marginLeft:'0',opacity:'1'},200);});		
	}, function(){
		$("#sub_5_pic_2").stop().css({width:'139px',marginLeft:'0px',opacity:'1'});
		$("#sub_5_pic_2").animate({width:'0', marginLeft:'70',opacity:'0.5'}, 200, function(){$("#sub_5_pic_1").animate({width:'139', marginLeft:'0',opacity:'1'},200);});			
	});
	
	$("#c2a_0_link").hover(function(){					
		$("#c2a_0").animate({opacity:'0.6'}, 200);
	}, function(){
		$("#c2a_0").animate({opacity:'1'}, 200);
	});
	
	$("#c2a_1_link").hover(function(){
		$("#c2a_1").animate({opacity:'0.6'}, 200);
	}, function(){
		$("#c2a_1").animate({opacity:'1'}, 200);
	});	
	
	//fix for shadowbox in iphone and ipad - add scroll event listener
	if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPad/i))) {		
		$(window).bind('scroll', function(){										
				$("#sb-container").css("top",$(window).scrollTop());				
		});
	}
	
	load_nav();
	//animation for Location page		
	panning_shot();
	setInterval("panning_shot();", 24000);

});

function panning_shot(){
	$("#reception_pic").animate({left: -388}, 12000, 'linear', function(){
		$("#reception_pic").animate({left: 0}, 12000, 'linear');																											 
	});
}

function gum_lift(){
	$("#after").hide();
	$("#before").fadeIn('fast');
	$("#arrows").animate({top:'170',opacity:'1'}, 300);	
		
	setTimeout('$("#after").fadeIn(\'fast\');', 1000);
	setTimeout('$("#arrows").css({top:"250px",opacity:"0"});$("#before").fadeOut(\'fast\');', 1800);
}
function before_after(before, after){
	$("#" + after).hide();
	$("#" + before).fadeIn('fast');	
		
	setTimeout('$("#' + after + '").fadeIn(\'fast\');', 1500);
	setTimeout('$("#' + before + '").fadeOut(\'fast\');', 1500);
}
