//********
//  flash_detect.js
//********
var isLayer;
var maxVersion = 25;
var minVersion = 0;
var flashVersion = 0;
var f2,f3,f4,f5,f6,f7,f8 = false;
var isMac = (navigator.appVersion.indexOf("Mac") >=0) ? true : false;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isN6 = (document.getElementById && !document.all) ? true : false;
var isN	= (document.layers) ? true : false;
var useLayer = (isN || isN6 || isMac) ? true : false ;
var plat = (window.navigator.userAgent.indexOf("AOL")>=0 || window.navigator.userAgent.indexOf("A.O.L.")>=0)? "AOL" : "norm";
if(isIE && isWin){
	document.write("<" + "SCR" + "IPT LANGUAGE=VBScript> \n");
    document.write("  Function VBGetSwfVer(i) \n");
    document.write("    on error resume next \n");
    document.write("    Dim swControl, swVersion \n");
    document.write("    swVersion = 0 \n");
    document.write("    set swControl = CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" + CStr(i)) \n");
    document.write("    if (IsObject(swControl)) then \n");
    document.write("      swVersion = i //swControl.GetVariable(\"$version\") \n");// disable full activeX object and just return the version primary
	document.write("      break  \n");
    document.write("    end if \n");
    document.write("    VBGetSwfVer = swVersion \n");
    document.write("End Function \n");
	document.write("// -->  \n");
	document.write("<" + "/SCR" + "IPT> \n");
}
function JSGetSwfVer(i) {     
      if (navigator.plugins != null && navigator.plugins.length > 0) {
            if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                  var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                        var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                        descArray = flashDescription.split(" ");
                        tempArrayMajor = descArray[2].split(".");
                        versionMajor = tempArrayMajor[0];
                  if ( descArray[3] != "" ) {
                        tempArrayMinor = descArray[3].split("r");
                  } else {tempArrayMinor = descArray[4].split("r");}
                        versionMinor = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
                        flashVer = parseFloat(versionMajor + "." + versionMinor);
            } else {flashVer = -1;}
      }
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
      else { flashVer = -1; }
      return flashVer;
}
if (isIE && isWin && !isOpera) {
	for (i = maxVersion; i > 0; i--) {
      	flashVersion = VBGetSwfVer(i);
	  	if (flashVersion) { break };
	} 
} else {
      flashVersion = JSGetSwfVer(maxVersion);
	  flashVersion = Math.floor(flashVersion);
}

//********
//Media.js
//********
mediaList = new Array();
function Media(type){this.type = type;}
Media.prototype.showMedia = function(type){
	if (this.type.toLowerCase() == "mov") this.showMov();
	if (this.type.toLowerCase() == "swf") this.detectFlash();
}
Media.prototype.detectFlash = function(){
	if (this.exists(flashVersion)){				
		if (this.isLayer && useLayer){flashPresent=1;document.write("<div"+" id=\"flashLayer\" class=\"flashLayerClass\">")}
		if (flashVersion >= this.minVersion){this.addMedia();this.showSwf();}
		else this.showAlt();
		if (this.isLayer && useLayer) document.write("</div>");
		if ( (isMac && isIE) || (isN6) ) dhtml = 0;
	}
}
Media.prototype.showSwf = function(type){	
	this.setMovieLoc();	
	this.setFlashVars();	
	if (this.name == "false"){this.name = "swf"+mediaList.length;}
	document.writeln("<" + "OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"" + this.name + "\" ");
	document.writeln(" CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); 
	document.writeln(" WIDTH=" + this.width + " HEIGHT=" + this.height);
	if (this.usePopup) document.writeln(" onMouseUp=\"Media.prototype.doAction()\" ");	
	document.writeln(" > ");	
	document.writeln(" <"+"PARAM NAME=MOVIE VALUE=" + this.movieLoc + "> ");
	document.writeln(" <"+"PARAM NAME=PLAY VALUE=true> ");
	document.writeln(" <"+"PARAM NAME=LOOP VALUE=true> ");
	if (this.bgcolor != "nobg") document.writeln(" <"+"PARAM NAME=bgcolor VALUE=#" + this.bgcolor + "> ");
	document.writeln(" <"+"PARAM NAME=QUALITY VALUE=best> ");	
	document.writeln(" <"+"PARAM NAME=FlashVars VALUE="+this.flashVars+"> ");		
	document.writeln(" <"+"PARAM NAME=MENU VALUE=" + this.menu + "> ");
	if ((this.wmode7 && (flashVersion >= 7)) || !this.wmode7){document.writeln(" <"+"PARAM NAME=WMODE VALUE=" + this.wmode + ">");}
	document.writeln("<EMB"+"ED NAME=\"" + this.name + "\" SRC=" + this.movieLoc + " ");
	document.writeln("FlashVars=" + this.flashVars + " ");
	document.writeln(" WIDTH=" + this.width + " HEIGHT=" + this.height + " play=true ");
	document.writeln(" loop=true QUALITY=best ALIGN=TOP ");
	if (this.bgcolor != "nobg") document.writeln(" BGCOLOR=#" + this.bgcolor + " ");
	document.writeln(" TYPE=application/x-shockwave-flash ");
	if ((this.wmode7 && (flashVersion >= 7)) || !this.wmode7){document.writeln(" wmode=" + this.wmode );}
	document.writeln(" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">");
	document.writeln("</EMBED>");
	document.writeln("</OBJECT>");
}
Media.prototype.setFlashVars = function(){
	this.flashVars = "?plat=" + plat;
	if (this.userName != "null") {this.flashVars += "&userName=" + this.userName;}
	if (this.vars.length >= 1) {this.flashVars += "&"+this.vars;}
	if (this.useAdvals){this.flashVars += "&flashAdvars="+flashAdVars;}
	if (this.useCustom){this.flashVars += "&customVars="+flashCustomVars;}
}
Media.prototype.setMovieLoc = function(){return this.movieLoc;}
Media.prototype.showAlt = function(){
	if (this.altPage.length > 1){this.showAltPage();}
	else if (this.textAlt){this.showAltText();}
	else {this.showAltImage();}
}
Media.prototype.showAltPage = function(){document.write("<"+"iframe src=\""+this.altPage+"\" width="+this.width+" height="+this.height+" frameborder=0 scrolling="+this.altPageScroll+"></iframe>");}
Media.prototype.showAltImage = function(){
	var aInn = "";var aOut = "";
	var map = (this.usemap != "false")? "usemap=#"+this.usemap+" ": "";	
	if(this.usemap == "false"){
		aInn = (this.altHref.length > 1)? "<"+"a href=\""+this.altHref+"\">" : "";
		aOut = (this.altHref.length > 1)? "</A>" : "";
	}
	document.write(aInn+"<"+"img src=\""+this.altImage+"\" " + map + " width="+this.width+" height="+this.height+" border=0>"+aOut);
}
Media.prototype.showAltText = function(){
	var aInn = (this.altHref.length >= 1)? "<"+"div style=\"text-align:left;padding:5px;background-color:#EEEEEE;width:"+this.width+"px;height:"+this.height+"px\"><"+"a href=\""+this.altHref+"\" target=\"_blank\">" : "";
	var aOut = (this.altHref.length >= 1)? "</A></div>" : "";
	document.write(aInn+this.altText+aOut);
};
Media.prototype.exists = function(obj){return (typeof obj != "undefined")? true: false;};
Media.prototype.addMedia = function(){mediaList[mediaList.length] = this.movieLoc;};
Media.prototype.debug = function(){
	document.write("<br clear=all>");
	for (var prop in this){
		var obj =  typeof this[prop];
		if (obj =="function")  {document.write("");}
		else {document.write("<B>"+prop+"</B> = " + this[prop] + "\<BR>");}
	}
};
function commandObj() {}
argObject = new Object();
action = new commandObj;
Media.prototype.doAction = function() {
	if (commandObj != null) {
		action = new commandObj(argObject.args);
		commandObj = null;
		action = null;
	}
}
function openWindow(url, width, height, options, name) {var newWin = window.open(url, name, "width=" + width + ",height=" + height + "," + options);}
var winSite;
function linkOutside(strURL) {
	var statsTag = _hbRedirect("","Redirect","","&c4=" + strURL);
	winSite = window.open(strURL, "pop_up_ad");
	var winMsg = window.open("/common/ads/message/leavingYTV.asp?" +strURL, "Leaving_YTV", "noresize,scrollbars=no,width=350,height=432,status=no");
}
function launchSKActivate() { win = window.open("/common/inc/sitekick/checkSKStatus.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function launchSKKickstart() { win = window.open("/sitekick/kickstart.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function launchSKDeactivate() { win = window.open("/common/inc/sitekick/deactivateSitekick.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function openVideo(id) { link = window.open("video.asp?videoID=" + id,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width=320,height=240,left=250,top=250"); }
function openPic(url, w, h) { link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width="+w+",height="+h+",left=250,top=250"); }
function preloadCustomSize(strTheme,numID,numWidth,numHeight) {
	if (strTheme == undefined || strTheme == "") strTheme = "green";
	if (numID == undefined || numID == -1) alert("ERROR! GameID is undefined!");
	else w = window.open("/gamepad/play/Preloader/index.asp?theme=" + strTheme + "&id=" + numID + "&w=" + numWidth + "&h=" + numHeight,"game","width=" + numWidth +",height=" + numHeight + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
}
function launchOttawa() { win = window.open("/ottawaTimeChange.asp", "win", "height=300,width=400,scrollbars=no,location=no,menu=no,resize=no"); }
function reloadPageWithQueryString(strURL,strQueryString) { document.location = strURL + "?" + strQueryString; };
function launchGame(game) { link = window.open(game,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchGameFromAnywhere(folder,gameID) { link = window.open("/games/game.asp?gameFolder=/games/" + folder + "/&swf=game.swf&gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchGameFromAnywhereNoPreloader(folder,gameID) { link = window.open("/games/" + folder + "/game.asp?gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchPromoFromAnywhereNoPreloader(folder,gameID,promoURL) { link = window.open("/games/" + folder + "/game.asp?gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); document.location = promoURL; }
function launchCustomGameWindow(gameURL,winWidth,winHeight) { if (!winWidth) { winWidth = 550; } if (!winHeight) { winHeight = 400; } var game = window.open(gameURL,'game',"width=" + winWidth + ",height=" + winHeight + ",scrollbars=no,location=no,menu=no,resize=no"); }
function launchCustomGameWindowWithPromo(promoURL,gameURL,winWidth,winHeight) { if (!winWidth) { winWidth = 550; } if (!winHeight) { winHeight = 400; } var game = window.open(gameURL,'game',"width=" + winWidth + ",height=" + winHeight + ",scrollbars=no,location=no,menu=no,resize=no"); document.location = promoURL; }
function launchSpiderman() { win = window.open("/programming/shows/spiderman/minisite/index.html", "win", "height=560,width=800,scrollbars=no,location=no,menu=no,resize=no"); }
function preload(sTheme,nID,nWidth,nHeight) {
	if (nWidth == undefined || nWidth == "") nWidth = 550;
	if (nHeight == undefined || nHeight == "") nHeight = 400;
	if (sTheme == undefined || sTheme == "") sTheme = "green";
	if (nID == undefined || nID == -1) alert("ERROR! GameID is undefined!");
	else w = window.open("/gamepad/play/Preloader/index.asp?theme=" + sTheme + "&id=" + nID + "&w=" + nWidth + "&h=" + nHeight,"game","width=" + nWidth + ",height=" + nHeight + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
}
function Preload(sTheme,nID,nWidth,nHeight,sURL) {
	var s = (window.location.toString().indexOf("www.ytv.com/gamepad") != -1) ? "http://www.ytv.com" : "";
	var a = arguments;
	switch (a.length) {
		case 0: PreloadError(); break;
		case 1:
			if (typeof a[0] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=green&gameid=" + a[0] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 2:
			if (typeof a[0] == "string" && typeof a[1] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 3:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "string") {
				if (a[2].indexOf("|") == 0) {
					w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400&flashvars=" + a[2],"game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
				} else { w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[2]; }
			}
			else PreloadError();break;
		case 4:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 5:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number" && typeof a[4] == "string") { w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[4]; }
			else PreloadError();break;			
	}
}
function Adload(sTheme,nID,nWidth,nHeight,sURL) {
	var s = (window.location.toString().indexOf("www.ytv.com/gamepad") != -1) ? "http://www.ytv.com" : "";
	var a = arguments;
	switch (a.length) {
		case 0: PreloadError(); break;
		case 1:
			if (typeof a[0] == "number") w = window.open(s + "/interstitial.asp?theme=green&gameid=" + a[0] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 2:
			if (typeof a[0] == "string" && typeof a[1] == "number") w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 3:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "string") {
				if (a[2].indexOf("|") == 0) {
					w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400&flashvars=" + a[2],"game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
				} else { w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[2]; }
			}
			else PreloadError(); break;
		case 4:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number") w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 5:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number" && typeof a[4] == "string") { w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[4]; }
			else PreloadError();break;
	}
}
function PreloadError() { alert("Error: Incorrect number of arguments!\nUsage: Preload(ThemeColour,GameID,[Width],[Height],[RedirectURL])"); }
function AdditionalParameters(sVars) { return sVars.slice(1,sVars.length - 1); }
function openDebug() {
	var l = String(document.location);
	if (l.indexOf("debug") != -1 || l.indexOf("dev") != -1) var d = window.open("/test/debug/debug.html","debug","width=550,height=400,scrollbars=no,menubar=no,toolbar=no,location=no,status=no,resizable=yes");
}
function showUserDetails(uName) {window.open("http://www.ytv.com/membership/userdetails.asp?userName=" + uName,"","width=400,height=338,scrollbars,")}
function showSkipAd() {var elm = document.getElementById("skipAdLink");elm.style.visibility = 'visible';}
 
//********
// commonFunctions.js
//********
var isMoz = (document.getElementById && !document.all);
var isIE = (document.getElementById && document.all);
var isNav = (document.layers && !document.getElementById);
function showStatus(msg) { window.status = msg; return true; }
function on(imgName) {
	if (document.images) {
		eval("var " + imgName + "_on" + "= new Image()");
		eval(imgName.toString() + "_on.src = \"img\/" + imgName + "-on.gif\"");
		document[imgName].src = eval(imgName + "_on.src");
	}
}
function off(imgName) {
	if (document.images) {
		eval("var " + imgName + "_off" + "= new Image()");
		eval(imgName.toString() + "_off.src = \"img\/" + imgName + "-off.gif\"");
		document[imgName].src = eval(imgName + "_off.src");
		return showStatus('');
	}
}
if (document.images) {
  img101 = new Image();
  img101.src = "/common/img/but_Toggle_Prev_Off.gif";
  img1012 = new Image();
  img1012.src = "/common/img/but_Toggle_Prev_On.gif";  
  img102 = new Image();
  img102.src = "/common/img/but_Toggle_Next_Off.gif";
  img1022 = new Image();
  img1022.src = "/common/img/but_Toggle_Next_On.gif";   
  img103 = new Image();
  img103.src = "/common/img/mp_border.gif"; 
  img1032 = new Image();
  img1032.src = "/common/img/mp_border_over.gif";   
}
function OnImage(name) {
	if (document.images) {
		fullname = eval(name + "2");
		document[name].src = fullname.src;
	}
}
function OffImage(name) {
  if (document.images) {
    fullname = eval(name);
	if (fullname.complete) {document[name].src = fullname.src;}
  }
}
function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}
 var shWind;
 function launch(url) {
	shWind = window.open(url, 'popup', 'width=377,height=370,left=100,top=150,menubar=no,location=no,scrollbars=yes');
	shWind.focus();
}
function VideoPlayerPopUp(URL){
    day = new Date();id = day.getTime();
    pauseHomePageVideo();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=1000,height=700,left = 2,top = 2');");
}
function secureflash(file,id,width,height,quality,bgcolor,wmode) {
	var mode;
	if (wmode) { mode = "transparent"; } else { mode = "opaque"; }
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"https:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\"><param name=\"movie\" value=\"" + file + "\" \/><param name=\"quality\" value=\"" + quality + "\" \/><param name=\"bgcolor\" value=\"" + bgcolor + "\" \/><param name=\"wmode\" value=\"" + mode + "\" \/><param name=\"menu\" value=\"false\" \/><embed src=\"" + file + "\" quality=\"" + quality + "\" bgcolor=\"" + bgcolor + "\" width=\"" + width + "\" height=\"" + height + "\" menu=\"false\" name=\"" + id + "\" type=\"application\/x-shockwave-flash\" pluginspage=\"https:\/\/www.macromedia.com\/go\/getflashplayer\"><\/embed><\/object>");
}
function flash(file,id,width,height,quality,bgcolor,wmode) {
	var mode;
	if (wmode) mode = "transparent";
	else mode = "opaque";
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\"><param name=\"movie\" value=\"" + file + "\" \/><param name=\"quality\" value=\"" + quality + "\" \/><param name=\"bgcolor\" value=\"" + bgcolor + "\" \/><param name=\"wmode\" value=\"" + mode + "\" \/><param name=\"menu\" value=\"false\" \/><embed src=\"" + file + "\" quality=\"" + quality + "\" bgcolor=\"" + bgcolor + "\" width=\"" + width + "\" height=\"" + height + "\" menu=\"false\" name=\"" + id + "\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\"><\/embed><\/object>");
}
function flashSwap(file,id,width,height,quality,bgcolor,wmode,div) {
	var mode;
	if (wmode) mode = "transparent";
	else mode = "opaque";
	var temp = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\"><param name=\"movie\" value=\"" + file + "\" \/><param name=\"quality\" value=\"" + quality + "\" \/><param name=\"bgcolor\" value=\"" + bgcolor + "\" \/><param name=\"wmode\" value=\"" + mode + "\" \/><param name=\"menu\" value=\"false\" \/><embed src=\"" + file + "\" quality=\"" + quality + "\" bgcolor=\"" + bgcolor + "\" width=\"" + width + "\" height=\"" + height + "\" menu=\"false\" name=\"" + id + "\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\"><\/embed><\/object>";
	eval("document.getElementById('" + div + "').innerHTML = temp");
}
function flashLogout() {document.location = "http://" + location.host + "/members/logout.asp";}
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000);
function flashLogin() {document.cookie = "TARGET=" + escape(document.location)+"; path=/; domain=ytv.com; expires" + expiry.toGMTString();}
function flashLoginButton() {
	document.cookie = "TARGET=" + escape(document.location)+"; path=/; domain=ytv.com; expires" + expiry.toGMTString();
	var is_mac, is_ie;
	var agt=navigator.userAgent.toLowerCase();
	var is_mac=(agt.indexOf("mac")!=-1);
	var is_op=(agt.indexOf("opera") !=-1);
	var is_ie=(is_op==false && agt.indexOf("msie") !=-1);
}
function setTargetCookies() {document.cookie = "TARGET=" + escape(document.location)+"; path=/; domain=ytv.com ";}
function setTimeZone(timezone) {
	var today = new Date();
	var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000);
	document.cookie = "YTVguide=TimeZone="+escape(timezone)+"; path=/; expires="+expiry.toGMTString();
	document.location = document.location;
}
function openWindow(url, width, height, options, name) {var newWin = window.open(url, name, "width=" + width + ",height=" + height + "," + options);}
var winSite;
function linkOutside(strURL) {
	var statsTag = _hbRedirect("","Redirect","","&c4=" + strURL);
	winSite = window.open(strURL, "pop_up_ad");
	var winMsg = window.open("/common/ads/message/leavingYTV.asp?" +strURL, "Leaving_YTV", "noresize,scrollbars=no,width=350,height=432,status=no");
}
function launchSKActivate() { win = window.open("/common/inc/sitekick/checkSKStatus.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function launchSKKickstart() { win = window.open("/sitekick/kickstart.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function launchSKDeactivate() { win = window.open("/common/inc/sitekick/deactivateSitekick.asp", "win", "height=400,width=550,scrollbars=no,location=no,menu=no,resize=no"); }
function openVideo(id) { link = window.open("video.asp?videoID=" + id,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width=320,height=240,left=250,top=250"); }
function openPic(url, w, h) { link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,width="+w+",height="+h+",left=250,top=250"); }
function preloadCustomSize(strTheme,numID,numWidth,numHeight) {
	if (strTheme == undefined || strTheme == "") strTheme = "green";
	if (numID == undefined || numID == -1) alert("ERROR! GameID is undefined!");
	else w = window.open("/gamepad/play/Preloader/index.asp?theme=" + strTheme + "&id=" + numID + "&w=" + numWidth + "&h=" + numHeight,"game","width=" + numWidth +",height=" + numHeight + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
}
function launchOttawa() { win = window.open("/ottawaTimeChange.asp", "win", "height=300,width=400,scrollbars=no,location=no,menu=no,resize=no"); }
function reloadPageWithQueryString(strURL,strQueryString) { document.location = strURL + "?" + strQueryString; };
function launchGame(game) { link = window.open(game,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchGameFromAnywhere(folder,gameID) { link = window.open("/games/game.asp?gameFolder=/games/" + folder + "/&swf=game.swf&gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchGameFromAnywhereNoPreloader(folder,gameID) { link = window.open("/games/" + folder + "/game.asp?gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); }
function launchPromoFromAnywhereNoPreloader(folder,gameID,promoURL) { link = window.open("/games/" + folder + "/game.asp?gameID=" + gameID,"","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); document.location = promoURL; }
function launchCustomGameWindow(gameURL,winWidth,winHeight) { if (!winWidth) { winWidth = 550; } if (!winHeight) { winHeight = 400; } var game = window.open(gameURL,'game',"width=" + winWidth + ",height=" + winHeight + ",scrollbars=no,location=no,menu=no,resize=no"); }
function launchCustomGameWindowWithPromo(promoURL,gameURL,winWidth,winHeight) { if (!winWidth) { winWidth = 550; } if (!winHeight) { winHeight = 400; } var game = window.open(gameURL,'game',"width=" + winWidth + ",height=" + winHeight + ",scrollbars=no,location=no,menu=no,resize=no"); document.location = promoURL; }
function launchSpiderman() { win = window.open("/programming/shows/spiderman/minisite/index.html", "win", "height=560,width=800,scrollbars=no,location=no,menu=no,resize=no"); }
function preload(sTheme,nID,nWidth,nHeight) {
	if (nWidth == undefined || nWidth == "") nWidth = 550;
	if (nHeight == undefined || nHeight == "") nHeight = 400;
	if (sTheme == undefined || sTheme == "") sTheme = "green";
	if (nID == undefined || nID == -1) alert("ERROR! GameID is undefined!");
	else w = window.open("/gamepad/play/Preloader/index.asp?theme=" + sTheme + "&id=" + nID + "&w=" + nWidth + "&h=" + nHeight,"game","width=" + nWidth + ",height=" + nHeight + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
}
function Preload(sTheme,nID,nWidth,nHeight,sURL) {
	var s = (window.location.toString().indexOf("www.ytv.com/gamepad") != -1) ? "http://www.ytv.com" : "";
	var a = arguments;
	switch (a.length) {
		case 0: PreloadError(); break;
		case 1:
			if (typeof a[0] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=green&gameid=" + a[0] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 2:
			if (typeof a[0] == "string" && typeof a[1] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 3:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "string") {
				if (a[2].indexOf("|") == 0) {
					w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400&flashvars=" + a[2],"game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
				} else { w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[2]; }
			}
			else PreloadError();break;
		case 4:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number") w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 5:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number" && typeof a[4] == "string") { w = window.open(s + "/gamepad/play/Preloader/index.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[4]; }
			else PreloadError();break;				
	}
}
function Adload(sTheme,nID,nWidth,nHeight,sURL) {
	var s = (window.location.toString().indexOf("www.ytv.com/gamepad") != -1) ? "http://www.ytv.com" : "";
	var a = arguments;
	switch (a.length) {
		case 0: PreloadError(); break;
		case 1:
			if (typeof a[0] == "number") w = window.open(s + "/interstitial.asp?theme=green&gameid=" + a[0] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 2:
			if (typeof a[0] == "string" && typeof a[1] == "number") w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 3:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "string") {
				if (a[2].indexOf("|") == 0) {
					w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400&flashvars=" + a[2],"game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
				} else { w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=550,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[2]; }
			}
			else PreloadError();break;
		case 4:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number") w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
			else PreloadError();break;
		case 5:
			if (typeof a[0] == "string" && typeof a[1] == "number" && typeof a[2] == "number" && typeof a[3] == "number" && typeof a[4] == "string") { w = window.open(s + "/interstitial.asp?theme=" + a[0] + "&gameid=" + a[1] + "&w=550&h=400","game","width=" + a[2] + ",height=" + a[3] + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0"); window.location = a[4]; }
			else PreloadError();break;
	}
}
function PreloadError() { alert("Error: Incorrect number of arguments!\nUsage: Preload(ThemeColour,GameID,[Width],[Height],[RedirectURL])"); }
function AdditionalParameters(sVars) { return sVars.slice(1,sVars.length - 1); }
function openDebug() {
	var l = String(document.location);
	if (l.indexOf("debug") != -1 || l.indexOf("dev") != -1) var d = window.open("/test/debug/debug.html","debug","width=550,height=400,scrollbars=no,menubar=no,toolbar=no,location=no,status=no,resizable=yes");
}
function showUserDetails(uName){window.open("http://www.ytv.com/membership/userdetails.asp?userName=" + uName,"","width=400,height=338,scrollbars,")}
function showSkipAd() {var elm = document.getElementById("skipAdLink");elm.style.visibility = 'visible';}

//********
// divmenu.js
//********
function fixBGIEMac() {
    var bgVers = navigator.userAgent.toUpperCase();
    if (bgVers.indexOf("MSIE 5.") != -1 && bgVers.indexOf("MAC") != -1) {
        document.writeln('<style type="text/css">');
        document.writeln('<!--');
        document.writeln('BODY {background: #FFFFFF url(/img/gradient.jpg) repeat;}');
        document.writeln('-->');
        document.writeln('</style>');
    }
}
fixBGIEMac();
function sendGlobalNavForward() {
    var bgVers = navigator.userAgent.toUpperCase();
    try {document.getElementById('contentHolder').style.zIndex = 10;}
    catch(e) {}
    try {
        if (bgVers.indexOf("MSIE") != -1) {
            document.getElementById('globalNavHolder').style.overflowY = "visible";
            document.getElementById('globalNavHolder').style.height = "86px";
        }
    }
    catch(e) {}
    try {document.getElementById('globalNavHolder').style.zIndex = 2000;}
    catch(e) {}
}
function sendGlobalNavBack() {
    var bgVers = navigator.userAgent.toUpperCase();
    try {document.getElementById('contentHolder').style.zIndex = 10;}
    catch(e) {}
    try {
        if (bgVers.indexOf("MSIE") != -1) {document.getElementById('globalNavHolder').style.overflowY = "hidden";}
    }
    catch(e) {}
    try {document.getElementById('globalNavHolder').style.zIndex = 0;}
    catch(e) {}
}

//********
// forms_validation_code.js
//********	
	function IsBlank(strString) {
		for(var i =0; i < strString.length; i++) {
			var strChar = strString.charAt(i);
			if ((strChar !=' ') && (strChar != '\n') && (strChar != '\t')) return false;
		}
		return true;
	}
	function ElementIsRequired(strElementName) {
		var strUCaseName=strElementName.toUpperCase();
		if (strUCaseName.substr((strUCaseName.length-4),4)=="_NOT") {return false;}
		else {return true;}
	}
	function ValidateElement(varElement) {
		if ((varElement.value==null)||(varElement.value=="")||IsBlank(varElement.value)) {
			alert("Missing required info!");
			varElement.focus();
			return false;
		}
		else{
			var strElementName=varElement.name;
			strElementName=strElementName.toUpperCase();
			if (strElementName.search("RUNNINGLENGTH")>-1) {
				if (ValidateRunningLength(varElement.value)) {return true;}
				else {
					alert("Invalid Running Length format!\n(Use hh:mm:ss, e.g., 01:32:13)");
					varElement.focus();
					return false;
				}
			}
			return true;
		}
	}
	function ValidateForm(objForm) {
		for (a=0; a < objForm.length;a++) {
			if ((ElementIsRequired(objForm.elements[a].name))&&((objForm.elements[a].type=="text")||(objForm.elements[a].type=="textarea"))) {
				if (!ValidateElement(objForm.elements[a])) {return false;}
			}
		}
		return true;
	}
	function ValidatePhoneNumber(strPhoneText) {
		var strCleanedString="";var strCurrentChar;var a;
		for (a=0;a<strPhoneText.length;a++) {
			strCurrentChar=strPhoneText.substring(a,a+1);
			if (strCurrentChar.search("[0-9]")>-1) {
				strCleanedString=strCleanedString + strCurrentChar;
			}
		}
		if (strCleanedString.length<10) {return false;}
		else {return true;}
	}	
	function ValidateHourMinuteSecondTime(strTime) {
		var strPattern = strTime;
		var lngResult = strPattern.search("[0-1][0-9]:[0-5][0-9]:[0-5][0-9]");
		if (lngResult==-1) {lngResult = strPattern.search("[2][0-3]:[0-5][0-9]:[0-5][0-9]");}
		if (lngResult==-1) {return false;}
		else {return true;}
	}	
	function ValidateEmailAddress(email){
	  if (email.length<3) {return false;}
	  var result = false;
	  var theStr = new String(email);
	  var index = theStr.indexOf("@");
	  if (index > 0) {
	    var pindex = theStr.indexOf(".",index);
	    if ((pindex > index+1) && (theStr.length > pindex+1)) result = true;
	  }
	  return result;
	}
function isNumeric(string, ignoreWhiteSpace) {
	if (string.search) {if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;}
	return true;
}
function isAlphanumeric(string, ignoreWhiteSpace) {
	if (string.search) {if ((ignoreWhiteSpace && string.search(/[^\w\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\W/) != -1)) return false;}
	return true;
}
function isValidEmail(address) {
	if (address.indexOf('@') < 3) return false;
	var name = address.substring(0, address.indexOf('@'));
	var domain = address.substring(address.indexOf('@') + 1);
	if (name.indexOf('(') != -1 || name.indexOf(')') != -1 || name.indexOf('<') != -1 || name.indexOf('>') != -1 || name.indexOf(',') != -1 || name.indexOf(';') != -1 || name.indexOf(':') != -1 || name.indexOf('\\') != -1 || name.indexOf('"') != -1 || name.indexOf('[') != -1 || name.indexOf(']') != -1 || name.indexOf(' ') != -1) return false;
	if (domain.indexOf('(') != -1 || domain.indexOf(')') != -1 || domain.indexOf('<') != -1 || domain.indexOf('>') != -1 || domain.indexOf(',') != -1 || domain.indexOf(';') != -1 || domain.indexOf(':') != -1 || domain.indexOf('\\') != -1 || domain.indexOf('"') != -1 || domain.indexOf('[') != -1 || domain.indexOf(']') != -1 || domain.indexOf(' ') != -1) return false;
	return true;
}
function seriousEmailCheck (emailStr) {
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {return false;}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i=0; i<user.length; i++) {if (user.charCodeAt(i)>127) {return false;}}
	for (i=0; i<domain.length; i++) {if (domain.charCodeAt(i)>127) {return false;}}
	if (user.match(userPat)==null) {return false;}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {for (var i=1;i<=4;i++) {if (IPArray[i]>255) {return false;}}return true;}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {if (domArr[i].search(atomPat)==-1) {return false;}}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {return false;}
	if (len<2) {return false;}
	return true;
}
function isValidPostalcode(postalcode) {
	if (postalcode.search) {
		if (postalcode.length == 6 && postalcode.search(/^\w\d\w\d\w\d$/) != -1) return true;
		else return false;
	}
	return true;
}