
var imgOvr = new Array();
var imgOut = new Array();
var santa_up = null;
var santa_down = null;
var santa_wink = null;

var winktimer = null;
var wavetimer = null;

var waveInterval = 6; //in seconds
var winkInterval = 22; //in seconds (note..santa will only wink with his hands on his belt...go figure)
var timeToBlush = 1000 //in milliseconds
var timeToWink = 200 //in milliseconds

function loadImages() {
	if(document.images) {
		imgOvr["writesanta"] = new Image();
		imgOvr["writesanta"].src = "images/m_writetosanta2.gif";
		imgOvr["songsgames"] = new Image();
		imgOvr["songsgames"].src = "images/m_songsgames2.gif";
		imgOvr["shop"] = new Image();
		imgOvr["shop"].src = "images/m_shop2.gif";
		imgOvr["tracking"] = new Image();
		imgOvr["tracking"].src = "images/m_tracking2.gif";
		imgOvr["weather"] = new Image();
		imgOvr["weather"].src = "images/m_weather2.gif";
		imgOvr["reindeer"] = new Image();
		imgOvr["reindeer"].src = "images/m_reindeer2.gif";
		imgOvr["naughty"] = new Image();
		imgOvr["naughty"].src = "images/m_naughty2.gif";
		imgOvr["house"] = new Image();
		imgOvr["house"].src = "images/m_house2.gif";
		imgOvr["letter"] = new Image();
		imgOvr["letter"].src = "images/m_letter2.gif";
		imgOvr["phonecall"] = new Image();
		imgOvr["phonecall"].src = "images/m_phonecall2.gif";

		imgOut["writesanta"] = new Image();
		imgOut["writesanta"].src = "images/m_writetosanta.gif";
		imgOut["songsgames"] = new Image();
		imgOut["songsgames"].src = "images/m_songsgames.gif";
		imgOut["shop"] = new Image();
		imgOut["shop"].src = "images/m_shop.gif";
		imgOut["tracking"] = new Image();
		imgOut["tracking"].src = "images/m_tracking.gif";
		imgOut["weather"] = new Image();
		imgOut["weather"].src = "images/m_weather.gif";
		imgOut["reindeer"] = new Image();
		imgOut["reindeer"].src = "images/m_reindeer.gif";
		imgOut["naughty"] = new Image();
		imgOut["naughty"].src = "images/m_naughty.gif";
		imgOut["house"] = new Image();
		imgOut["house"].src = "images/m_house.gif";		
		imgOut["letter"] = new Image();
		imgOut["letter"].src = "images/m_letter.gif";
		imgOut["phonecall"] = new Image();
		imgOut["phonecall"].src = "images/m_phonecall.gif";

		santa_up = new Image();
		santa_up.src = "images/santa_sign.gif";
		santa_down = new Image();
		santa_down.src = "images/santa_sign2.gif";
		santa_wink = new Image();
		santa_wink.src = "images/santa_sign3.gif";
		santa_blush = new Image();
		santa_blush.src = "images/santa_sign4.gif";

		wavetimer = setInterval("waveSanta()",waveInterval*1000);
		winktimer = setInterval("winkSanta()",winkInterval*1000);
	}
}


function getOverMenu(o) {
	if(document.images) {
		try{ o.src=imgOvr[o.name].src; } catch(e){;}
	}
}


function getOutMenu(o) {
	if(document.images) {
		try{ o.src=imgOut[o.name].src; } catch(e){;}
	}
}


function waveSanta() {
	if(document.images) {
		try{ document.santasign.src==santa_up.src?document.santasign.src=santa_down.src:document.santasign.src=santa_up.src; } catch(e){;}
	}	
}

function blushSanta() {
	var hold = "";
	if(document.images) {
		//try{
		clearInterval(wavetimer);
		document.santasign.src=santa_blush.src;
		setTimeout("document.santasign.src=santa_down.src;",timeToBlush);
		wavetimer = setInterval("waveSanta()",waveInterval*1000);
		//} catch(e){alert(e);}
	}	
}

function winkSanta() {
	if(document.images) {
		try{	
			if(document.santasign.src==santa_down.src) {
				clearInterval(wavetimer);
				document.santasign.src=santa_wink.src;
				setTimeout("document.santasign.src=santa_down.src;",timeToWink);
				wavetimer = setInterval("waveSanta()",waveInterval*1000);
			}
		} catch(e){;}
	}	
}


