var siteRoot = "";

function popTokenZone(num){
	var number=new Array("102", "104", "105", "106", "107", "108", "109", "101", "110", "111", "112", "113", "114", "302", "103", "116", "117", "118", "304", "119", "303", "4446", "3840", "5052", "5355", "5658", "5961", "2226", "3537", "4143", "4749", "2731", "3234");
	var token=new Array("http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022102-tc102-fvfba-df3q3-ritez-swubq",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022104-tc104-zdnfe-wh2xh-mg5iy-9adst",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022105-tc105-fvfba-df3q3-ritez-swubq",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022106-tc106-krnjt-adu25-ppw3q-aj8si",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022107-tc107-mcm65-ug5rp-26px4-65ps4",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022108-tc108-mpdcc-vq9c3-n28up-p3xqp",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022109-tc109-gdk25-a6crg-5484v-h9fwm",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022101-tc101-zdnfe-wh2xh-mg5iy-9adst",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022110-tc110-2wejq-qdeq7-37wzy-32u5u",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022111-tc111-7yhhb-tuwj5-g5ijp-wg29x",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022112-tc112-3h7wi-ghe38-as2sp-s8shx",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022113-tc113-mwdfd-qtgga-uqdiy-hci7c",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022114-tc114-rhhfs-ukzi5-5mck7-wci9u",
			"http://tokenzone.go.com/dus/processGame?setId=6022&ac=6022302-tc302-pumwv-g43gd-kq7mq-g6pgp",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022103-tc103-krnjt-adu25-ppw3q-aj8si",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022115-tc115-rzjfs-gs388-wh575-fu6wa",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022116-tc116-gc84j-jqgsb-eavct-sdnb9",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022117-tc117-kn8hn-8yuvx-b5ivm-8ux8x",
			"http://tokenzone.go.com/dus/processGame?setId=6022&ac=6022304-tc304-qm6i2-p4vjc-y2eah-qtuch",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022118-tc118-28ntw-e9w67-u7bvs-p4ke6",
			"http://tokenzone.go.com/dus/processGame?setId=6022&ac=6022303-tc303-d3ax8-ggdt7-ajff8-pkets",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022164-tc164-7j74a-54xct-nu47u-zzwxy",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022165-tc165-dpzir-6hke5-z5nhm-fpie7",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022166-tc166-nzf2c-wiq3v-7w66g-wg2rh",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022167-tc167-d6zny-ivb23-84jap-6vug5",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022168-tc168-wrdna-s8mfr-xjban-8v85m",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022169-tc169-e44g3-4gz5f-jxp97-vjr4k",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022154-tc154-875xt-n6xgp-gtnm5-uggnq",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022155-tc155-x9udm-etvur-rzhq8-ksatq",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022156-tc156-w38f8-5bv79-zdbze-xzk79",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022157-tc157-2nphx-jh7pt-vi6x5-whdsa",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022159-tc159-mjj32-fa3de-4qxvy-tgnaq",
			"http://tokenzone.go.com/dus/processHiddenToken?setId=6022&ac=6022160-tc160-xubev-d3mxf-j6czh-9atr8");

	for(i=0;i<=token.length;i++){
		if(num==number[i]){
			var url=token[i];
		}
	}
	openWindowSelf(url);
}


function popWindow( url, width, height, windowName )
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return window.open(url, windowName, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function popScrollingWindow(url, width, height, windowName)
{
    //get center coords
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    
    return window.open(url, windowName, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
}
function openWindow(url)
{
    var rand = "_blank";
    return window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}

function openWindowSelf(url)
{
    var rand = "_self";
    return window.open(url,rand,"directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes");
}



// DISCLAIMER POPUP SCRIPT
function openDisclaimer(link){
	win = window.open('http://disney.go.com/disneypictures/javascript/disclaimer/disclaimer.html?'+ link, 'intermediate', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=370,height=210');
}

function downloadFile(theFile)
{
    popWindow(siteRoot + "download.html?theFile="+theFile, 300, 100, "downloadWindow");
}

var debugFlag=false;
function debug(string)
{
    if (debugFlag == true)
	{
		alert(string);
	}
}

function track(trackString)
{
	debug(trackString);
    switch (trackString)
    {
    case "XXXXX":
        break;
    default:
        hitbox.Set_hbPageView(trackString,"/Narnia");
        break;
    }
}

function popClip(clip, player, size)
{
    player = player.toUpperCase();
    size = size.toLowerCase();

    popWindow(siteRoot + "clips/clips.html?movie="+clip+"&size="+player+size, 648, 488, "trailer");
}

function popAIM()
{
    popWindow(siteRoot + "aim/aim.html", 520, 300, "aim_icons");
}
function popAIM2()
{
    popWindow(siteRoot + "aim/temp.html", 400, 300, "aim_icons2");
}
function popSingleAIM(iconFile)
{
    popWindow(siteRoot + "aim/aim_single.html?icon="+iconFile, 400, 300, "aim_icon");
}
function popAIMTumnus(icon)
{
    popSingleAIM("aim_tumnus0"+icon+".gif");
}
function popAIMIcon(icon)
{
    switch(icon)
	{
	case "landscape1":
		popSingleAIM("aim_griffin.gif");
		break;
	case "landscape2":
		popSingleAIM("aim_grimacefaun.gif");
		break;
	case "landscape3":
		popSingleAIM("aim_lion.gif");
		break;
	case "whitewitch1":
		popSingleAIM("WHITEWITCH_AIM1.gif");
		break;
	case "whitewitch2":
		popSingleAIM("WHITEWITCH_AIM2.gif");
		break;
	case "whitewitch3":
		popSingleAIM("WHITEWITCH_AIM3.gif");
		break;
	case "whitewitch4":
		popSingleAIM("WHITEWITCH_AIM4.gif");
		break;
	default:
		break;
	}
}

function installAimIcon(iconNumber)
{
	/*var icon = "aim_logo.gif";
	switch (iconNumber)
	{
	case 1:
		icon = "aim_logo.gif";
		break;
	case 2:
		icon = "aim_aslan.gif";
		break;
	case 3:
		icon = "aim_tumnus.gif";
		break;
	case 4:
		icon = "aim_lucy.gif";
		break;
	case 5:
		icon = "aim_susan.gif";
		break;
	case 6:
		icon = "aim_peter.gif";
		break;
	case 7:
		icon = "aim_edmund.gif";
		break;
	case 8:
		icon = "aim_whitewitch.gif";
		break;
	case 9:
		icon = "aim_wardrobe.gif";
		break;
	case 10:
		icon = "aim_lamp.gif";
		break;
	default:
		break;
	}

	var pagePath = "" + window.location;
	pagePath = pagePath.substring(0,pagePath.lastIndexOf("/")+1);
    var iconPath = "aim/";
    window.location.href="aim:BuddyIcon?src="+pagePath+siteRoot+iconPath+icon;*/

	popAIM();
}

function popWallpaper(project, wallpaper, size)
{
	openWindow(siteRoot + "wallpaper/wallpaper.html?image=nn_wall_"+project+"_"+wallpaper+".jpg");
}

function popNarnia(section)
{
	switch(section)
	{
	case "chronicles":
        window.open('http://books.narnia.com/movielanding.html','chronicles','toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes');
		//window.open('http://books.narnia.com/movielanding.html','chronicles','toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=770,height=750');
		//openWindow("http://books.narnia.com");
		//popWindow(siteRoot + "chronicles/index.html",768,533,"chronicles");
		break;
	case "discover":
        window.open('http://books.narnia.com/discover/explore/explorenarnia.html','ExploreNarnia','scrollbars=no,width=640,height=621');
		//openWindow("http://www.narnia.com");
		//popWindow(siteRoot + "discover/index.html",768,720,"discover");
		break;
	default:
		debug(section);
		break;
	}
}

function popClips()
{
	popWindow(siteRoot + 'behind_the_magic.html?movie=trailer&size=QTlarge&clip_title=Trailer',765,400,'narnia_clips');
}

function popClipsDis()
{
	//popWindow('http://disney.go.com/disneypictures/narnia/behind_the_magic.html',765,400,'narnia_clips');
	popWindow('behind_the_magic.html',765,400,'narnia_clips');
}

function popClips2()
{
	popWindow(siteRoot + 'international_trailer.html',765,400,'international_clips');
}

function popWaldenSweepstakes()
{
	openDisclaimer("http://www.walden.com/lww_contest.jsp");
}

function popMusic()
{
	popWindow(siteRoot + 'soundtrack/index_soundtrack.html', 716, 393,'soundtrack');
}

function popInspMore()
{
	openWindow('http://www.hearitfirst.com/narnia/');
}

function popStkBuy(nom)
{
	if(nom =="1"){
	openWindow('http://www.hearitfirst.com/Store/productDetail.aspx?iid=374319&tid=187&aid=835');
	}else{}


}



function switchToWhiteBG()
{
	debug("write code here to switch the background and chrome colors");
	document.body.bgColor = "#F3F5F5";
	document.getElementById("ratingsBlockBg").bgColor = "#F3F5F5";
}

function popTumnusGame()
{
	popWindow(siteRoot + "games/tumnus-game.html",870,425,"tumnus_game");
}
