
var NewSiteApplication=function(){
	return function(){this.initialize.apply(this,arguments)};
	}();
NewSiteApplication.prototype={
	initialize:function(){
		this.comps=[];
		this.obs={};
		this.addedElements={};
		this.componentJSON=null;
		this.configJSON=null;
		this.queryString=null;
		this.onLoadCallbacks=[];
		this._readyEventFired=false;
		this._componentLoadComplete=false;
		this._videoPlayerComponentReady=false;
		this._playerContainerName=null;
		this._responseJSON=null;
		this._partnerGuid=null;
		this._defaultClipId=null;
		this._prefix="NS_";
		this._flashEmbedPrefix="NS_FLASH_";
		this._PIDLength=32;
		this._scriptTagId="NS_GUID_JS";
		this._guidURLParam="guid";
		this._jsonServiceTimeoutID=null;
		this._jsonServiceTimeoutLength=10000;
		this._jsonStartLoadTime=new Date();
		this._initializeStartTime=new Date();
		this._guidJSurl="http://config.hulu.com/js/";
		this._urlJSON="http://player.hulu.com/player/vs?callback=NewSite.loadComponents";
		this.DEBUG=false;
		this.LOGGER=null;
		this.VERSION="$Id: hulu_global.js 4.22 $";
		this.unloadSet=false;
		if(!this.unloadSet){
			try{
				if(window.addEventListener){
					window.addEventListener("beforeunload",this._prepUnload,false);
					}
				else if(window.attachEvent){
					window.attachEvent("onbeforeunload",this._prepUnload);
					}
				}
			catch(e){}
			this.unloadSet=true;
			}
		}
	,
	_prepUnload:function(){
		try{
			var player=null;
			var state={
				state:"before_wrapper",
				subState:"before_wrapper",
				contentTime:-1,
				stateTime:-1,
				contentRatio:-1
				};
			player=document.getElementById(this.NewSite._playerContainerName||"NS_FLASH_videoPlayerComponent");
			if(player&&player.getCurrentState){
				try{
					state=player.getCurrentState();
					}
				catch(e){}
			}
			var distro="unknown";
			var player="unknown";
			if(NewSite.componentJSON){
			try{
				distro=NewSite.componentJSON.videoPlayerComponent.optionalAttributes.distributionPartner.toLowerCase();
				player=NewSite.componentJSON.videoPlayerComponent.optionalAttributes.version.replace("Hulu Player ","").replace(" ","");
				}
			catch(e){}
			}
		var userLeaveBeaconUrl='http://t2.hulu.com/v3/playertracking/userleave?'
			+'beaconevent=userleave&region=US&language=en&distro='+distro+'&distroplatform=DP&state='
			+state.state+'&substate='+state.subState
			+'&contenttime='+state.contentTime+'&statetime='+state.stateTime
			+'&contentratio='+state.contentRatio
			+'&player='+player+'&wait='+(new Date()-NewSite._initializeStartTime);
		if(NewSite.Browser().IE){
			(new Image()).src=userLeaveBeaconUrl;
			}
		else{
			$.ajax(userLeaveBeaconUrl,{async:false});
			}
		}
	catch(e){}
	if(NewSite.Browser().IE){
	__flash_unloadHandler=function(){};
	__flash_savedUnloadHandler=function(){};
	var nullSWFFuncs=function(){
		var objArr=document.getElementsByTagName("OBJECT");
		for(var i=objArr.length-1;i>=0;i--){
			objArr[i].style.display='none';
			for(var j in objArr[i]){
				if(typeof objArr[i][j]=='function'){
					objArr[i][j]=function(){};
					}
				}
			}
		}
	window.attachEvent("onunload",nullSWFFuncs);
	}
}
,
Browser:function(){
	var ua=navigator.userAgent;
	var isOpera=Object.prototype.toString.call(window.opera)=='[object Opera]';
	return{
		IE:!!window.attachEvent&&!isOpera,
			Opera:isOpera,
			WebKit:ua.indexOf('AppleWebKit/')>-1,Gecko:ua.indexOf('Gecko')>-1&&ua.indexOf('KHTML')===-1,
			MobileSafari:/Apple.*Mobile.*Safari/.test(ua)
		}
	}
,
getComponentServiceUrl:function(){
	var url=this._urlJSON;
	var sep=this.getUrlSeparator(url);
	try{
		if(url.toLowerCase().indexOf(this._guidURLParam)==-1){
			url+=sep+this._guidURLParam+"="+this.getPartnerGuid();
			}
		}
	catch(e){
		this.reportError(e);
		}
	return url;
	}
,
run:function(){
	var thisObj=this;
		if(!window.opera&&document.all)
			window.attachEvent('onunload',this.cleanupSwfs);
		this._jsonServiceTimeoutID=window.setTimeout(function(){
			thisObj.fireJSONError(thisObj);
			}
		,
		thisObj._jsonServiceTimeoutLength)
		if(this.partnerDict[this.getPartnerGuid().toUpperCase()]){
			this.loadComponents(this.partnerDict[this.getPartnerGuid().toUpperCase()]);
			}
		else{this.loadExternalJS(this.getComponentServiceUrl());
			}
		}
	,
	cleanupSwfs:function(){
		var objects=document.getElementsByTagName("OBJECT");
		for(var i=objects.length-1;i>=0;i--){
			objects[i].style.display='none';
			for(var x in objects[i]){if(typeof objects[i][x]=='function'){
				objects[i][x]=function(){
					};
				}
			}
		objects[i].parentNode.removeChild(objects[i]);
			}
		}
		,
	ping:function(){
		return true;
		}
	,
	fireJSONError:function(t){
		var errorObj={
			code:"NS_JS_001",type:"JSON",
			displayMessage:"Page components failed to load.",
			description:"Page component JSON service timed out."
			}
		t.updateObservers("newsiteError",errorObj);
		}
		,
	loadExternalJS:function(url){
		try{
			if(!url){
				throw('url parameter is required');
				}
			this._jsonStartLoadTime=new Date();
			var randomId=Math.random()+'';
			randomId.replace(/\./g,'');
			var urlSeperator=this.getUrlSeparator(url);
			var scriptObj=document.createElement("script");
			scriptObj.setAttribute("type","text/javascript");
			scriptObj.setAttribute("src",url);
			scriptObj.setAttribute("id",randomId);
			var head=document.getElementsByTagName("head");
			if(!head){
				throw("No head tag found.");
				}
			var headTag=head.item(0);
			headTag.appendChild(scriptObj);
			return randomId;
			}
		catch(e){
			this.reportError(e,"NewSite.loadExternalJS");
			}
		}
		,
	registerReady:function(componentName){
		this.traceMsg("registerReady: "+componentName);
		if(this.addedElements[componentName]){
			this.addedElements[componentName].isReady=true;
			}
		if(componentName=='videoPlayerComponent'){
			this.traceMsg("incoming: "+componentName);
			this._videoPlayerComponentReady=true;
			for(var i in this.addedElements){
				var comp=this.addedElements[i];
				if(comp&&comp.isReady&&!comp.isTracked){
					this.videoPlayerComponent.trackComponent([comp.trackingInfo]);
					comp.isTracked=true;
					}
				}
			}
		this.fireReady(componentName);
		}
		,
	getComponents:function(){
		return this.componentJSON;
		}
		,
	isComponentReady:function(componentName){
		var comp=this.addedElements[componentName];
		if(!comp||comp.isReady===true){
			this.traceMsg("isComponentReady: "+componentName+" true");
			return true;
			}
		this.traceMsg("isComponentReady: "+componentName+" false");
		return false;
		}
		,
	loadComponents:function(responseJSON){
		this.updateObservers("configDataLoaded",{});
		clearTimeout(this._jsonServiceTimeoutID);
		var thisObj=this;
		try{
			if(responseJSON.error){
				window.setTimeout(function(){
					thisObj.fireJSONError(thisObj);
					thisObj.reportError("Service error: "+responseJSON.error.errorMessage);
					}
					,
				500)
				}
			if(responseJSON.components.videoPlayerComponent.url.indexOf("widget_player.swf")!=-1){
				responseJSON.components.videoPlayerComponent.url+="noCache"+Math.round(Math.random()*10000);
				}
			else if(responseJSON.components.videoPlayerComponent.url.indexOf("fancast16x9_player.swf")!=-1||responseJSON.components.videoPlayerComponent.url.indexOf("fancast4x3_player.swf")!=-1){
				responseJSON.components.videoPlayerComponent.url+="&inSwf=true";
				}
			try{var jsParams=this._parseQueryString(this.EL(this._scriptTagId).src.split('?')[1]);
			if(jsParams.env!=undefined&&(jsParams.env=="qa"||jsParams.env=="dev")){
				responseJSON.components.videoPlayerComponent.url+="&env="+jsParams.env
				}
			if(jsParams.partner!=undefined){
				responseJSON.components.videoPlayerComponent.optionalAttributes.distributionPartner=jsParams.partner;
				responseJSON.components.videoPlayerComponent.url+="&partner="+jsParams.partner;
				}
			if(jsParams.showMetaDataBar!=undefined){
				responseJSON.components.videoPlayerComponent.optionalAttributes.distributionPartner=jsParams.partner;
				responseJSON.components.videoPlayerComponent.url+="&showMetaDataBar=true";
				}
			if(jsParams.siteSessionId!=undefined){
				responseJSON.components.videoPlayerComponent.optionalAttributes.siteSessionId=jsParams.siteSessionId;
				}
			if(jsParams.userSocialIdentityIds!=undefined){
				responseJSON.components.videoPlayerComponent.url+="&userSocialIdentityIds="+jsParams.userSocialIdentityIds;
				}
			if(jsParams.customThumb!=undefined){
				responseJSON.components.videoPlayerComponent.url+="&customThumb="+jsParams.customThumb;
				}
			if(jsParams.dpVersion!=undefined){
				responseJSON.components.videoPlayerComponent.url+="&dpVersion="+jsParams.dpVersion;
				}
			if(jsParams.hq!=undefined){
				responseJSON.components.videoPlayerComponent.url+="&hq="+jsParams.hq;
				}
			if(jsParams.cmc!=undefined){
				responseJSON.components.videoPlayerComponent.url+="&cmc="+jsParams.cmc;
				}
			if(jsParams.width!=undefined){
				responseJSON.components.videoPlayerComponent.width=jsParams.width;
				}
			if(jsParams.height!=undefined){
				responseJSON.components.videoPlayerComponent.height=jsParams.height;
				}
			if(jsParams.wmode!=undefined&&(jsParams.wmode=="transparent"||jsParams.wmode=="opaque"||jsParams.wmode=="window")){
				responseJSON.components.videoPlayerComponent.wmode=jsParams.wmode;
				}
			if(jsParams.autoplay!=undefined&&(jsParams.autoplay=="true"||jsParams.autoplay=="false")){
				responseJSON.components.videoPlayerComponent.optionalAttributes.autoplay=jsParams.autoplay;
				}
			if(jsParams.allowRecommendation!=undefined&&(jsParams.allowRecommendation=="true"||jsParams.allowRecommendation=="false")){
				responseJSON.components.videoPlayerComponent.optionalAttributes.allowRecommendation=jsParams.allowRecommendation;
				}
			if(jsParams.allowPlaylist!=undefined&&(jsParams.allowPlaylist=="true"||jsParams.allowPlaylist=="false")){
				responseJSON.components.videoPlayerComponent.optionalAttributes.allowPlaylist=jsParams.allowPlaylist
				}
			}
		catch(e){
			this.reportError(e,"JS query params");
			}
		try{
			responseJSON.components.videoPlayerComponent.optionalAttributes.referrer=escape(top.location);
			}
		catch(e){
			responseJSON.components.videoPlayerComponent.optionalAttributes.referrer=escape(document.referrer);
			}
		responseJSON.components.videoPlayerComponent.optionalAttributes.jsonLoadTime=new Date().getTime()-this._jsonStartLoadTime.getTime();
		this._responseJSON=responseJSON;
		var components=this.componentJSON=this._responseJSON.components;
		var config=this.configJSON=this._responseJSON.config;
		for(var componentName in components){
			var componentDetails=components[componentName];
			var component=this.initializeComponent(componentName,componentDetails);
			if(this.EL(componentName)){
				component=this.addComponentToDom(component);
				}
			this.extendComponent(component);this.comps.push(componentName);
			}
		this.traceMsg("ComponentLoadComplete");
		this._componentLoadComplete=true;
		this.fireReady();
		}
	catch(e){
		this.reportError(e,"loadComponents");
		}
	}
	,
initializeComponent:function(componentName,options){
	return this[componentName]={
		instance:null,compName:componentName,parent:this,options:options
		};
	}
	,
addComponentToDom:function(component){
	var componentName=component.compName;
	this.traceMsg("addComponentToDom: "+componentName);
	var options=component.options;
	if(this.EL(componentName)){
		var instanceId=this._flashEmbedPrefix+componentName;
		if(!this.EL(instanceId)){
			this.addedElements[componentName]={};
			this.addedElements[componentName].isReady=false;
			this.addedElements[componentName].isTracked=false;
			this.EL(componentName).innerHTML=this.getFlashTag(instanceId,options);
			this.addedElements[componentName].trackingInfo=this.getTrackingInfo(componentName,options);
			component.instance=this.registerFlashObject(instanceId);
			}
		}
	return component;
	}
	,
extendComponent:function(component){
	var componentName=component.compName;
	this.extend(component,this["commonComponentMethods"]);
	if(this[componentName+"Methods"]){
		this.extend(component,this[componentName+"Methods"]);
		}
	}
	,
registerFlashObject:function(id){
	var component=null;
	if(navigator.appName.indexOf("Microsoft")!=-1){
		component=window[id];
		}
	else{
		component=document[id];
		}
	return component?component:false;
	}
	,
addListener:function(eventType,callbackObj,callbackFunc){
	this.traceMsg("addListener: "+eventType+"\n<br>callbackObj "+callbackObj+"\n<br>callbackFunc "+callbackFunc);
	callbackObj=this._stringToObject(callbackObj);
	if(!callbackFunc){
		callbackFunc=eventType;
		}
	if(!this.obs[eventType]){
		this.obs[eventType]=[];
		}
	var obsType=this.obs[eventType]
	var len=obsType.length;
	for(var i=0;i<len;i++){
		try{
			if(obsType[i].obj&&obsType[i].obj==callbackObj&&obsType[i].func==callbackFunc)
				throw"Addition of duplicate listener ignored.";
			}
		catch(e){
			this.reportError(e);
			};
		}
	var cb;
	if(callbackObj&&callbackObj.id){
		cb=callbackObj.id;
		}
	else{
		cb=callbackObj;
		}
	this.traceMsg("addListener: "+eventType+"\n<br>callbackObj "+cb+"\n<br>callbackFunc "+callbackFunc);
	this.obs[eventType].push({obj:callbackObj,func:callbackFunc});
	return eventType;
	}
	,
addFlashListener:function(eventType,callbackObj,callbackFunc){
	callbackObj=this.registerFlashObject(callbackObj);
	this.addListener(eventType,callbackObj,callbackFunc);
	}
	,
removeListener:function(eventType,callbackObj,callbackFunc){
	callbackObj=this._stringToObject(callbackObj);
	if(!callbackFunc){
		callbackFunc=eventType;
		}
	this.traceMsg("removeListener:\ncallbackObj "+callbackObj+"\ncallbackFunc "+callbackFunc);
	if(!this.obs[eventType]){
		return false;
		}
	var obsType=this.obs[eventType]
	var len=obsType.length;
	for(var i=0;i<len;i++){
		try{
			if(obsType[i].obj&&obsType[i].obj==callbackObj&&obsType[i].func==callbackFunc){
				return obsType.splice(i,1);
				}
			}
		catch(e){
			this.reportError(e);
			};
		}
	return false;
	}
	,
updateObservers:function(eventType,data){
	this.traceMsg('updateObservers : eventType '+eventType+" "+data);
	var obsType=this.obs[eventType]
	if(!obsType){
		return;
		}
	var len=obsType.length;
	for(var i=0;i<len;i++){
		try{
			var obj=this._stringToObject(obsType[i].obj);
			var func=obsType[i].func;
			if(obj&&func){
				if(typeof obj!='object'){
					throw"Object missing: "+obj;
					}
				if(func==undefined||func==null){
					func=eventType;
					}
				if(typeof obj[func]=="function"){
					obj[func](data);
					}
				else{
					obj.toComponent(func,data);
					}
				}
			}
		catch(e){
			this.reportError(e,"updateObservers("+eventType+")");
			};
		}
	}
	,
_stringToObject:function(str){
	var obj;
	if(typeof str=="string"){
		var arr=str.split('.');
		var count=0;
		while(arr.length>0){
			var c=arr.shift();
			if(!count++){
				obj=window[c];
				}
			else{
				obj=obj[c];
				}
			}
		if(obj){
			return obj;
			}
		}
	return str;
	}
	,
setPlayerContainer:function(id){
	this.traceMsg('setPlayerContainer : '+id);
	if(this.EL(id)){
		this._playerContainerName=id;
		return id;
		}
	return null;
	}
	,
getPlayerContainerName:function(){
	return this._playerContainerName;
	}
	,
setDefaultClipId:function(id){
	this._defaultClipId=id;
	}
	,
getDefaultClipId:function(){
	return this._defaultClipId;
	}
	,
_parseVideoId:function(id){
	try{
		id=id+'';
		id=id.replace(/.*pid=([^&]+).*/i,"$1");
		if(id.length!=this._PIDLength){
			throw"Invalid Video PID: "+id;
			}
		}
	catch(e){
		this.reportError(e,"")
		};
	return id;
	}
	,
getNPMLObject:function(){
	return this._responseJSON;
	}
	,
EL:function(el){
	if(typeof el=='string'){
		el=document.getElementById(el);
		}
	return el;
	}
	,
extend:function(destinationObj,sourceObj){
	for(var property in sourceObj){
		destinationObj[property]=sourceObj[property];
		}
	return destinationObj;
	}
	,
readyEventFired:function(){
	return this._readyEventFired;
	}
	,
fireReady:function(componentName){
	this.traceMsg("fireReady: "+componentName);
	if(!this.readyEventFired()){
		if(this._componentLoadComplete&&this.allComponentsReady()){
			this.traceMsg("componentLoadComplete: "+componentName);
			this.updateObservers("newsiteReady",{});
			this._readyEventFired=true;
			this.onComponentsLoaded();
			}
		}
	}
	,
allComponentsReady:function(){
	this.traceMsg("allComponentsReady?");
	for(var i in this.addedElements){
		if((i=="adComponent"||i=="videoPlayerComponent")&&this.isComponentReady(i)!=true){
			this.traceMsg(i+" is Not ready");
			return false;
			}
		}
	this.traceMsg("allComponentsReady!! "+this._videoPlayerComponentReady);
	return this._videoPlayerComponentReady;
	}
	,
onComponentsLoaded:function(){
	while(this.onLoadCallbacks.length>0){
		var callback=this.onLoadCallbacks.pop();
		try{
			if(callback)callback();
			}
		catch(e){
			this.reportError(e);
			}
		}
	}
	,
onLoad:function(func){
	this.onLoadCallbacks.push(func);
	}
	,
getQueryString:function(){
	if(!this.queryString){
		this.queryString=this._parseQueryString();
		}
	return this.queryString;
	}
	,
_parseQueryString:function(querystring){
	var qsObj={};
	var qs=querystring?querystring:window.location.search;
	if(qs.charAt(0)=='?'){
		qs=qs.slice(1,qs.length);
		}
	if(qs.length<1){
		return qsObj;
		}
	qs=qs.replace(/\&amp\;/gi,'&');
	qs=qs.split('&');
	for(var i=0;i<qs.length;i++){
		var pairs=qs[i].split("=");
		qsObj[pairs[0]]=pairs[1];
		}
	return qsObj;
	}
	,
getPartnerGuid:function(){
	if(!this._partnerGuid){
		try{
			var guidscript=this.EL(this._scriptTagId).src;
			var guidqsObj=this._parseQueryString(guidscript.split('?')[1]);
			this._partnerGuid=guidqsObj.guid;
			}
		catch(e){
			this.reportError(e);
			}
		}
	return this._partnerGuid;
	}
	,
getUrlSeparator:function(url){
	return url.indexOf('?')==-1?'?':'&';
	}
	,
getEnvironment:function(){
	var qs=this.getQueryString();
	var ref=document.referrer;
	var url=document.URL;
	var ua=navigator.userAgent;
	var env={location:ref,queryString:qs,referrer:ref,url:url,userAgent:ua}
	var sc=["availHeight","availWidth","colorDepth","height","width"];
	for(var i=0;i<sc.length;i++){
		var e=sc[i];
		env[e]=screen[e];
		}
	return env;
	}
	,
getTrackingInfo:function(componentName,options){
	try{
		var obj={};
		obj.componentName=componentName;
		obj.url=document.URL;
		obj.pixelArea=options.width*options.height;
		obj.version=1;
		}
	catch(e){
		this.reportError(e);
		}
	return obj;
	}
	,
loadGuidJS:function(){
	this.loadExternalJS(this._guidJSurl+this._parseQueryString(this.EL(this._scriptTagId).src.split('?')[1]).guid+".js");
	}
	,
getFlashTag:function(id,options){
	var fb=this.getFlashBuilder();
	fb.setId(id);
	fb.setAttributes(options);
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1);
	var tag=isIE?fb.getObjectTag():fb.getEmbedTag();
	fb.cleanup();
	delete fb;
	return tag;
	}
	,
getFlashBuilder:function(){
	var fb={
		errorHandler:null,id:'',
		attributes:[],
		allowedAttributes:{
			width:{
				req:true,
				def:null},
			height:{
				req:true,
				def:null},
			url:{
				req:true,
				def:null},
			wmode:{
				req:false,
				def:'transparent'},
			bgcolor:{
				req:false,
				def:'#FFFFFF'},
			allowScriptAccess:{
				req:false,
				def:'always'},
			allowFullScreen:{
				req:false,
				def:'true'},
			menu:{
				req:false,
				def:'true'}
			},
		setId:function(id){
			this.id=id},
		getId:function(){
			return this.id},
		setErrorHandler:function(func){
			this.errorHandler=func;},
		setAttributes:function(a){
			for(var k in a){
				this.setAttribute(k,a[k]);}
			},
		setAttribute:function(name,value){
			this.attributes[name]=value;},
		getAttribute:function(name){
			return this.attributes[name]||this.getDefaultValue(name)||false;
			},
		getAllowedAttributes:function(){
			return this.allowedAttributes
			},
		isRequired:function(name){
			var att=this.allowedAttributes[name];
			return att&&att.req?true:false;},
		getDefaultValue:function(name){
			var att=this.allowedAttributes[name];
			return att&&att.def||null;},
		getEmbedTag:function(){
			try{
				var id=this.getId();
				var tag='<embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
				tag+='name="'+id+'" id="'+id+'" ';
				var aa=this.getAllowedAttributes();
				for(var att in aa){
					var attVal=this.getAttribute(att);
					if(this.isRequired(att)&&!this.getAttribute(att)){
						throw"Missing required attribute for "+id+": "+att;}
					if(att.toLowerCase()=='url'){
						att='src';}
					tag+=att+'="'+attVal+'" ';}
				tag+='></embed>';}
			catch(e){
				this.handleError(e);
				return'';}
			return tag;},
		getObjectTag:function(){
			try{
				var aa=this.getAllowedAttributes();
				var tag='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
				tag+='name="'+this.getId()+'" id="'+this.getId()+'" ';
				tag+='width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'"><param name="quality" value="high" />';
				for(var att in aa){
					var attVal=this.getAttribute(att);
					if(this.isRequired(att)&&!this.getAttribute(att)){
						throw"Missing required attribute: "+att;}
					if(att.toLowerCase()!='width'&&att.toLowerCase()!='height'){
						if(att.toLowerCase()=='url')att='movie';tag+='<param name="'+att+'" value="'+attVal+'" />';}
					}
				tag+='</object>';}
			catch(e){
				this.handleError(e);return'';}
			return tag;},
		handleError:function(e){
			if(this.errorHandler!=null){
				this.errorHandler(e);}
			},
		cleanup:function(){
			this.errorHandler=null;
			for(var x in this){
				this[x]=null;}
			}
		};
	fb.setErrorHandler(this.reportError);
	return fb;},
hideAllComponents:function(){
	try{
		var len=this.comps.length;
		for(var i=0;i<len;i++){
			this[this.comps[i]].hide();}
		}
	catch(e){}
	},
showAllComponents:function(){
	try{
		var len=this.comps.length;
		for(var i=0;i<len;i++){
			this[this.comps[i]].show();}
		}
	catch(e){}
	},
pingImgUrl:function(url){
	try{
		var randomId=Math.random()+'';
		randomId.replace(/\./g,'');
		var img=document.createElement('IMG');
		img.width=1;
		img.height=1;
		img.src=url;
		img.id=randomId;
		img.onload=img.onerror=function(){
			var o=this.parentNode.removeChild(this);
			delete o;}
		document.body.appendChild(img);}
	catch(e){};
	},
reportError:function(e,loc){
	try{
		var thisRef=NewSite,msg;
		if(!thisRef.DEBUG||!thisRef.LOGGER){
			return false;}
		if(navigator.appName.indexOf("Microsoft")!=-1){
			msg=e.message+"\n"+e.name+"\n"+e.number+"\n"+e.description+"\n";}
		else{
			msg=e;}
		if(loc){
			msg=loc+"\n\n"+msg;}
		var d=new Date().getMilliseconds();
		var p=document.createElement('P');
		p.style.backgroundColor="red";
		p.style.color="white";
		p.innerHTML=d+": Error caught: \n\n"+msg;
		thisRef.LOGGER.insertBefore(p,thisRef.LOGGER.firstChild);}
	catch(e){}
	},
traceMsg:function(msg,loc){
	try{
		if(!this.DEBUG||!this.LOGGER){
			return false;}
		if(loc){
			msg=loc+"\n\n"+msg;}
		var d=new Date().getMilliseconds();
		var p=document.createElement('P');
		p.innerHTML=d+": Trace: \n\n"+msg;this.LOGGER.insertBefore(p,this.LOGGER.firstChild)}
	catch(e){}
	},
getTimer:function(){}
}


NewSiteApplication.prototype.commonComponentMethods={
	getFlashMethod:function(method){
		if(!this.parent){return method;}
		return this.parent._prefix+this.compName+"_"+method;},
	getInfo:function(){return this.info;},
	getInstance:function(){return this.instance;},
	hide:function(){
		var instance=this.getInstance();
		try{instance.width=1;instance.height=1;}
		catch(e){}
		this.toComponent("hide");},
	setInfo:function(info){this.info=info;},
	show:function(){
		var instance=this.getInstance();
		try{
			instance.width=this.options.width;
			instance.height=this.options.height;}
		catch(e){}
		this.toComponent("show");},
	toComponent:function(func,param){
		try{
			var parent=this.parent
			var instance=this.getInstance();
			var flashFunc=this.getFlashMethod(func);
			if(typeof instance[flashFunc]=="function"){
				instance[flashFunc](param);
				parent.traceMsg("toComponent("+flashFunc+")");}
			else if(typeof instance[func]=="function"){
				instance[func](param);parent.traceMsg("toComponent("+func+")");}
			else if(typeof instance.toFlash=="function"){
				instance.toFlash(func,param);
				parent.traceMsg("toComponent.toFlash("+func+")");}
			else{throw"Function not found";}
		}
		catch(e){
			parent.reportError(e,"NewSiteApplication.toComponent<br>"+func+"<br>"+flashFunc+"<br>"+instance);}
		}
	}
NewSiteApplication.prototype.videoPlayerComponentMethods={
	properties:{},
	closeConnection:function(){this.toComponent('closeConnection');},
	closeMenu:function(){this.toComponent('closeMenu');},
	cueVideoById:function(id){this.getInstance().cueVideoById(id);},
	enableFullscreen:function(flag){this.toComponent('enableFullscreen',flag);},
	getCurrentTime:function(){return this.getInstance().getCurrentTime();},
	getEmbedCode:function(){return this.getInstance().getEmbedCode();},
	getInstance:function(){
		if(!this.instance){
			this.instance=this.parent.registerFlashObject(this.parent.getPlayerContainerName());}
		return this.instance;},
	getProperty:function(propertyName){return this.properties[propertyName];},
	getProperties:function(){return this.properties;},
	getRelatedVideos:function(){return this.getInstance().getRelatedVideos();},
	getMetadata:function(){return this.getInstance().getMetadata();},
	mute:function(){this.toComponent('muteVideo');},
	next:function(){this.toComponent('nextVideo');},
	openMenu:function(){this.toComponent('openMenu');},
	pauseVideo:function(){this.toComponent('pauseVideo');},
	playVideo:function(id,st,et){
		st=st||-1;
		et=et||-1;
		this.getInstance().playVideo(id,st,et);
		},
	previous:function(){this.toComponent('previousVideo');},
	resumeVideo:function(){this.toComponent('resumeVideo');},
	submitToUrl:function(url){this.toComponent('submitToUrl',url);},
	seek:function(position){this.toComponent('seekVideo',position);},
	setConfiguration:function(options){
		this.getInstance().setConfiguration(options);},
	setProperties:function(propObj){
		for(var i in propObj){
			this.properties[i]=propObj[i];}
		},
	setSmoothing:function(ifSmoothInNormal,ifSmoothInFS){this.getInstance().setSmoothing(ifSmoothInNormal,ifSmoothInFS);},
	setSize:function(w,h){
		this.getInstance().width=w;
		this.getInstance().height=h;
		try{this.getInstance().setStageSize(w,h);}
		catch(e){}
		this.getInstance().setSize(w,h);},
	stopVideo:function(){this.toComponent('stopVideo');},
	setVolume:function(volumeNumber){this.toComponent('setPlayerVolume',volumeNumber);},
	trackComponent:function(domComponents){this.toComponent('trackComponent',domComponents);},
	trackBeacon:function(beaconParam){this.toComponent('trackBeacon',beaconParam);},
	trackBannerClickThru:function(state){this.getInstance().trackBannerClickThru(state);},
	trackBannerLoaded:function(state){this.getInstance().trackBannerLoaded(state);},
	trackBannerError:function(state){this.getInstance().trackBannerError(state);},
	enableCaptions:function(style){this.getInstance().enableCaptions(style);},
	getCurrentCaptionStyle:function(){return this.getInstance().getCurrentCaptionStyle();},
	updateCurrentCaptionStyle:function(style){this.getInstance().updateCurrentCaptionStyle(style);},
	saveCurrentCaptionStyle:function(style){this.getInstance().saveCurrentCaptionStyle(style);},
	revertCurrentCaptionStyle:function(){this.getInstance().revertCurrentCaptionStyle();},
	getAdBreaks:function(){return this.getInstance().getAdBreaks();},
	getAvailableBitrates:function(){return this.getInstance().getAvailableBitrates();},
	getBitrate:function(){return this.getInstance().getBitrate();},
	setBitrate:function(bitrates){this.getInstance().setBitrate(bitrates);}
	}
NewSiteApplication.prototype.linkComponentMethods={
	newLink:function(linkData){
		this.setInfo(linkData);
		this.toComponent('newLink',linkData);}
	}
NewSiteApplication.prototype.logoComponentMethods={}
NewSiteApplication.prototype.adComponentMethods={
	getBannerState:function(){return this.getInstance().getBannerState();},
	getInstance:function(){
		if(!this.instance){
			this.instance=this.parent.registerFlashObject(this.parent.getPlayerContainerName());}
		return this.instance;},
	overlayAdBegin:function(adData){
		this.setInfo(adData);
		this.toComponent('overlayAdBegin',adData);},
	videoAdBegin:function(adData){
		this.setInfo(adData);
		this.toComponent('videoAdBegin',adData);},
	videoAdEnd:function(){
		this.toComponent('videoAdEnd');}
	}
NewSiteApplication.prototype.metadataComponentMethods={
	videoMetadata:function(metadata){
		this.setInfo(metadata);
		this.toComponent('videoMetadata',metadata);}
	}
NewSiteApplication.prototype.relatedVideosComponentMethods={
	relatedVideos:function(relatedVideoData){
		this.setInfo(relatedVideoData);
		this.toComponent('relatedVideos',relatedVideoData);}
	}
NewSiteApplication.prototype.partnerDict={
	"1B826623-ABFA-78F3-5EAC-6150B0FD8F76":{
		"components":{
			"logoComponent":{
				"wmode":"transparent",
				"divId":"logoComponent",
				"url":"http://player.hulu.com/4.22/components/common/logoComponent_link.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"22",
				"width":"70",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"adComponent":{
				"wmode":"transparent",
				"divId":"adComponent",
				"url":"http://player.hulu.com/4.22/components/common/adComponent.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"250",
				"width":"300",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"linkComponent":{
				"wmode":"transparent",
				"divId":"linkComponent",
				"url":"http://player.hulu.com/4.22/components/common/linkComponent_light.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"20",
				"width":"300",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"videoPlayerComponent":{
				"wmode":"window","divId":"videoPlayerComponent",
				"url":"http://player.hulu.com/4.22/fancast16x9_player.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"308",
				"width":"548",
				"skin":"comcast16x9",
				"type":"swf",
				"optionalAttributes":{
					"disableLargeAdBanner":"false",
					"allowRecommendation":"true",
					"upgradeFlash":"true",
					"watermarkClickable":"true",
					"enableWatermark":"true",
					"debugLevel":"0",
					"debugMode":"0",
					"allowPlaylist":"true",
					"logoLink":"http://www.hulu.com?cmpid=fancast-bug",
					"allowFullScreen":"true",
					"version":"Hulu Player 4.22",
					"linkText":"Hulu.com",
					"minimumFlash":"os 10,1,53,64",
					"distributionPartner":"COMCAST",
					"useResolutionIndicator":"false",
					"linkTarget":"http://hulu.com?cmpid=fancast-logo",
					"bitrate":"0",
					"autoplay":"true"},
				"allowScriptAccess":"always"}
			}
		},
	"8FD85DB6-E19C-ED04-72DC-15CEE4B3DB20":{
		"components":{
			"logoComponent":{
				"wmode":"transparent",
				"divId":"logoComponent",
				"url":"http://player.hulu.com/4.22/components/common/logoComponent_link.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"22",
				"width":"70",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"adComponent":{
				"wmode":"transparent",
				"divId":"adComponent",
				"url":"http://player.hulu.com/4.22/components/common/adComponent.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"250",
				"width":"300",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"linkComponent":{
				"wmode":"transparent",
				"divId":"linkComponent",
				"url":"http://player.hulu.com/4.22/components/common/linkComponent_light.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"20",
				"width":"300",
				"skin":"default",
				"type":"swf",
				"allowScriptAccess":"always"},
			"videoPlayerComponent":{
				"wmode":"window",
				"divId":"videoPlayerComponent",
				"url":"http://player.hulu.com/4.22/fancast4x3_player.swf?v=4.22",
				"align":"middle",
				"bgcolor":"#FFFFFF",
				"flashVersion":"8",
				"height":"411",
				"width":"548",
				"skin":"comcast4x3",
				"type":"swf",
				"optionalAttributes":{
					"allowRecommendation":"true",
					"upgradeFlash":"true",
					"watermarkClickable":"true",
					"enableWatermark":"true",
					"distributionPartner":"COMCAST",
					"previewLoadDelay":"0.4",
					"disableLargeAdBanner":"false",
					"previewFadeInDelay":"0.4",
					"linkText":"Hulu.com",
					"debugLevel":"0",
					"useResolutionIndicator":"false",
					"debugMode":"0",
					"bitrate":"0",
					"allowPlaylist":"true",
					"minimumFlash":"os 10,1,53,64",
					"logoLink":"http://www.hulu.com?cmpid=fancast-bug",
					"allowFullScreen":"true",
					"version":"Hulu Player 4.22",
					"linkTarget":"http://hulu.com?cmpid=fancast-logo",
					"preview":"true",
					"autoplay":"true"},
				"allowScriptAccess":"always"}
			}
		}
	}
if(!NewSite){
	var NewSite=new NewSiteApplication;NewSite.run();
	}
