// JavaScript Document
$(document).ready(function(){
		//$("#sContentBG").animate({opacity:.6},1)
		reSizeStage();
		reSizeStage();
		reSizeStage();
		//$("#slide2").hide();
		//InitialGallery()
	});
	
	
		var entered = true;
		function enterPage(){
			$("#slide1").show()
			$("#slide2").fadeOut(1000)
		}
	
		function reSizeStage(type){
			
			if($(document).width() > 1000){
				targetW = "100%"
				$("#wrapper").css("width","100%")
			}else{
				$("#wrapper").css("width","1000px")
				targetW = "1000px"
			}
			
			
			
			
			detectH = $("#sContentBG").height() + 180
			$("#sFooter").css("top",detectH-60+"px")
			
			if($(document).height() >detectH ){
				targetH = "100%"
				$("#wrapper").css("height","100%")
			}else{
				
				$("#wrapper").css("height",detectH+"px")
				targetH = detectH+"px"
			}
			
			
			
			$("#sContentBG,#sFooter").css("left",$("#wrapper").width() / 2 - 485 + "px" )
		
		
			for(i=1;i<=2;i++){
				$("#slide"+i).css("width",targetW)
				$("#slide"+i).css("height",targetH)
			}
		}
		/////////////////////////////////////////////////
		// Gallery Module Start
		// Target Div:  #SlideShow_Home
		// Initital Function: InitialGallery()
		/////////////////////////////////////////////////
		var totalImage ;
		var cImg;
		var pImg;
		function InitialGallery(){
			totalImage = $("#SlideShow_Home img").length - 1
			cImg = 0;
			pImg = totalImage;
			$("#SlideShow_Home img").each(function(index) {
				$(this).css("z-index",index+10)
				if(index > 0){
					$(this).css("display","none")
				}
				if(index == totalImage){
					PlaySlides();
				}
			})
			
		}
		
		function PlaySlides(){
			$("#SlideShow_Home img:eq("+cImg+")").delay(4000).fadeOut(2000)
			$("#SlideShow_Home img:eq("+pImg+")").delay(4000).fadeIn(2000,function(){
				
				if(cImg == totalImage){
					pImg = totalImage;	
					cImg = 1;
				}else{
					pImg = cImg;
					cImg += 1;
				}
				
				PlaySlides()
				
			})
		}
		/////////////////////////////////////////////////
		// Gallery Module End
		/////////////////////////////////////////////////
