// JavaScript Document/***********************FSP version 1.0.2.01aCreated by Daniel NilandCopyright 2005 Disney**************************/// MSC FLASH detection system	var fspswVersion;var fspcId = 0;var fspaV = 0;var fspisIE = false; if (navigator.appVersion.indexOf("MSIE") != -1) {fspisIE = true}var fspisWin = false; if (navigator.appVersion.indexOf("Windows") != -1) {fspisWin = true}var playQueue = new Array();var stitchArray = new Array();var waiting = true;//waiting for ready signal?var synchIF;var fspobjs = new Array();synchIF = null;//synch iframe reference via frames[]synchID = null;//synch iframe ref via getElementByIDclearSynchedAd = true;	if(fspisIE && fspisWin){	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');	document.write('Function fspVBGetSwfVer(i) \n');	document.write('on error resume next \n');	document.write('Dim fspswControl, fspswVersion \n');	document.write('fspswVersion = 0 \n');	document.write('set fspswControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i)) \n');	document.write('if (IsObject(fspswControl)) then \n');	document.write('fspswVersion = 0 \n');	document.write('fspswVersion = fspswControl.GetVariable("$version") \n');	document.write('end if \n');	document.write('fspVBGetSwfVer = fspswVersion \n');	document.write('End Function \n');	document.write('</SCR' + 'IPT\> \n');} else {	var fspisOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;	function fspJSGetSwfVer(i){	      if (navigator.plugins != null && navigator.plugins.length > 0) {	            if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {	                  var fspswVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";	                        var fspflashDescription = navigator.plugins["Shockwave Flash" + fspswVer2].description;	                        fspdescArray = fspflashDescription.split(" ");	                        fsptempArrayMajor = fspdescArray[2].split(".");	                        fspversionMajor = fsptempArrayMajor[0];	                  if ( fspdescArray[3] != "" ) {	                        fsptempArrayMinor = fspdescArray[3].split("r");	                  } else {	                        fsptempArrayMinor = fspdescArray[4].split("r");	                  }	                        fspversionMinor = fsptempArrayMinor[1] > 0 ? fsptempArrayMinor[1] : 0;	                        fspflashVer = parseFloat(fspversionMajor + "." + fspversionMinor);	            } else {	                  fspflashVer = -1;	            }	      }	      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) fspflashVer = 4;	      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) fspflashVer = 3;	      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) fspflashVer = 2;	      else {	            fspflashVer = -1;	      }	      return fspflashVer;	}}function chkFSPFlash(rV){	var ua=navigator.userAgent.toLowerCase();	this.webtv = (ua.indexOf("webtv")>-1);	this.ie = (parseFloat(ua.slice(ua.indexOf("msie")+5)));	this.nn = (parseFloat(ua.slice(ua.indexOf("mozilla/")+8)));	var browser = navigator.appName.toLowerCase();	if (browser=="netscape"){	this.netscape = true;	}else{	this.netscape = false;	}	this.mac = (ua.indexOf("mac")>-1);	this.flash = false;	if (fspisIE && fspisWin){		var cVArray = fspVBGetSwfVer(rV).split(" ");		cVArray = cVArray[1].split(",");		fspaV = cVArray[0];	} else {		fspaV = fspJSGetSwfVer(rV);	}	if (fspaV >= rV) 	{		this.flash = true;	}}function fspObj() {	fspcId += 1;	//variables for the embedding of the fsp .swf	this.flashFile = null;	this.height = "400";	this.width = "300";    this.redirect = null;	this.altImg = "";	this.altTxt = null;	this.flashVars = null;	this.ID = "fspContainer";	this.name = "flash"+ fspcId;	this.webTV = "true";	this.redirect = null;	this.FlashVersion = 7;	this.wmode = null;		//variables for flashvars	this.session = "fsp_" + Math.round(Math.random()*1000);	this.defaultData = "default";	this.fspRoot = null;	this.streamServer = null;	this.progressiveServer = null;	this.bgImage = null;	this.bgColor = null;	this.textColor = null;	this.linkColor = null;	this.subtextColor = null;	this.controlBgColor = null;	this.controlForeColor = null;	this.controlTextColor = null;	this.listBgColor = null;	this.listBorderColor = null;		this.listOverColor = null;	this.listSelectedColor = null;	this.language = null;//default to en	this.nocache = null;	this.movieRatio = null;	this.fullScale = null;	this.padding = null;	this.playlistURL = null;	this.playlistViewer = null;//"false" or "<skinname>" to override domain .xml	this.playlistParser = null;//"<parsername>"  to override domain .xml	this.playlistMin = null;	this.playlistPosition = null;	this.systemComponent = null;	this.autoplay = null;	this.bufferSize = null;	this.movieViewer = null;//"false" or "<skinname>" to override domain .xml	this.controlViewer = null;//"false" or "<skinname>" to override domain .xml	this.helpUrl = null;	this.adType = null;//"adType"; to override domain .xml	this.adUrl = null;	this.adOnlySynch = null;	this.adPattern = null;	this.adPauseEnabled = null;	this.adStream = null;	this.hitType = null;	this.hitUrl = null;	this.hitAccount = null;	this.hitSendType = null;	this.ncManager = null;//change for different connection schemes to override domain .xml	this.bwLevel = null;//"high", "low", "auto"	this.bwThreshhold = null;	this.largeFormat = null;	this.truncation = null;	this.useFS = null;	this.clearSynchedAd = true;		//status variables	this.bw = null;	this.hasConnection = null;//streaming connection	this.hasPlaylistViewer = null;	this.hasControls = null;	this.hasMovieViewer = null;	this.version = null;	this.statusCall = null;	this.pageDelay = 50;		//functions	this.render = writeFSPComponent;	this.broadcast = execFlashMethod;	this.addListener = setEventListener;	this.removeListener = removeEventListener;	this.play = uiPlay;	this.playCategory = uiPlayCategory;	this.stop = uiStop;	this.pause = uiPause;	this.replay = uiReplay;	this.seek = uiSeek;	this.next = uiNext;	this.prev = uiPrev;	this.nextTimer = uiNextTimer;	this.prevTimer = uiPrevTimer;	this.mute = uiMute;	this.setVolume = uiSetVolume;	this.createSynchFrame = createSynchIFrame;	this.getPlaylist = uiNewPlaylist;	this.setBwLevel = uiSetBwLevel;	this.setBuffer = uiSetBuffer;	this.synchVisible = synchIFVisible;	this.pageFinished = uiPageFinished;	this.enableFullScale = uiEnableFullScale;		fspobjs[fspobjs.length] = this;}function writeFSPComponent(altFlashFile, write) {	var Ticket=new chkFSPFlash(this.FlashVersion);	var sCR;	this.flashFile = this.fspRoot + '/fspContainer.swf';	if (altFlashFile != undefined && altFlashFile != ""){if (checkForSystem()) this.flashFile = altFlashFile;}	//alert(this.flashFile);	if (Ticket.flash) {				// assemble flashvars:		this.flashVars = "session=" + this.session + "&domain=" + this.defaultData + "&fspRoot=" + this.fspRoot;				if (this.streamServer != null) this.flashVars += "&streamServer=" + this.streamServer;		if (this.progressiveServer != null) this.flashVars += "&progressiveServer=" + this.progressiveServer;		if (this.bgColor != null) this.flashVars += "&bgColor=" + this.bgColor;				if (this.bgImage != null) this.flashVars += "&bgImage=" + this.bgImage;		if (this.textColor != null) this.flashVars += "&textColor=" + this.textColor;		if (this.linkColor != null) this.flashVars += "&linkColor=" + this.linkColor;		if (this.subtextColor != null) this.flashVars += "&subtextColor=" + this.subtextColor;		if (this.controlBgColor != null) this.flashVars += "&controlBgColor=" + this.controlBgColor;		if (this.controlTextColor != null) this.flashVars += "&controlTextColor=" + this.controlTextColor;		if (this.controlForeColor != null) this.flashVars += "&controlForeColor=" + this.controlForeColor;		if (this.listBgColor != null) this.flashVars += "&listBgColor=" + this.listBgColor;		if (this.listBorderColor != null) this.flashVars += "&listBorderColor=" + this.listBorderColor;		if (this.listOverColor != null) this.flashVars += "&listOverColor=" + this.listOverColor;		if (this.listSelectedColor != null) this.flashVars += "&listSelectedColor=" + this.listSelectedColor;		if (this.language != null) this.flashVars += "&language=" + this.language;		if (this.nocache != null) this.flashVars += "&nocache=" + this.nocache;		if (this.movieRatio != null) this.flashVars += "&movieRatio=" + this.movieRatio;		if (this.fullScale != null) this.fullScale += "&fullScale=" + this.fullScale;		if (this.padding != null) this.flashVars += "&padding=" + this.padding;		if (this.hitType != null) this.flashVars += "&hitType=" + this.hitType;		if (this.hitUrl != null) this.flashVars += "&hitUrl=" + this.hitUrl;		if (this.hitAccount != null) this.flashVars += "&hitAccount=" + this.hitAccount;		if (this.hitSendType != null) this.flashVars += "&hitSendType=" + this.hitSendType;		if (this.playlistURL != null) this.flashVars += "&playlistURL=" + this.playlistURL;		if (this.playlistViewer != null) this.flashVars += "&playlistViewer=" + this.playlistViewer;		if (this.playlistParser != null) this.flashVars += "&playlistParser=" + this.playlistParser;		if (this.playlistPosition != null) this.flashVars += "&playlistPosition=" + this.playlistPosition;		if (this.systemComponent != null) this.flashVars += "&systemComponent=" + this.systemComponent;		if (this.playlistMin != null) this.flashVars += "&playlistMin=" + this.playlistMin;		if (this.autoplay != null) this.flashVars += "&autoplay=" + this.autoplay;		if (this.bufferSize != null) this.flashVars += "&bufferSize=" + this.bufferSize;		if (this.movieViewer != null) this.flashVars += "&movieViewer=" + this.movieViewer;		if (this.controlViewer != null) this.flashVars += "&controlViewer=" + this.controlViewer;		if (this.helpUrl != null) this.flashVars += "&helpUrl=" + this.helpUrl;		if (this.adType != null) this.flashVars += "&adType=" + this.adType;		if (this.adUrl != null) this.flashVars += "&adUrl=" + this.adUrl;		if (this.adOnlySynch != null) this.flashVars += "&adOnlySynch=" + this.adOnlySynch;		if (this.adPattern != null) this.flashVars += "&adPattern=" + this.adPattern;		if (this.adPauseEnabled != null) this.flashVars += "&adPauseEnabled=" + this.adPauseEnabled;		if (this.adStream != null) this.flashVars += "&adStream=" + this.adStream;		if (this.ncManager != null) this.flashVars += "&ncManager=" + this.ncManager;		if (this.bwLevel != null) this.flashVars += "&bwLevel=" + this.bwLevel;		if (this.bwThreshhold != null) this.flashVars += "&bwThreshhold=" + this.bwThreshhold;		if (this.largeFormat != null) this.flashVars += "&largeFormat=" + this.largeFormat;		if (this.truncation != null) this.flashVars += "&truncation=" + this.truncation;		if (Ticket.mac || Ticket.netscape) 		{			this.useFS = "false";			var wm = "";			if (this.wmode != null) wm = " WMODE='" + this.wmode + "'";			sCR="<EMBED SRC="+this.flashFile+" WIDTH="+this.width+" HEIGHT="+this.height+" QUALITY='high' SCALE='noScale' allowScriptAccess='always' FlashVars="+ this.flashVars +" "+wm+" ID="+this.ID+" NAME="+this.name+" TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash></EMBED>";		} 		else if (fspisIE) {			sCR="<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version="+this.FlashVersion+",0,0,0\" ID=\"fspContainer\" WMODE='opaque' WIDTH=\""+this.width+"\" HEIGHT=\""+this.height+"\">\n";			sCR+="<PARAM NAME=movie VALUE=\""+this.flashFile+"\">\n";			sCR+="<PARAM NAME=allowScriptAccess VALUE=\"always\">\n";			sCR+="<PARAM NAME=scale VALUE=\"noscale\"><PARAM NAME=menu VALUE=\"false\">\n";			if (this.wmode != null) sCR+="<PARAM NAME=wmode VALUE=\"" + this.wmode + "\">\n";			sCR+="<PARAM NAME=FlashVars VALUE=\""+this.flashVars+"&useFS=" + this.useFS + "\">\n";			sCR+="<EMBED SRC="+this.flashFile+" WIDTH="+this.width+" HEIGHT="+this.height+" QUALITY='high' SCALE='noScale' FlashVars="+ this.flashVars +" ID="+this.ID+" NAME="+this.name+" MENU='false' TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash></EMBED></OBJECT>\n";		} 		else //webtv		{			this.useFS = "false";			var wm = "";			if (this.wmode != null) wm = " WMODE='" + this.wmode + "'";			sCR="<EMBED SRC="+this.flashFile+" swLiveConnect=TRUE WIDTH="+this.width+" HEIGHT="+this.height+" QUALITY="+this.quality+" SCALE="+this.scale+" ID="+this.ID+" NAME="+this.name+" "+wm+" allowScriptAccess='always' FlashVars="+ this.flashVars +" TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash></EMBED>";		}				//put in Iframes for possible use in ad tracking and hit tracking		sCR +=	"<IFRAME id='hitIF' name='hit' scrolling='no' style='position:absolute;overflow:hidden;width:0;height:0;top:0;left:0;z-index:1002;border:0px'></IFRAME>";		sCR +=	"<IFRAME id='logIF' name='ads' scrolling='no' style='position:absolute;overflow:hidden;width:0;height:0;top:0;left:0;z-index:1001;border:0px'></IFRAME>";	}	else if (this.redirect)	{		top.location.href = this.redirect;	} 	else 	{		if (this.altTxt)		{			sCR = this.altTxt;		} 		else 		{			sCR="<IMG SRC="+this.altImg+" WIDTH="+this.width+" HEIGHT="+this.height+" BORDER=0>";		}	}		if (write)	{		document.write(sCR);	}	else	{		return sCR;	}}//allow the javascript to set event listeners in jscript that will fire when named events happen in the playerfunction setEventListener(evtName, cbFunction){	if (evtName == "onStatus")	{		this.statusCall = cbFunction;	}	else	{		this.broadcast("setJSListener", evtName + "|" + cbFunction);	}}function removeEventListener(evtName){	this.broadcast("removeJSListener", evtName);}function uiPlay(spath, ppath, title, clickUrl, len, adcat, emailurl, id, spathLow, ppathLow, startPoint, endPoint, hitCat, offset, image){		this.broadcast("uiPlay", spath + "|" + ppath + "|" + title + "|" + clickUrl + "|" + len + "|" + adcat + "|" + emailurl + "|" + id + "|" + spathLow + "|" + ppathLow + "|" + startPoint + "|" + endPoint + "|" + hitCat + "|" + offset + "|" + image);}function uiPlayCategory(cat1, cat2, cat3, cat4){	this.broadcast("uiPlayCategory", cat1 + "|" + cat2 + "|" + cat3 + "|" + cat4);}function uiStop(){	this.broadcast("uiStop");}function uiSeek(percent){	this.broadcast("uiSeek", percent);}function uiReplay(){	this.broadcast("uiReplay");}function uiPause(){	this.broadcast("uiPause");}function uiNext(){	this.broadcast("uiNext");}function uiPrev(){	this.broadcast("uiPrev");}function uiNextTimer(){	this.broadcast("uiNextTimer");}function uiPrevTimer(){	this.broadcast("uiPrevTimer");}function uiNewPlaylist(url, start, isText){	this.broadcast("uiNewPlaylist", url + "|" + start + "|" + isText);}function uiMute(){	//alert("uiMute");	this.broadcast("uiMute");}function uiSetVolume(vol){	this.broadcast("uiSetVolume", vol);}function uiSetBwLevel(level){	this.broadcast("uiSetBwLevel", level);}function uiSetBuffer(streamHigh, progHigh, streamLow, progLow){	this.broadcast("uiSetBuffer", streamHigh + "|" + progHigh + "|" + streamLow + "|" + progLow);}function uiEnableFullScale(isFullScale){	this.broadcast("uiEnableFullScale", isFullScale);}function execFlashMethod(method, params){	//create the broadcaster div	if(!document.getElementById("flash_broadcast"))	{		var divholder = document.createElement("div");		divholder.id = "flash_broadcast";		document.body.appendChild(divholder);	}		var methObj = new Object();	methObj.session = this.session;	methObj.fspRoot = this.fspRoot;	methObj.method = method;	methObj.params = params;	if (waiting)//set up a simple queue	{		playQueue[playQueue.length] = methObj;	}	else	{		waiting = true;		sendMethod(methObj);	}}//must be initiated by the jsfunction createSynchIFrame(ifname, ifid){	 	clearSynchedAd = this.clearSynchedAd;	synchIF = ifname;	synchID = ifid;	if (frames[synchIF])	{		//inform the flash that the frame has been set		this.broadcast("uiSetSynchFrame", ifname);	}	}function uiPageFinished(){	if (this.useFS != "true") return;//don't call if we aren't going to use fscommands	if (this.pageDelay > 0)	{		setTimeout("doPageFinished('" + this.session + "', '" + this.fspRoot + "')", this.pageDelay);	}	else	{		doPageFinished(this.session, this.fspRoot);	}}function doPageFinished(session, fspRoot){	//create the broadcaster div	if(!document.getElementById("flash_broadcast"))	{		var divholder = document.createElement("div");		divholder.id = "flash_broadcast";		document.body.appendChild(divholder);	}	//create a methodObject	var methObj = new Object();	methObj.session = session;	methObj.fspRoot = fspRoot;	methObj.method = "finishedPage";	methObj.params = "";	sendMethod(methObj);}////////// GLOBAL FUNCTIONS ///////////////called by flash client to confirm js has been received, look for nextfunction ready(){	if (playQueue.length > 0)	{				waiting = true;		var fplay = playQueue[0];		for(var i = 0; i < playQueue.length; i++)		{			playQueue[i] = playQueue[i + 1];		}		playQueue.length--;		sendMethod(fplay);	}	else	{		waiting = false;	}	}//called from the Flash player whenever a set event has been triggeredfunction handleEvt(e){	var eargs = e.split("|");	var str = "";	for (var n in eargs)	{		str += eargs[n] + "|";	}	var func = eargs[0];//the callback function is always first	var eobj;	if (eargs.length > 1 && eargs[1].indexOf("**") >= 0)	{		eobj = new Object();		for (var i = 1; i < eargs.length; i++)		{			var prop = eargs[i].split("**");			eobj[prop[0]] = prop[1];//fill the properties		}	}	else	{		eobj = eargs[1];//either we have nothing or a single value	}	eval(func)(eobj);//fire the event}function sendMethod(methObj){	document.getElementById("flash_broadcast").innerHTML = "";//clear out the old .swf		var flashquery = "session=" + methObj.session + "&method=" + methObj.method + "&params=" + methObj.params;		var divinfo = "<embed src='" + methObj.fspRoot + "/FSPBroadcaster.swf' FlashVars='"+flashquery+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";			document.getElementById("flash_broadcast").innerHTML = divinfo;//load the new .swf}function synchIFDisplay(isVis, sifUrl, iWidth, iHeight){	var sifn = frames[synchIF];	var sifid = document.getElementById(synchID);	if (sifn)	{			if (isVis)		{						if(!iWidth){iWidth=0} 			if(!iHeight){iHeight=0} 			sifid.style.width = iWidth + "px";			sifid.style.height = iHeight + "px";			sifn.location.replace(sifUrl);		}		else if (clearSynchedAd)		{			sifid.style.width = "0px";			sifid.style.height = "0px";		}	}	}function synchIFVisible(isVis){	var sifid = document.getElementById(synchID);	if (sifid)	{			if (isVis)		{			sifid.style.display = "inline";		}		else		{			sifid.style.display = "none";		}	}}function sendLogIF(logUrl){	if (frames['ads'])	{				frames['ads'].location.replace(logUrl);	}}function sendHitIF(hitUrl){	if (frames['hit'])	{		hitUrl = hitUrl.replace(/liiiid/, "lid");		frames['hit'].location.replace(hitUrl);			}}function stitch(index, frag){	if (stitchArray[index] == undefined)	{		stitchArray[index] = frag;	}	else	{		stitchArray[index] += frag;	}	if (stitchArray[index].lastIndexOf(")") == stitchArray[index].length - 1)	{			stitchArray[index] = stitchArray[index].replace( /~/gi, "\'");		eval(stitchArray[index]);		delete stitchArray[index];	}}function setStatus(session, bandwidth, hasConn, hasControls, hasPlaylistViewer, hasMovieViewer, version){	var obj;	for (var i = 0; i < fspobjs.length; i++)	{		if (fspobjs[i].session == session)		{			obj = fspobjs[i];			obj.bw = bandwidth;			obj.hasConnection = hasConn;			obj.hasControls = hasControls;			obj.hasPlaylistViewer = hasPlaylistViewer;			obj.hasMovieViewer = hasMovieViewer;			obj.version = version;			if (obj.statusCall != null) eval(obj.statusCall)(obj.version);			break;		}	}}