$(document).ready(function() { 
	
	$(".homeImages").serialScroll();
	
	var intIndex = 1;
	
	$(".1").bind(
		"click",
		function(){
			$("#slideshow").animate({left: "0px"}, "slow");
		}			
	);
	
	
	var imageXValues = [];
	
	var tmpWidth = 330;
	var descWidth = 0;
	$(".projImage:last").load(function() { 
		$(".projImage").each(
			function(intIndex){
				var imgwidth = $(this).width();
				tmpWidth += (imgwidth + 2);
				descWidth = Number(tmpWidth) - Number(imgwidth);
				//alert(tmpWidth);
				//alert(descWidth);
				
				$(".projDesc").bind(
					"click",
					function(){
						$("#slideshow").animate({left: "-0px"}, "slow");
						$(".projectFacts").hide();
						$(".projectDescription").show();
					}			
				);
				
				$(".projFacts").bind(
					"click",
					function(){
						$("#slideshow").animate({left: "-0px"}, "slow");
						$(".projectDescription").hide();
						$(".projectFacts").show();
					}			
				);
				
				//alert(tmpWidth);
				imageXValues[intIndex] = tmpWidth;
				
				// Assign to the correct image
				
				$("." + (intIndex + 2) ).bind(
					"click",
					function(){
						$("#slideshow").animate({left: "-"+imageXValues[intIndex]+"px"}, "slow");
					}			
				);
			}
		)
	});
});