var CBSi=(typeof CBSi=="undefined"||!CBSi)?{}:CBSi;CBSi.app=(typeof CBSi.app=="undefined"||!CBSi.app)?{}:CBSi.app;CBSi.app.VideoPlayer=(typeof CBSi.app.VideoPlayer=="undefined"||!CBSi.app.VideoPlayer)?{}:CBSi.app.VideoPlayer;CBSi.app.VideoPlayer.UVP=(typeof CBSi.app.VideoPlayer.UVP=="undefined"||!CBSi.app.VideoPlayer.UVP)?{}:CBSi.app.VideoPlayer.UVP;CBSi.app.VideoPlayer.UVP=function(a){this.global=a;this.jsReady=false;this.objName=this.global.params.objName};CBSi.app.VideoPlayer.UVP.prototype.init=function(){this.load();this.draw()};CBSi.app.VideoPlayer.UVP.prototype.load=function(){this.logger=new CBSILogger(this.global.params.logTo,this.global.params.logging,this.global.params.objName);this.logger.log("CBSILogger","Logger started.");this.cookieJar=new CBSICookieJar();this.logger.log("CBSICookieJar","Cookie jar created.");this.jsReady=true;this.logger.log("init","jsReady = "+this.jsReady);var a=(this.global.params.defaults&&this.global.params.defaults.STIME)?this.global.params.defaults.STIME:(new Date().getTime())/1000;if(this.global.params.enableClock){this.initTime(a)}};CBSi.app.VideoPlayer.UVP.prototype.draw=function(){this.logger.log("draw");var b=this.global.swfobject;try{b.obj.embedSWF(b.url,b.container,b.width,b.height,b.minVersion,b.installSWF,b.flashVars,b.flashParams,b.flashAttribs,b.callback)}catch(a){this.logger.log("CBSi.app.VideoPlayer.UVP","Error creating flash embed: "+a)}};CBSi.app.VideoPlayer.UVP.prototype.erase=function(){this.logger.log("erase");var b=this.global.swfobject;try{b.obj.removeSWF(b.flashAttribs.id)}catch(a){this.logger.log("CBSi.app.VideoPlayer.UVP","Error removing flash embed: "+a)}};CBSi.app.VideoPlayer.UVP.prototype.isJSReady=function(){this.logger.log("isJSReady",this.jsReady);return this.jsReady};CBSi.app.VideoPlayer.UVP.prototype.getUVPVersion=function(){var a=(this.global.params.uvpVersion)?this.global.params.uvpVersion:false;this.logger.log("getUVPVersion",a);return a};CBSi.app.VideoPlayer.UVP.prototype.getAdsVersion=function(){var a=(this.global.params.adsVersion)?this.global.params.adsVersion:false;this.logger.log("getAdsVersion",a);return a};CBSi.app.VideoPlayer.UVP.prototype.getShowAd=function(){var a=(typeof this.global.params.showAd=="boolean")?this.global.params.showAd:true;this.logger.log("getShowAd",a);return a};CBSi.app.VideoPlayer.UVP.prototype.setShowAd=function(a){this.global.params.showAd=a;this.logger.log("setShowAd",a)};CBSi.app.VideoPlayer.UVP.prototype.onCBSIPlayerReady=function(){this.logger.log("onCBSIPlayerReady");this.api=document.getElementById(this.global.swfobject.flashAttribs.id);this.cbsiAd=document.getElementById(this.global.params.adCnt);var h=[];for(var g in this.global.overlays){var c=this.global.overlays[g];var a=c[0];c[0]=g;if(!h[a]){h[a]=[]}h[a].push(c)}var b=[];for(var d in h){b=b.concat(h[d])}for(var g in b){var c=b[g];try{this.api.drawOverlay(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10]);this.logger.log("onCBSIPlayerReady","overlay "+c[0]+" added")}catch(f){this.logger.log("onCBSIPlayerReady","error adding overlay "+c[0]+": "+f)}}this.setEventCallback("onAdResourcesBuilt_cbsi",this.objName+".onAdResourcesBuilt");this.setEventCallback("onPlayerDataLoaded_cbsi",this.objName+".onPlayerDataLoaded");this.setEventCallback("onAdEnd_cbsi",this.objName+".onAdEnd");this.setEventCallback("adLoadRequest",this.objName+".adLoadRequest");this.setEventCallback("onAdResourcesInfo",this.objName+".onAdResourcesInfo");this.setEventCallback("onAdResourcesLoaded",this.objName+".onAdResourcesLoaded");this.setEventCallback("onAdStart_cbsi",this.objName+".onAdStart");this.setEventCallback("adVideoRequest",this.objName+".adVideoRequest");this.setEventCallback("bitrateSwitchRequest",this.objName+".bitrateSwitchRequest");this.setEventCallback("cbsiEventsAvailable",this.objName+".cbsiEventsAvailable");this.setEventCallback("onContentEnd_cbsi",this.objName+".onContentEnd");this.setEventCallback("contentLoadRequest",this.objName+".contentLoadRequest");this.setEventCallback("onContentStart_cbsi",this.objName+".onContentStart");this.setEventCallback("maximumBitrateAllowed",this.objName+".maximumBitrateAllowed");this.setEventCallback("minimumBitrateAllowed",this.objName+".minimumBitrateAllowed");this.setEventCallback("onOverlayEnd_cbsi",this.objName+".onOverlayEnd");this.setEventCallback("onOverlayStart_cbsi",this.objName+".onOverlayStart");this.setEventCallback("playbackDurationPercent",this.objName+".playbackDurationPercent");this.setEventCallback("playbackDurationSeconds",this.objName+".playbackDurationSeconds");this.setEventCallback("onPlayerLoaded_cbsi",this.objName+".onPlayerLoaded");this.setEventCallback("onPlayListEnd_cbsi",this.objName+".onPlayListEnd");this.setEventCallback("onPlaylistStart_cbsi",this.objName+".onPlaylistStart");this.setEventCallback("pluginsAvailable",this.objName+".pluginsAvailable");this.setEventCallback("resize",this.objName+".resize");this.setEventCallback("surveyLoadRequest",this.objName+".surveyLoadRequest");this.setEventCallback("trackSubmit",this.objName+".trackSubmit");this.setEventCallback("useDynamicSwitching",this.objName+".useDynamicSwitching");this.setEventCallback("userClear",this.objName+".userClear");this.setEventCallback("userFullscreen",this.objName+".userFullscreen");this.setEventCallback("userGesture",this.objName+".userGesture");this.setEventCallback("userMute",this.objName+".userMute");this.setEventCallback("userPause",this.objName+".userPause");this.setEventCallback("userPlay",this.objName+".userPlay");this.setEventCallback("userSeek",this.objName+".userSeek");this.setEventCallback("userStop",this.objName+".userStop");this.setEventCallback("userUnmute",this.objName+".userUnmute");this.setEventCallback("userVolumeChange",this.objName+".userVolumeChange");this.setEventCallback("onVideoCuePoint",this.objName+".onVideoCuePoint");this.setEventCallback("onVideoDone",this.objName+".onVideoDone");this.setEventCallback("onVideoError",this.objName+".onVideoError");this.setEventCallback("onVideoProgress",this.objName+".onVideoProgress");this.setEventCallback("onStateChange_cbsi",this.objName+".onStateChange");this.setEventCallback("onVideoTransitionComplete",this.objName+".onVideoTransitionComplete");this.setEventCallback("onVideoTransitionStart",this.objName+".onVideoTransitionStart")};CBSi.app.VideoPlayer.UVP.prototype.cuePointHandler=function(f){this.logger.log("cuePointHandler",f);if(this.global.params.showCompAd&&f.name=="URL"){var e=document.getElementById(this.global.params.adContainer);if(f.parameters[f.name]!="0"){var d=f.parameters[f.name].split("|");var a=this.global.params.adCall;this.logger.log("cuePointHandler: adCall ",a);for(var c in d){this.logger.log("cuePointHandler: adInfo ",d);var g=d[c].split("=");try{a=a.replace(g[0],g[1]);this.logger.log("cuePointHandler: adCall updated: ",a)}catch(b){this.logger.log("cuePointHandler Error: ",b)}e.innerHTML='<iframe id="myIframe" class="adCnt" src="'+a+'" scrollbar="no" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>'}}}};CBSi.app.VideoPlayer.UVP.prototype.onAdUrlData=function(a){this.logger.log("onAdUrlData",a)};CBSi.app.VideoPlayer.UVP.prototype.getAdInfo=function(a,c){this.logger.log("getAdInfo: ",a+" x "+c);var b=this.api.getCompanionAdInfoBySize(a,c);this.logger.log("getAdInfo: adInfo: ",b);return b};CBSi.app.VideoPlayer.UVP.prototype.playVideo=function(g,c,b,d,a){c=(typeof c=="undefined")?"cbssports":c;this.logger.log("playVideo: ",g+", "+c+", "+b);if(b=="prog"||b=="rtmp"){try{this.api.stopVideo();this.api.clearVideo();if(d){this.api.loadVideoByUrl(g,b,c,d,a)}else{this.api.loadVideoByUrl(g,b,c)}}catch(f){this.logger.log("playVideo: error playing by url: ",f)}}else{try{this.api.stopVideo();this.api.clearVideo();this.api.loadVideoById(g,c)}catch(f){this.logger.log("playVideo: error playing by id: ",f)}}};CBSi.app.VideoPlayer.UVP.prototype.hideAllOverlays=function(){for(var a in this.global.overlays){this.api.activateOverlay(a,"off")}};CBSi.app.VideoPlayer.UVP.prototype.getData=function(url,callback,doEval){this.logger.log("getData",url+","+callback);var objName=this.objName;var http=new getHTTPObject();http.onreadystatechange=function(){if(http.readyState==4&&http.status==200){data=http.responseText;if(doEval){data=eval("("+data+")")}callback(data)}};http.open("GET",encodeURI(url),true);http.send(null)};CBSi.app.VideoPlayer.UVP.prototype.setEventCallback=function(b,a){try{this.api.addEventJSCallback(b,a);this.logger.log("onCanPlayerReady","event callback '"+a+"' added for '"+b+"' event")}catch(c){this.logger.log("onCanPlayerReady","error adding callback '"+a+"' for event '"+b+"': "+c)}};CBSi.app.VideoPlayer.UVP.prototype.initTime=function(a){this.clock={dayMap:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthMap:["January","February","March","April","May","June","July","August","September","October","November","December"],monthLength:[31,(this.year-2000%4==0)?29:28,31,30,31,30,31,31,30,31,30,31],tzAbbrev:{GMT:"GMT","US/Eastern":"ET","US/Central":"CT","US/Mountain":"MT","US/Pacific":"PT"},time:a*1000};this.timerID=null;this.updateTime()};CBSi.app.VideoPlayer.UVP.prototype.updateTime=function(){clearTimeout(this.timerID);this.clock.time+=1000;this.timerID=setTimeout(this.objName+".updateTime();",1000)};CBSi.app.VideoPlayer.UVP.prototype.hhmmTohhmmampm=function(b,c){var a;if(b>=12){if(b!=12){b-=12}a=" pm"}else{if(b<12){a=" am";if(b==0){b=12}}}c=(c<10&&c>0)?"0"+c:(c==0)?"00":c;return b+":"+c+a};CBSi.app.VideoPlayer.UVP.prototype.getHTTPObject=function(){try{return new XMLHttpRequest()}catch(a){this.logger.log("getHTTPObject error",a)}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){this.logger.log("getHTTPObject error",a)}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){this.logger.log("getHTTPObject error",a)}return false};CBSi.app.VideoPlayer.UVP.prototype.onAdResourcesBuilt=function(a){this.logger.log("onAdResourcesBuilt",a)};CBSi.app.VideoPlayer.UVP.prototype.onPlayerDataLoaded=function(a){this.logger.log("onPlayerDataLoaded",a)};CBSi.app.VideoPlayer.UVP.prototype.onAdEnd=function(a){this.logger.log("onAdEnd",a)};CBSi.app.VideoPlayer.UVP.prototype.adLoadRequest=function(a){this.logger.log("adLoadRequest",a)};CBSi.app.VideoPlayer.UVP.prototype.onAdResourcesInfo=function(f){this.logger.log("onAdResourcesInfo",f);if(this.global.params.showCompAd){var d=document.getElementById(this.global.params.adContainer);var a=(this.global.params.compAdWidth>0)?this.global.params.compAdWidth:300;var b=(this.global.params.compAdHeight>0)?this.global.params.compAdHeight:250;var c=this.getAdInfo(a,b);this.logger.log("onAdResourcesInfo: adInfo",c);d.innerHTML='<a href="'+c[0][1]+'" target="_blank"><img src="'+c[0][0]+'"></a>'}};CBSi.app.VideoPlayer.UVP.prototype.onAdResourcesLoaded=function(a){this.logger.log("onAdResourcesLoaded",a)};CBSi.app.VideoPlayer.UVP.prototype.onAdStart=function(a){this.logger.log("onAdStart",a)};CBSi.app.VideoPlayer.UVP.prototype.adVideoRequest=function(a){this.logger.log("adVideoRequest",a)};CBSi.app.VideoPlayer.UVP.prototype.bitrateSwitchRequest=function(a){this.logger.log("bitrateSwitchRequest",a)};CBSi.app.VideoPlayer.UVP.prototype.cbsiEventsAvailable=function(a){this.logger.log("cbsiEventsAvailable",a)};CBSi.app.VideoPlayer.UVP.prototype.onContentEnd=function(a){this.logger.log("onContentEnd",a)};CBSi.app.VideoPlayer.UVP.prototype.contentLoadRequest=function(a){this.logger.log("contentLoadRequest",a)};CBSi.app.VideoPlayer.UVP.prototype.onContentStart=function(a){this.logger.log("onContentStart",a)};CBSi.app.VideoPlayer.UVP.prototype.maximumBitrateAllowed=function(a){this.logger.log("maximumBitrateAllowed",a)};CBSi.app.VideoPlayer.UVP.prototype.minimumBitrateAllowed=function(a){this.logger.log("minimumBitrateAllowed",a)};CBSi.app.VideoPlayer.UVP.prototype.onOverlayEnd=function(a){this.logger.log("onOverlayEnd",a)};CBSi.app.VideoPlayer.UVP.prototype.onOverlayStart=function(a){this.logger.log("onOverlayStart",a)};CBSi.app.VideoPlayer.UVP.prototype.playbackDurationPercent=function(a){this.logger.log("playbackDurationPercent",a)};CBSi.app.VideoPlayer.UVP.prototype.playbackDurationSeconds=function(a){this.logger.log("playbackDurationSeconds",a)};CBSi.app.VideoPlayer.UVP.prototype.onPlayerLoaded=function(a){this.logger.log("onPlayerLoaded",a)};CBSi.app.VideoPlayer.UVP.prototype.onPlayListEnd=function(a){this.logger.log("onPlayListEnd",a)};CBSi.app.VideoPlayer.UVP.prototype.onPlaylistStart=function(a){this.logger.log("onPlaylistStart",a)};CBSi.app.VideoPlayer.UVP.prototype.pluginsAvailable=function(a){this.logger.log("pluginsAvailable",a)};CBSi.app.VideoPlayer.UVP.prototype.resize=function(a){this.logger.log("resize",a)};CBSi.app.VideoPlayer.UVP.prototype.surveyLoadRequest=function(a){this.logger.log("surveyLoadRequest",a)};CBSi.app.VideoPlayer.UVP.prototype.trackSubmit=function(a){this.logger.log("trackSubmit",a)};CBSi.app.VideoPlayer.UVP.prototype.useDynamicSwitching=function(a){this.logger.log("useDynamicSwitching",a)};CBSi.app.VideoPlayer.UVP.prototype.userClear=function(a){this.logger.log("userClear",a)};CBSi.app.VideoPlayer.UVP.prototype.userFullscreen=function(a){this.logger.log("userFullscreen",a)};CBSi.app.VideoPlayer.UVP.prototype.userGesture=function(a){this.logger.log("userGesture",a)};CBSi.app.VideoPlayer.UVP.prototype.userMute=function(a){this.logger.log("userMute",a)};CBSi.app.VideoPlayer.UVP.prototype.userPause=function(a){this.logger.log("userPause",a)};CBSi.app.VideoPlayer.UVP.prototype.userPlay=function(a){this.logger.log("userPlay",a)};CBSi.app.VideoPlayer.UVP.prototype.userSeek=function(a){this.logger.log("userSeek",a)};CBSi.app.VideoPlayer.UVP.prototype.userStop=function(a){this.logger.log("userStop",a)};CBSi.app.VideoPlayer.UVP.prototype.userUnmute=function(a){this.logger.log("userUnmute",a)};CBSi.app.VideoPlayer.UVP.prototype.userVolumeChange=function(a){this.logger.log("userVolumeChange",a)};CBSi.app.VideoPlayer.UVP.prototype.onVideoCuePoint=function(e){this.logger.log("onVideoCuePoint: e:",e);var cp=eval("("+e+")");this.cuePointHandler(cp)};CBSi.app.VideoPlayer.UVP.prototype.onVideoDone=function(a){this.logger.log("onVideoDone",a)};CBSi.app.VideoPlayer.UVP.prototype.onVideoError=function(a){this.logger.log("onVideoError",a)};CBSi.app.VideoPlayer.UVP.prototype.onVideoProgress=function(a){this.logger.log("onVideoProgress",a)};CBSi.app.VideoPlayer.UVP.prototype.onVideoTransitionComplete=function(a){this.logger.log("onVideoTransitionComplete",a)};CBSi.app.VideoPlayer.UVP.prototype.onVideoTransitionStart=function(a){this.logger.log("onVideoTransitionStart",a)};CBSi.app.VideoPlayer.UVP.prototype.onStateChange=function(b){var a={"-1":"unstarted","0":"stopped","1":"playing","2":"paused","3":"buffering","5":"thumbnail image cued","100":"domain blacklisted","110":"video not available","120":"video geo-blocked","130":"data load error","140":"ad blocked"};this.logger.log("onStateChange",b+": "+a[b])};CBSi.app.VideoPlayer.UVP.prototype.unpack=function(e){var b=e.split("&");var d={};for(var c in b){var a=b[c].split("=");if(a.length==2&&a[0]!=""&&a[1]!=""){d[a[0].toLowerCase()]=a[1].toLowerCase()}}return d};CBSi.app.VideoPlayer.UVP.prototype.pack=function(b){var a=[];for(o in b){if(o!=""&&b[o]!=""){a.push(o+"="+b[o])}}return a.join("&")};CBSi.app.VideoPlayer.UVP.prototype.setSessParam=function(b,c){this.deleteSessParam(b);var e=this.readCookie(this.cookName);var d=(e&&e!="")?this.unpack(e):{};d[b]=c;var a=this.pack(d);this.createCookie(this.cookName,a)};CBSi.app.VideoPlayer.UVP.prototype.getSessParam=function(a){var c=this.readCookie(this.cookName);var b=(c&&c!="")?this.unpack(c):{};return b[a]};CBSi.app.VideoPlayer.UVP.prototype.deleteSessParam=function(b){var d=this.readCookie(this.cookName);var c=(d&&d!="")?this.unpack(d):{};var e=delete c[b];var a=this.pack(c);this.createCookie(this.cookName,a);return e};var CBSILogger=function(b,a,c){this.isEnabled=(a)?a:false;this.objName=c;if(this.isEnabled){if(document.getElementById(b+"Cnt")){document.getElementById(b+"Cnt").style.display="block"}this.logTo=(typeof b=="function")?b:(document.getElementById(b))?document.getElementById(b):null}};CBSILogger.prototype.log=function(a,b){if(!this.isEnabled){return}if(b){b=this.toStringEnhanced(b);b+="";b=b.replace(/</gi,"&lt;");b=b.replace(/>/gi,"&gt;");b=b.replace(/\n/gi,"<br/>");b=b.replace(/ /gi,"&nbsp;")}else{b=""}if(this.logTo){if(typeof this.logTo=="function"){this.logTo({objName:this.objName,time:this.niceTime(),type:a,message:b})}else{this.logTo.innerHTML+='<div class="logHead"><i>'+this.objName+"</i>: "+this.niceTime()+" > "+a+'</div><div class="logMessage">'+b+'</div><div class="logFoot"></div>';this.logTo.scrollTop=this.logTo.scrollHeight}}};CBSILogger.prototype.debugJS=function(jsVar){this.log("debugJS",eval(jsVar))};CBSILogger.prototype.niceTime=function(){var f=new Date();var e=f.getHours();var b=(e<12)?"am":"pm";e=(e==0)?12:(e>12)?e-12:e;e+="";var a=f.getMinutes()+"";var c=f.getSeconds()+"";e=(e.length==1)?"0"+e:e;a=(a.length==1)?"0"+a:a;c=(c.length==1)?"0"+c:c;return e+":"+a+":"+c+" "+b};CBSILogger.prototype.toStringEnhanced=function(d){if((typeof(d)).toLowerCase()=="string"){return d}var c="";for(properties in d){var a=d[properties];var b=(typeof(a)).toLowerCase();if(b=="function"){c+=" A function: "+a+"\n";continue}if(a){if(a.constructor==new Date().constructor){c+=properties+": A date: ";c+=a;c+="\n"}else{if(a.constructor==[].constructor){c+=properties+": An array:\n\n";c+=this.toStringEnhanced(a);c+="\n"}else{if(b=="object"){c+=properties+": ";c+=this.toStringEnhanced(a);c+="\n"}else{c+=properties+": ";c+=a;c+="\n"}}}}}return c};var CBSICookieJar=function(){};CBSICookieJar.prototype.createCookie=function(c,e,f){try{if(f){var b=new Date();b.setTime(b.getTime()+(f*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+e+a+"; path=/"}catch(d){return false}return true};CBSICookieJar.prototype.readCookie=function(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null};CBSICookieJar.prototype.eraseCookie=function(a){try{createCookie(a,"",-1)}catch(b){return false}return true};