


imageMap = $("#imagemap");
mapImages = $("#imagemap img");
imageCount = mapImages.length;
timeInBetween = 200;
fadeSpeed = 400;

function addNav() {
	imageMap.remove();
	$("#tagline").fadeOut(300,function(){
		$("header nav").animate({left:"185px",opacity:1},300,function(){
			$("#title").fadeIn(600);
		});
	});
}

$('.loading').activity({segments: 12, width: 2.5, space: 2, length: 5, color: '#999', speed: 2.5});
mapImages.imgpreload(function()
{
	$(".loading").remove();
	mapImages.each(function(i){
		$(this).delay(i*timeInBetween+1000).fadeIn(fadeSpeed, function(){
			$(this).delay(imageCount*timeInBetween + 2000).fadeOut(fadeSpeed, function(){
				if(i==imageCount-1)
					addNav();
			});
		});
	});
});

imageMap.click(function() { 
	addNav();
});

// $(function(){
// 	$("#imagemap img").each(function(i){
// 		$(this).delay(i*300+1000).fadeIn(700, function(){
// 			$(this).delay(i*50 + 5000).fadeOut(600, function(){
// 				if(i==$("#imagemap img").length-1)
// 					addNav();
// 			});
// 		});
// 	});
// });
