//HEYS Home Java Script --  ©2010 Heidi E.Y. Stemple & Adam Stemple

initImages();
function ttin() {
		if (jQuery.support.opacity) {
			$('#tooltip').css({opacity: '0', display: 'block'});
			$('#tooltip').stop().animate({opacity: '1'}, 'slow');
		} else {
			$('#tooltip').css({display: "block"});
		};
	};
	function ttout() {
		if (jQuery.support.opacity) {
			$('#tooltip').stop().animate({opacity: '0'}, 'slow');
		} else {
			$('#tooltip').css({display: "none"});
		};
	};

window.onload = function () {

//  Tooltip

$('#kidEnd').hover(function() {
           ttin();
        }, function() {
            ttout();
        });

$('#dad').hover(function() {
           ttin();
        }, function() {
            ttout();
        });        

$('#tooltip').hover(function() {
           ttin();
        }, function() {
            ttout();
        });
        
        
//  Kid Animation

if (jQuery.support.opacity) {

	$("#kidAniEnd").hide();
	$("#dad").hide();
	
	$("#kidAni1").fadeIn('slow');
	setTimeout('$("#kidAni1").fadeOut("slow")', 600);
	setTimeout('$("#kidAni2").fadeIn("slow")', 1100);
	setTimeout('$("#kidAni2").fadeOut("slow")', 2100);
	setTimeout('$("#kidAni3").fadeIn("slow")', 2600);
	setTimeout('$("#kidAni3").fadeOut("slow")', 3600);
	setTimeout('$("#kidAniEnd").fadeIn("slow")', 4100);
	setTimeout('$("#dad").fadeIn("slow").removeClass("pngfix")', 5500);
};
	
// Menu Links

	$("#bio").click(function(event){
		event.preventDefault();
		$("#homeNav img").animate({height: '0', width: '0'}, 900);
		setTimeout('window.location = "bio.html";', 800);
	});
	
	$("#books").click(function(event){
		event.preventDefault();
		$("#homeNav img").animate({height: '0', width: '0'}, 900);
		setTimeout('window.location = "books.html";', 800);
	});
	
	$("#visits").click(function(event){
		event.preventDefault();
		$("#homeNav img").animate({height: '0', width: '0'}, 900);
		setTimeout('window.location = "visits.html";', 800);
	});
	
	$("#calendar").click(function(event){
		event.preventDefault();
		$("#homeNav img").animate({height: '0', width: '0'}, 900);
		setTimeout('window.location = "calendar.html";', 800);
	});

};

function initImages() {
	var preload=new Array(7);
	preload[0]=new Image(110,202);
	preload[0].src="images/kid1.png";
	preload[1]=new Image(110,202);
	preload[1].src="images/kid2.png";
	preload[2]=new Image(110,202);
	preload[2].src="images/homeNav.png";
	preload[3]=new Image(110,202);
	preload[3].src="images/homeNavBio.png";
	preload[4]=new Image(110,202);
	preload[4].src="images/homeNavBooks.png";
	preload[5]=new Image(110,202);
	preload[5].src="images/homeNavVisits.png";
	preload[6]=new Image(110,202);
	preload[6].src="images/homeNavCalendar.png";
	preload[7]=new Image(110, 202);
	preload[7].src="images/tooltip.png";
};