var url="";
var w="";
var h="";

/*function sendTracking(sPageName, sPageMLC, sExitLink){
	if((sPageName != "") && (sPageMLC != "")) {
	//	alert("Tracking Issued\nPage Name: "+sPageName+"\nMLC: "+sPageMLC);
	//	hitbox.Set_hbPageView(sPageName,sPageMLC);
	}
	if(sExitLink != "" ) {
//		alert("ExitLink: "+sExitLink);
	//	hitbox.Set_hbLink(sExitLink);
	}
}
*/
function pop(sCase) {
	switch (sCase){
		case "MovieRewards":
			url="http://disney.go.com/disneymovierewards/";
			//simpleTrack("movierewards");
			window.location = url;
		break;
		case "101Dalmatians":
			url="http://disney.go.com/disneyvideos/animatedfilms/101dalmatians/";
			//simpleTrack("101dalmations");
			window.location = url;
		break;
		case "SnowBuddies":
			//url="http://adisney.go.com/disneyvideos/liveaction/snowbuddies/";
			simpleTrack("snowbuddies");
			window.location = url;
		break;
		case "LittleMermaid3":
			url="http://disney.go.com/disneyvideos/animatedfilms/littlemermaid3/";
			//simpleTrack("littlemermaid3");
			window.location = url;
		break;
		case "order_now":
			//simpleTrack("buynow_menu");
			var url="http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/webapp/wcs/stores/servlet/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1222026&langId=-1&categoryId=13680&CMP=OTL-TWDC_BVHE&att=BVHE";
			window.open(url,'enchanted_order');
		break;
		case "order_dvd":
			//simpleTrack("buynow");
			url="http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/webapp/wcs/stores/servlet/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1222026&langId=-1&categoryId=13680&CMP=OTL-TWDC_BVHE&att=BVHE";
			window.open(url,'enchanted_order');
		break;
		case "order_bluray":
			//simpleTrack("buynow_bluray");
			url="http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/webapp/wcs/stores/servlet/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1222030&langId=-1&categoryId=13680&CMP=OTL-TWDC_BVHE&att=BVHE";
			window.open(url,'enchanted_order');
		break;
		case "textonly_order_now":
			//simpleTrack("buynow");
			var url="http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/webapp/wcs/stores/servlet/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1222026&langId=-1&categoryId=13680&CMP=OTL-TWDC_BVHE&att=BVHE";
			window.open(url,'enchanted_order');
		break
		case "textonly_trailer":
			var url="http://www.totaleclips.com/player/splash.aspx?clipid=e37006&custid=3&playerid=2";
			w="340"
			h="480"
	        popup(url,w,h);
			//simpleTrack("trailer");
		break
		case "screensaver_pc":
			getFile("usa/downloads/encantada_screensaver.zip");
			//simpleTrack("screensaver_pc");
		break;
		case "email_sig":
			getFile("usa/downloads/encantada_firma_digital.zip");
			//simpleTrack("email_sig");
		break;
		default:
			alert("popup <" + sCase + "> failed to launch")	
		break;
	}
}

function popup(theURL,w,h){
	w=Number(w);
	h=Number(h);
	mywin=window.open(theURL, "pop",'width='+w+',height='+h+',top='+((screen.height / 2) - (h / 2))+',left='+((screen.width / 2) - (w / 2))+',toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no')
	mywin.focus();
}

function getFile(filename){
	theURL = "download.html?theFile=" + filename;
	mywin=window.open(theURL, "download",'width=450,height=334,top='+((screen.height / 2) - (334 / 2))+',left='+((screen.width / 2) - (450 / 2))+',toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no')
	mywin.focus();
}



/*function simpleTrack (sID) {
	var args = sID.split("|");
	var case_str = args[0];
	var append = args[1] == undefined ? "" : args[1] ;

	var sPageMLC = "";
	var sPageName = "";
	var sExitLink = "";
	
	switch(case_str.toLowerCase()) {		
		case "homepage":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Homepage";
			sPageMLC="enchanted/information/home;information/live+action/enchanted/home";
			sPageName="home+page";
		break;
		case "noflash":
			sPageMLC="enchanted/information/home;information/live+action/enchanted/home";
			sPageName="no+flash";
		break;
		case "textonly":
			sPageMLC="enchanted/information/home;information/live+action/enchanted/home";
			sPageName="text+only";
		break;
		case "synopsis":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_About";
			sPageMLC="enchanted/about/synopsis;about/live+action/enchanted/synopsis";
			sPageName="story";
		break;
		case "story":
			sPageMLC="enchanted/about/synopsis;about/live+action/enchanted/synopsis";
			sPageName="story";
		break;
		case "dvdbonus":
			sPageMLC="enchanted/about/bonus+features;about/live+action/enchanted/bonus+features";
			sPageName="dvd+bonus+features";
		break;
		case "bluraybonus":
			sPageMLC="enchanted/about/bonus+features;about/live+action/enchanted/bonus+features";
			sPageName="bluray+bonus+features";
		break;
		case "techspecs":
			sPageMLC="enchanted/about/tech+specs;about/live+action/enchanted/tech+specs";
			sPageName="tech+specs";
		break;

		case "characters":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Cast";
			sPageMLC="enchanted/about/cast;about/live+action/enchanted/cast";
			sPageName="cast";
		break;
		case "downloads":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Downloads";
			sPageMLC="enchanted/downloads;downloads/live+action/enchanted";
			sPageName="downloads+main";
		break;
		case "screensaver_pc":
			sPageMLC="enchanted/downloads/screensavers;downloads/live+action/enchanted/screensavers";
			sPageName="ss+pc";
		break;
		case "screensaver_mac":
			sPageMLC="enchanted/downloads/screensavers;downloads/live+action/enchanted/screensavers";
			sPageName="ss+mac";
		break;
		case "email_sig":
			sPageMLC="enchanted/downloads/signatures;downloads/live+action/enchanted/signatures";
			sPageName="sig1";
		break;
		case "gallery":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Gallery";
			sPageMLC="enchanted/multimedia/photo+galleries;multimedia/live+action/enchanted/photo+galleries";
			sPageName="gallery"
		break;
		case "games":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Games";
			sPageMLC="enchanted/interactive+content/games;interactive+content/live+action/enchanted/games";
			sPageName="games+main"
			if (append != ""){
				sPageName = append;
				append = "";
			}
		break;
		case "videos":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Videos";
			sPageMLC = "enchanted/multimedia;multimedia/live+action/enchanted";
			sPageName = "videos+main";
		break;
		case "buynow_menu":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Buynow";
			sExitLink="exit_enchanted_menu_order+now";
		break;
		case "buynow":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Buynow";
			sExitLink="exit_enchanted_dvd+order";
		break;
		case "buynow_bluray":
			document.images.actiontag.src="http://switch.atdmt.com/action/Enchanted_Buynow_BluRay";
			sExitLink="exit_enchanted_bluray+order";
		break;
		case "movierewards":
			sExitLink="exit_enchanted_disney+movie+rewards";
		break;
		case "101dalmations":
			sExitLink="exit_enchanted_synergy_101+dalmations";
		break;
		case "101dalmations":
			sExitLink="exit_enchanted_synergy_101+dalmations";
		break;
		case "snowbuddies":
			sExitLink="exit_enchanted_synergy_snow+buddies";
		break;
		case "littlemermaid3":
			sExitLink="exit_enchanted_synergy_little+mermaid+ariels+beginning";
		break;
			
		
	//misc tracking calls we're not using
		case "intro_start":
		case "fun_stuff_synopsis":
		case "fun_stuff_gallery":
		case "fun_stuff_videos":
		case "fun_stuff_characters":
		case "fun_stuff_downloads":
		case "game+thumbnail":
		case "characters+thumbnail":
		case "downloads+wallpaper":
		case "downloads+msn":
			//do nothing.
		break;
		
		default:
		// videos require different parsing, and if sCase made it this far, that's probably why.
		   trackVideo(sID);
		break;
	}
	sendTracking(sPageName, sPageMLC, sExitLink);		
}


function trackVideo(sID){
	var tmp = sID.split("_");
	var case_str = tmp[0];
	var percent = tmp[1] == undefined ? "" : tmp[1] ;
	var args =  tmp[0].split("|");
	case_str = args[0];
	var append = args[1]; 
	
	
	

	var sPageMLC = "";
	var sPageName = "";
	var sExitLink = "";
	
	if (percent=="1"){
		switch(case_str.toLowerCase()) {
			case "trailer":
				sPageMLC="enchanted/multimedia/bonus+clips;multimedia/live+action/enchanted/trailers";
				sPageName="trailer";
			break;
			case "clip":
				sPageMLC="enchanted/multimedia/clips;multimedia/live+action/enchanted/clips";
				sPageName="clip";
			break;
			case "bonus":
				sPageMLC="enchanted/multimedia/trailers;multimedia/live+action/enchanted/trailers";
				sPageName="bclip";
			break;
			default:
				//alert("untracked tag: " + sID);
			break;
		}
		if ((append != "")&&(append != undefined)){ sPageName += append; }
		
		sendTracking(sPageName, sPageMLC, sExitLink);	
	}
}
*/


/*function popUpAndTrack (sID, sUrl, nWidth, nHeight, sType) {
	if(sType == "_self"){
		document.location = sUrl;
	}else{
		//window.open(sUrl,sID,'width=' + nWidth + ',height=' + nHeight + ',scrollbars=1,resizable=1');
		window.open(sUrl,'POTC3','width=' + nWidth + ',height=' + nHeight + ',scrollbars=1,resizable=1');
	}
	
	setTimeout('simpleTrack(\''+sID+'\')',2000);
}
*/
function launchPopUp(sUrl, nWidth, nHeight,arg_scrollbars, arg_resizeable) {
		if(arg_scrollbars == null){
			var bScrollbars = 1;
		}else{
			var bScrollbars = arg_scrollbars;
		}
		if(arg_resizeable == null){
			var nResize = 1;
		}else{
			var bResize = arg_resizeable;
		}
		window.open(sUrl,'window','width=' + nWidth + ',height=' + nHeight + ',scrollbars='+bScrollbars+',resizable='+bResize);
}
	

function mailtoAndTrack (sID, sBody, sSubject) {
	document.location = "mailto:?body=" + sBody + "&subject=" + sSubject;
	//simpleTrack(sID);
}

function changeIframe(ns){
	document.getElementById('convtrackingiframe').src = "conv_tracking/" + ns + ".html";
}

