/*
this file contains the javascript required to change the menu images on rollover, it also
contains the javascript responsible for redirecting the flash menu requests to the appropriate
website page
*/

var mImgList = new Array("store","elfhouse","postoffice","santashouse","trackingcenter","reindeerbarn","gameroom");
var mOutImg = new Array();
var mOverImg = new Array();
var i;

//load images
for(i=0;i<mImgList.length;i++) {
	mOutImg[mImgList[i]] = new Image();
	mOutImg[mImgList[i]].src = "/images/menu/m_"+mImgList[i]+"_0.gif";
	mOverImg[mImgList[i]] = new Image();
	mOverImg[mImgList[i]].src = "/images/menu/m_"+mImgList[i]+"_1.gif";
}

function mOvr(img) {
	if(document.images && document.images[img]) {
		document.images[img].src = mOverImg[img].src;
	}
}


function mOut(img) {
	if(document.images && document.images[img]) {
		document.images[img].src = mOutImg[img].src;
	}
}




var popWindow = null;

function popwindow(url,width,height) {
	var midX = (screen.width/2)-(width/2);
	var midY = (screen.height/2)-(height/2);
	popWindow = window.open (''+[url]+'','popwin', "width="+[width]+",height="+[height]+",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,top="+midY+",left="+midX+",screenX="+midX+",screenY="+midY+"");
	popWindow.focus();
}

function popwindowFixed(url,width,height) {
	var midX = (screen.width/2)-(width/2);
	var midY = (screen.height/2)-(height/2);
	popWindow = window.open (''+[url]+'','popwin', "width="+[width]+",height="+[height]+",toolbar=no,menubar=no,scrollbars=no,resizable=no,top="+midY+",left="+midX+",screenX="+midX+",screenY="+midY+"");
	popWindow.focus();
}


function santashouse_DoFSCommand(command, args) {

	if (command == "getpage") {
		showTextBox(args);
	}
}



function showTextBox(page) {

	var o = null;
	var popfrm = null;

	if(document.all) {
		o = document.all("TextPopup");
		popfrm = document.all("popframe");
	}
	else if(document.getElementById) {
		o = document.getElementById("TextPopup");
		popfrm = document.getElementById("popframe");
	}

	if(o!=null) {

		o.style.width="478px";
		o.style.marginLeft="-255px";
	

		if(page=="phonecall") {
			popfrm.src="/santas-house/phone-call-from-santa/?pop=Y";
		}
		else if(page=="emailsanta") {
			popfrm.src="/santas-house/email-santa/?pop=Y";
		}
		else if(page=="sendletter") {
			popfrm.src="/santas-house/email-santa/?pop=Y";
		}
		else if(page=="getletter") {
			location.href="/santas-house/letter-from-santa/";
			//popfrm.src="/santas-house/letter-from-santa/?pop=Y";
		}
		else if(page=="naughty") {
			o.style.width="640px";
			o.style.height="480px";
			o.style.marginLeft="-310px";
			popfrm.src="/santas-house/naughty-or-nice-meter/?pop=Y";
		}
		else if(page=="news") {
			o.style.width="640px";
			o.style.height="480px";
			o.style.marginLeft="-310px";
			popfrm.src="/post-office/north-pole-news/?pop=Y";
		}
		else if(page=="postmaster") {
			popfrm.src="/post-office/postmaster/?pop=Y";
		}
		else if(page=="elf1") {
			popfrm.src="/elf-house/elf1/?pop=Y";
		}
		else if(page=="elf2") {
			popfrm.src="/elf-house/elf2/?pop=Y";
		}
		else if(page=="elf3") {
			popfrm.src="/elf-house/elf3/?pop=Y";
		}
		else if(page=="elf4") {
			popfrm.src="/elf-house/elf4/?pop=Y";
		}
		else if(page=="elf5") {
			popfrm.src="/elf-house/elf5/?pop=Y";
		}


		else if(page=="dasher") { popfrm.src="/reindeer-barn/dasher/?pop=Y"; } 
		else if(page=="dancer") { popfrm.src="/reindeer-barn/dancer/?pop=Y"; } 
		else if(page=="prancer") { popfrm.src="/reindeer-barn/prancer/?pop=Y"; } 
		else if(page=="vixen") { popfrm.src="/reindeer-barn/vixen/?pop=Y"; } 
		else if(page=="comet") { popfrm.src="/reindeer-barn/comet/?pop=Y"; } 
		else if(page=="cupid") { popfrm.src="/reindeer-barn/cupid/?pop=Y"; } 
		else if(page=="donder") { popfrm.src="/reindeer-barn/donder/?pop=Y"; } 
		else if(page=="blitzen") { popfrm.src="/reindeer-barn/blitzen/?pop=Y"; } 
		else if(page=="rudolph") { popfrm.src="/reindeer-barn/rudolph/?pop=Y"; } 



		else {
			popfrm.src="/blank.asp";	
		}

		o.style.display = "block";
	}

}

function hideTextBox() {
	
	var o = null;
	var popfrm = null;

	if(document.all) {
		o = document.all("TextPopup");
		popfrm = document.all("popframe");
	}
	else if(document.getElementById) {
		o = document.getElementById("TextPopup");
		popfrm = document.getElementById("popframe");
	}

	if(o!=null) {
		popfrm.src="/blank.asp";
		o.style.display = "none";
	}

}


