$(document).ready(function() {
	if (Modernizr.cssanimations) {
//Run CSS3 Animations
	} else {
setTimeout("animation()",300);
	}
});

function animation(){
	beat();
	smoke();
  	blinky();
	shadow();
}
	

function beat(){
	$("#heart").animate({top:"+=5px"},1000).animate({top:"-=5px"}, 1000);
	setTimeout("beat()",2000);
}

function smoke(){
	$("#arm-smoke-wisp").animate({top:"-=1800px"}, 49900).animate({top:"+=1800px"}, 100);
	setTimeout("smoke()", 50000);
}

function blinky(){
	$("#eye-lids").animate({top:"+=10px"},200).animate({top:"-=10px"},200).delay(2000).animate({top:"+=10px"}, 200).animate({top:"-=10px"},200).animate({top:"+=10px"},200).animate({top:"-=10px"},200).delay(2000).animate({top:"+=10px"}, 200).animate({top:"-=10px"},200).animate({top:"+=10px"},200).animate({top:"-=10px"},200).delay(6000).animate({top:"+=10px"}, 200).animate({top:"-=10px"},200).animate({top:"+=10px"},200).animate({top:"-=10px"},200).delay(2000).animate({top:"+=10px"}, 200).animate({top:"-=10px"},200).animate({top:"+=10px"},200).animate({top:"-=10px"},200).delay(5000).animate({top:"+=10px"}, 200).animate({top:"-=10px"},200);
	setTimeout("blinky()", 21400);
}

function shadow(){
	$('#window').css({backgroundPosition: '250px 20px'});
	$('#window').animate({backgroundPosition: '-250px 20px'}, 20000).delay(2000);
	setTimeout("shadow()", 22000);
}


$('#nav a')
	.css( {backgroundPosition: "0 0"} )
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"(0 -250px)"}, 
			{duration:500})
		})
	.mouseout(function(){
		$(this).stop().animate(
			{backgroundPosition:"(0 0)"}, 
			{duration:500})
		})


