$(document).ready(function(){
	
	
	
		
		$("#buttonsbuttons a").each(function(){

if(this.id){
	  $(this).attr("href","Javascript:;");
}
	  
	  
	  
	  
	  });
	
	
	$(".fadedback").css("opacity",.6);
	$("#contentscreen").css("height",$("#contentwrapper").height()+"px");
	$("#contentscreen").css("opacity",.6);
	
	//$(".insideheader").css("opacity",0);
	$(".sectionim").css("opacity",0);
	$(".sectiontext").css("opacity",0);
	$(".sectiontext").css("top","40px");
	
	
	$("#buttonsbuttons a").each(function(){
	//$(".buttonsbuttons a").click(function(){
	$(this).click(function(){
		passer=this.id;
		
		if($(".thirdim").css("left")!="-1400px"){
		   
		$(".thirdim").animate({"left":'-1400px'},{queue:false, duration:1000, easing: 'easeInExpo',complete:function(){
																													
																													starttwo(passer);
																													}
																													});
		$(".openlongertext").animate({"opacity":'0'},{queue:false, duration:1000, easing: 'easeInExpo'});
	
	
						   } else {
							   
							 showsection(passer);  
							   
						   }
	
	
	});
	});
	function starttwo(whichsection){
		$(".firstim").animate({"left":'-1400px'},{queue:false, duration:1000, easing: 'easeInExpo',complete:function(){
																													startthree(whichsection);
																													}
																													});
	}
	
	
	function startthree(whichsection){
		$(".secondim").animate({"left":'15px'},{queue:false, duration:1000, easing: 'easeInExpo'});
		$(".secondim").animate({"top":'0px'},{queue:false, duration:1000, easing: 'easeInExpo',complete:function(){
																												 showsection1(whichsection);
																												 }
																												 });
		
	}
	
	function showsection1(whichsection){
		
		$(".secondim").animate({opacity:1},{queue:false, duration:1000,complete: function(){
																						  showsection(whichsection);
																						  }
																						  });
		
		
	}
	function clearopen(){
		$(".openlongertext").css("display","none");
	}
	
	function showsection(whichsection){
		$(".longertext").css("display","block");
		clearopen();
		$(".inditext").css("display","none");
		$("#inside"+whichsection).css("display","block");
		mytitle=$("#inside"+whichsection).children("h1").html();
		//mytitle=$("#section"+whichsection).html();
		//alert(mytitle);
		$(document).attr("title", mytitle);
		//alert($("#contentwrapper").height());
		$("#contentscreen").css("height",$("#contentwrapper").height()+"px");
		
		//$(".insideheader").animate({opacity:1},{queue:false, duration:500});
		$(".secondim").animate({opacity:0},{queue:false, duration:1000});
		
		$(".sectionim").each(function(){
									  $(this).stop().animate({opacity:0},{queue:false, duration:1000});
									  });
		$("#section"+whichsection).css("z-index",10);
		$("#section"+whichsection).css("top","0px");
		//alert($("#section"+whichsection+ " img").attr("src"));
		$("#section"+whichsection).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$("#section"+whichsection+ " img").attr("src")+"')");
		$("#section"+whichsection).stop().animate({opacity:1},{queue:false, duration:1000}); 
		
		
		$(".sectiontext").each(function(){
									  $(this).stop().animate({opacity:0},{queue:false, duration:1000});
									  });
		
		
		$("#upsell"+whichsection).stop().animate({opacity:1},{queue:false, duration:1000}); 
		
		
		
		
	}
	
	
	
	
});
