/*
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 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 mailsorter_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" || page=="sendletter" ) {
			popfrm.src="/santas-house/email-santa/?pop=Y";
		}

		else if(page=="livechat") {
			//popfrm.src="/live-chat/?pop=Y";
			window.open("http://messenger.providesupport.com/messenger/kriskringle.html","chat","width=500,height=500");
		}

		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";	
		}


		if(page!="livechat" && page!="getletter") {
			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";
	}

}



