var undefined;var CTVVideoList=Class.create();CTVVideoList.prototype={videos:null,initialize:function() {this.videos=new Array();},add:function(id,title,description,imageUrls,source) {var i=this.videos.length;this.videos[i]=new Object();this.videos[i].status=0;this.videos[i].id=id;this.videos[i].title=title;this.videos[i].description=description;this.videos[i].imageUrl=imageUrls[0];this.videos[i].thumbUrl=imageUrls[1];this.videos[i].source=source;},insert:function(id,title,description,imageUrls,source,isInserted) {for(var i=this.videos.length; i>0; i--)this.videos[i]=this.videos[i-1];this.videos[0]=new Object();this.videos[0].status=0;this.videos[0].id=id;this.videos[0].title=title;this.videos[0].description=description;this.videos[0].imageUrl=imageUrls[0];this.videos[0].thumbUrl=imageUrls[1];this.videos[0].source=source;this.videos[0].isInserted=isInserted;},append:function(id,title,description,imageUrls,source,isInserted,index) {for(var i=this.videos.length; i>index; i--){this.videos[i]=this.videos[i-1];}this.videos[index]=new Object();this.videos[index].status=0;this.videos[index].id=id;this.videos[index].title=title;this.videos[index].description=description;this.videos[index].imageUrl=imageUrls[0];this.videos[index].thumbUrl=imageUrls[1];this.videos[index].source=source;this.videos[index].isInserted=isInserted;},get:function(index) {if((index<0)||(index>this.videos.length - 1)) return undefined;return this.videos[index];},getById:function(id) {for(var i=0,len=this.videos.length; i<len; i++)if(this.videos[i].id==id) return this.videos[i];return undefined;},indexOf:function(id) {for(var i=0,len=this.videos.length; i<len; i++)if(this.videos[i].id==id) return i;return -1;},remove:function(index) {if((index<0)||(index>this.videos.length - 1)) return;for(var i=index,len=this.videos.length-1; i<len; i++)this.videos[i]=this.videos[i+1];delete this.videos[this.videos.length];this.videos.length--;},removeById:function(id) {this.remove(this.indexOf(id));},play:function(index) {this.videos[index].play();},moveUp:function(index) {if(index<1) return;var tmp=this.videos[index-1];this.videos[index-1]=this.videos[index];this.videos[index]=tmp;},moveDown:function(index) {if(index>this.videos.length - 2) return;var tmp=this.videos[index+1];this.videos[index+1]=this.videos[index];this.videos[index]=tmp;}};var CTVVideoListsHandler=Class.create();CTVVideoListsHandler.prototype={videoLists:null,initialize:function(videoListsNames) {this.videoLists=new Object();for(var i=0,len=videoListsNames.length; i<len; i++)this.videoLists[videoListsNames[i]]=new CTVVideoList();},add:function(listName,id,title,description,imageUrls,source) {this.videoLists[listName].add(id,title,description,imageUrls,source);},insert:function(listName,id,title,description,imageUrls,source,isInserted){this.videoLists[listName].insert(id,title,description,imageUrls,source,isInserted);},append:function(listName,id,title,description,imageUrls,source,isInserted,index){if(this.videoLists[listName]===undefined) return undefined;this.videoLists[listName].append(id,title,description,imageUrls,source,isInserted,index);},remove:function(listName,index) {if(this.videoLists[listName]===undefined) return undefined;this.videoLists[listName].remove(index);},removeById:function(listName,id) {if(this.videoLists[listName]===undefined) return undefined;this.videoLists[listName].removeById(id);},get:function(listName,index) {if(this.videoLists[listName]===undefined) return undefined;return this.videoLists[listName].get(index);},getById:function(listName,id) {if(this.videoLists[listName]===undefined) return undefined;return this.videoLists[listName].getById(id);},indexOf:function(listName,id) {if(this.videoLists[listName]===undefined) return undefined;return this.videoLists[listName].indexOf(id);},getList:function(listName) {if(this.videoLists[listName]===undefined) return new Array();return this.videoLists[listName].videos;},addList:function(newListName) {if(this.videoLists[newListName]===undefined)this.videoLists[newListName]=new CTVVideoList();},flushIt:function(listName) {if(this.videoLists[listName]===undefined) return;for(var i=this.videoLists[listName].videos.length-1; i>-1; i--)this.videoLists[listName].remove(i);},moveUp:function(listName,index) {this.videoLists[listName].moveUp(index);},moveDown:function(listName,index) {this.videoLists[listName].moveDown(index);}};var undefined;var CTVVideoPicksHandler={videoList:undefined,actualVideoListName:undefined,canvas:undefined,entryTemplate:undefined,enableMove:false,enableRemove:false,enablePick:false,enablePlay:false,initialize:function(canvas,videoListsNames) {this.videoList=new CTVVideoListsHandler(videoListsNames);this.canvas=new Object();for(var i=0,len=videoListsNames.length; i<len; i++) {this.canvas[videoListsNames[i]]=canvas[i];}},add:function(listName,id,title,description,imageUrls,source,isInserted) {var list=this.videoList.getList(listName);for(var i=0,len=list.length; i<len; i++){if(list[i].id==id){return;}}this.videoList.insert(listName,id,title,description,imageUrls,source,isInserted);},append:function(listName,id,title,description,imageUrls,source,isInserted,index){var list=this.videoList.getList(listName);for(var i=0,len=list.length; i<len; i++){if(list[i].id==id){return;}}this.videoList.append(listName,id,title,description,imageUrls,source,isInserted,index);if(listName==this.actualVideoListName) this.render();},remove:function(listName,index) {this.videoList.remove(listName,index);if(listName==this.actualVideoListName) this.render();},moveUp:function(index) {this.videoList.moveUp(this.actualVideoListName,index);this.render();},moveDown:function(index) {this.videoList.moveDown(this.actualVideoListName,index);this.render();},moveFirst:function(index,listName){var tmp=this.videoList.get(listName,index);this.videoList.remove(listName,index);this.videoList.insert(listName,tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source);this.render();},pickIt:function(newListName,index) {var tmp=this.videoList.get(this.actualVideoListName,index);if(tmp===undefined) return;CTVVideoPicksHandler.append(newListName,tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source);if(newListName==this.actualVideoListName) this.render();},playIt:function(index,listName) {listName=(listName===undefined)? this.actualVideoListName:listName;var tmp=this.videoList.get(listName,index);this.moveFirst(index,listName);if(tmp===undefined) return;CTVVideoPicksHandler.add("editor",tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source,false);CTVVideoPlayerHandler.play(tmp.id);if(listName==this.actualVideoListName) this.render();},playNext:function() {var precedenceList=["editor"];for(var j=0,len1=precedenceList.length; j<len1; j++) {if(this.videoList===undefined) return;var list=this.videoList.getList(precedenceList[j]);if(list.length==0){window.location.reload();return;}for(var i=0,len=list.length; i<len; i++) {if(list[i].status==0) {CTVVideoPlayerHandler.play(list[i].id);return;}}}this.render();},getNextInfo:function() {var precedenceList=["editor"];for(var j=0,len1=precedenceList.length; j<len1; j++) {if(this.videoList===undefined) return null;var list=this.videoList.getList(precedenceList[j]);if(list.length==0){return;}for(var i=0,len=list.length; i<len; i++) {if(list[i].status==0) {return list[i];}}return null;}this.render();return null;},setPlaying:function(id) {var precedenceList=["editor"];for(var j=0,len1=precedenceList.length; j<len1; j++) {if(this.videoList===undefined) return;var list=this.videoList.getList(precedenceList[j]);for(var i=0,len=list.length; i<len; i++)if(list[i].id==id) {list[i].status=1;if(precedenceList[j]!=this.actualVideoListName)this.swapTo(precedenceList[j],(precedenceList[j]=="user"),(precedenceList[j]=="user"),(precedenceList[j]!="user"),true);var canvas=this.canvas[precedenceList[j]];var child=canvas.childElements()[i];if(child.hasClassName("ctvo_videoEntryPicksPlayed")) child.removeClassName("ctvo_videoEntryPicksPlayed");child.addClassName("ctvo_videoEntryPicksPlaying");}}},setPlayed:function(id) {var precedenceList=["editor"];for(var j=0,len1=precedenceList.length; j<len1; j++) {if(this.videoList===undefined) return;var list=this.videoList.getList(precedenceList[j]);for(var i=0,len=list.length; i<len; i++)if(list[i].id==id) {list[i].status=2;if(precedenceList[j]==this.actualVideoListName) {var canvas=this.canvas[precedenceList[j]];var child=canvas.childElements()[i];if(child.hasClassName("ctvo_videoEntryPicksPlaying")) child.removeClassName("ctvo_videoEntryPicksPlaying");child.addClassName("ctvo_videoEntryPicksPlayed");}}}},swapTo:function(newVideoListName,enableMove,enableRemove,enablePick,enablePlay) {this.actualVideoListName=newVideoListName;this.enableMove=enableMove;this.enableRemove=enableRemove;this.enablePick=enablePick;this.enablePlay=enablePlay;this.render();},getLastInsertedIndex:function(){var list=this.videoList.getList("editor");for(var i=list.length; i>0; i--){if(list[i-1].isInserted) {return i;}}},render:function(videoListName) {var movable="block";var removable="block";var pickable="none";var playable="block";videoListName=(videoListName===undefined)? this.actualVideoListName:videoListName;var list=this.videoList.getList(videoListName);var html="";for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$title/g,list[i].title);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$imageUrl/g,list[i].thumbUrl);htmlEntry=htmlEntry.replace(/\$source/g,list[i].source);htmlEntry=htmlEntry.replace(/\$index/g,i);htmlEntry=htmlEntry.replace(/\$move/g,movable);htmlEntry=htmlEntry.replace(/\$remove/g,removable);htmlEntry=htmlEntry.replace(/\$pick/g,pickable);htmlEntry=htmlEntry.replace(/\$play/g,playable);if(list[i].status==0) htmlEntry=htmlEntry.replace(/\$classname/g,"");else if(list[i].status==1) htmlEntry=htmlEntry.replace(/\$classname/g,"ctvo_videoEntryPicksPlaying");else if(list[i].status==2) htmlEntry=htmlEntry.replace(/\$classname/g,"ctvo_videoEntryPicksPlayed");html += htmlEntry;}this.canvas[videoListName].update(html);if(videoListName=="user") {$('ctvo_videoTabPicksEditor').removeClassName("ctvo_On");$('ctvo_videoTabPicksMy').addClassName("ctvo_On");}else {$('ctvo_videoTabPicksEditor').addClassName("ctvo_On");$('ctvo_videoTabPicksMy').removeClassName("ctvo_On");}}};var CTVVideoLibraryHandler={videoList:undefined,actualVideoListName:undefined,canvas:undefined,entryTemplate:undefined,resultSummaryTemplate:undefined,enablePick:false,enablePlay:false,containerHeight:353,runtimeHeight:0,animationSmoothness:20,animationSpeed:10,animationThread:null,animationRunning:false,sportCanvas:null,libraryParamName:"lib",isInserted:true,getLibraryParam:function() {var querystring=new String(window.location.search);if(querystring=="") return "";var tmp=querystring.substr(1).split("&");for(var i=0,len=tmp.length; i<len; i++) {var paramInfo=tmp[i].split("=");if(paramInfo[0]==this.libraryParamName) return paramInfo[1];}return "";},initialize:function(canvas,videoListsNames,spacialCanvas) {this.videoList=new CTVVideoListsHandler(videoListsNames);this.canvas=new Object();for(var i=0,len=videoListsNames.length; i<len; i++)this.canvas[videoListsNames[i]]=canvas[i];this.sportCanvas=spacialCanvas[0];this.searchCanvas=spacialCanvas[1];},add:function(listName,id,title,description,imageUrls,source,isInserted) {this.videoList.add(listName,id,title,description,imageUrls,source);if(listName==this.actualVideoListName) this.render();},pickIt:function(newListName,index) {var tmp=this.videoList.get(this.actualVideoListName,index);if(tmp===undefined) return;tmp.isInserted=true;var lastIndex=CTVVideoPicksHandler.getLastInsertedIndex();if(lastIndex){CTVVideoPicksHandler.append(newListName,tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source,tmp.isInserted,lastIndex);}else{CTVVideoPicksHandler.append(newListName,tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source,tmp.isInserted,1);}var nextVideoInfo=CTVVideoPicksHandler.getNextInfo();if(nextVideoInfo){var image='<img src=\' '+ nextVideoInfo.imageUrl + '\' height=\'45\' width=\'81\' />';$('videoNextInfoTitle').update('<div><a onclick=\'CTVVideoPicksHandler.playIt(1)\'>' + nextVideoInfo.title + '</a></div>' + image);}CTVVideoPicksHandler.render();},playIt:function(index) {var tmp=this.videoList.get(this.actualVideoListName,index);if(tmp===undefined) return;CTVVideoPicksHandler.add("editor",tmp.id,tmp.title,tmp.description,[tmp.imageUrl,tmp.thumbUrl],tmp.source,false);CTVVideoPlayerHandler.play(tmp.id);},setPlaying:function(id) {},setPlayed:function(id) {},loadVideoIn:function(parameter,canvas) {var d=new Date();var t=this;var ar=new Ajax.Request("/video/CTVSportGroup=" + parameter + "/list.html?t="+d.getTime(),{method:'get',onComplete:function(transport) {CTVVideoLibraryHandler.videoList.flushIt("olympicSports");var list=eval(transport.responseText);for(var i=0,len=list.length; i<len; i++)CTVVideoLibraryHandler.videoList.add("olympicSports",list[i].id,list[i].title,list[i].description,[list[i].imageUrl,list[i].thumbUrl],list[i].source);CTVVideoLibraryHandler.renderSportTab(parameter);}});},search:function(query) {var d=new Date();var t=this;var ar=new Ajax.Request("/search/library/video/_xmlsearch.htmx?t=" + d.getTime() + "&q=" + query,{method:'post',onComplete:function(transport) {CTVVideoLibraryHandler.videoList.flushIt("librarySearch");var list=eval(transport.responseText);for(var i=0,len=list.length; i<len; i++)CTVVideoLibraryHandler.videoList.add("librarySearch",list[i].id,list[i].title,unescape(list[i].description),[list[i].thumbUrl,list[i].thumbUrl],list[i].source);CTVVideoLibraryHandler.renderSearchTab(query,true);}});},swap:function(newVideoListName,sender) {var tmp=newVideoListName.split(".");var toShow=this.canvas[tmp[0]];if(toShow.style.visibility=='visible') return;for (el in this.canvas){this.canvas[el].style.display='none';}var arrList=$$('#VideoTabList li span');arrList.each(function(s){s.removeClassName('ctvo_On');});$(sender).addClassName("ctvo_On");toShow.style.display='block';if(toShow.id=='ctvo_videoLibraryOS'){$('ctvo_videoLibrarySportTabs').style.display='block';$('ctvo_videoLibrarySportsTitle').addClassName('ctvo_On');}else{switch(toShow.id){case 'ctvo_videoLibraryON':$('ctvo_videoLibraryNewsTitle').addClassName('ctvo_On');break;case 'ctvo_videoLibraryTC':$('ctvo_videoLibraryTeamCanadaTitle').addClassName('ctvo_On');break;case 'ctvo_videoLibrarySearch':$('ctvo_videoLibrarySearchTitle').addClassName('ctvo_On');break;}$('ctvo_videoLibrarySportTabs').style.display='none';}if(tmp[1]){this.renderSportTab(tmp[1]);this.loadVideoIn(tmp[1],'ctvo_videoLibraryTabContent');}this.actualVideoListName=newVideoListName;},swapTo:function(newVideoListName) {if(this.animationRunning) return;var toShow=this.canvas[newVideoListName];if(toShow.style.visibility=='visible') return;else {var tmp=toShow.up().adjacent("li.ctvo_On")[0];if(!(tmp===undefined)) tmp.removeClassName("ctvo_On");toShow.up().addClassName("ctvo_On");}this.animationRunning=true;if(newVideoListName=="olympicSports") {$('ctvo_videoLibrarySportTabs').show();this.runtimeHeight=this.containerHeight - $('ctvo_videoLibrarySportTabs').getHeight();}else if(newVideoListName=="librarySearch") {$('ctvo_videoLibrarySportTabs').hide();this.runtimeHeight=this.containerHeight - $('ctvo_videoLibrarySearchSummary').getHeight();}else {$('ctvo_videoLibrarySportTabs').hide();this.runtimeHeight=this.containerHeight;}this.np=this.runtimeHeight - this.animationSmoothness;toShow.style.height='0px';toShow.style.marginBottom='0px';toShow.style.display='block';toShow.style.visibility='visible';this.animationThread=setInterval('CTVVideoLibraryHandler.render("' + newVideoListName + '")',this.animationSpeed);},render:function(videoListName) {try {var toShow=this.canvas[videoListName];var toHide=(this.actualVideoListName===undefined)? undefined:this.canvas[this.actualVideoListName];if(this.np>=0) {toShow.style.height=(this.runtimeHeight - this.np - 3) + 'px';toShow.style.marginBottom='3px';if(!(toHide===undefined)) toHide.style.height=this.np + 'px';this.np -= this.animationSmoothness;}else{clearInterval(this.animationThread);if(!(toHide===undefined)) {toHide.style.display='none';toHide.style.visibility='hidden';toHide.style.height='0px';}toShow.style.height=this.runtimeHeight + 'px';this.actualVideoListName=videoListName;this.animationRunning=false;}} catch(e) {clearInterval(this.animationThread);this.animationRunning=false;}},renderSportTab:function(sportGroup) {var list=this.videoList.getList("olympicSports");var html="";for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$title/g,list[i].title);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$imageUrl/g,list[i].imageUrl);htmlEntry=htmlEntry.replace(/\$source/g,list[i].source);htmlEntry=htmlEntry.replace(/\$index/g,i);if((i>0)&&(((i+1)%3)==0)) htmlEntry += '<div class="ctvo_videoLibrarySpacer"></div>';html += htmlEntry;}this.sportCanvas.update(html);var groups=["1","2","3","4","5","6"];for(var i=0,len=groups.length; i<len; i++)$('ctvo_videoLibrarySportTab'+groups[i]).removeClassName("ctvo_On");if(sportGroup!="ALL") $('ctvo_videoLibrarySportTab'+sportGroup).addClassName("ctvo_On");},renderSearchTab:function(query,isNotInError) {var html="";var list=this.videoList.getList("librarySearch");for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$title/g,list[i].title);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$imageUrl/g,list[i].imageUrl);htmlEntry=htmlEntry.replace(/\$source/g,list[i].source);htmlEntry=htmlEntry.replace(/\$index/g,i);if((i>0)&&(((i+1)%3)==0)) htmlEntry += '<div class="ctvo_videoLibrarySpacer"></div>';html += htmlEntry;}this.searchCanvas.update(html);var summary="";summary=new String(this.resultSummaryTemplate);summary=summary.replace(/\$count/g,list.length);summary=summary.replace(/\$query/g,query);$('ctvo_videoLibrarySearchSummaryLabel').update(summary);},renderAll:function() {for(name in this.canvas) {var list=this.videoList.getList(name);var html="";for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$title/g,list[i].title);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$imageUrl/g,list[i].imageUrl);htmlEntry=htmlEntry.replace(/\$source/g,list[i].source);htmlEntry=htmlEntry.replace(/\$index/g,i);if((i>0)&&(((i+1)%3)==0)) htmlEntry += '<div class="ctvo_videoLibrarySpacer"></div>';html += htmlEntry;}if((name!="olympicSports")&&(name!="librarySearch")) this.canvas[name].update(html);}},showAndHide:function(toHide,toShow) {var actualLibrary=toHide.up(3);actualLibrary.getElementsBySelector('[class="ctvo_videoLibraryThumbnail"]').invoke("show");actualLibrary.getElementsBySelector('[class="ctvo_videoLibraryHoverInfo"]').invoke("hide");toHide.hide();toShow.show();}};var CTVVideoRelatedContentHandler ={canvas:null,entryTemplate:null,emptyTemplate:null,initialize:function(canvas,emptyTemplate) {this.canvas=canvas;this.emptyTemplate=emptyTemplate;},setPlaying:function(relatedContent) {this.render(relatedContent);},setPlayed:function(relatedContent) {this.canvas.update('');},open:function(url) {if(window.opener==null)window.location=url;elsewindow.opener.location=url;},render:function(list) {var html="";if(list===undefined) html += this.emptyTemplate;else {if(list.length==0) html += this.emptyTemplate;for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$url/g,list[i].url);html += htmlEntry;}this.canvas.update(html);}}};var CTVVideoPlayerHandler ={playerHandler:undefined,sourcePath:undefined,actualVideoId:undefined,videoOnDemand:false,libraryParamName:"assetid",videoList:undefined,getPlayerParam:function() {var querystring=new String(window.location.search);if(querystring=="") return "";var tmp=querystring.substr(1).split("&");for(var i=0,len=tmp.length; i<len; i++) {var paramInfo=tmp[i].split("=");if(paramInfo[0]==this.libraryParamName) return paramInfo[1];}return "";},initialize:function(playerHandler,sourcePath) {this.playerHandler=playerHandler;this.sourcePath=sourcePath;this.videoList=new CTVVideoListsHandler("editor");this.attachEvents();},attachEvents:function() {var playerHandler=this.playerHandler;var onPluginStarted=function() {var playThis=CTVVideoPlayerHandler.getPlayerParam();if(playThis==""){CTVVideoPicksHandler.playNext();}else {CTVVideoPlayerHandler.videoOnDemand=true;CTVVideoPlayerHandler.play(playThis);}};var onVideoStarted=function(videoId) {if(videoId<0) return;var config=playerHandler.getJsonCurrentVideoConfig();if(config===undefined) return;if(config.streams===undefined) return;if(CTVVideoPlayerHandler.videoOnDemand) {CTVVideoPicksHandler.add("user",config.streams.assetID,unescape(config.title),unescape(config.description),[config.thumbnails.large,config.thumbnails.small],config.metrics[4]);CTVVideoPlayerHandler.videoOnDemand=false;}log("CTVVideoPlayerHandler:onVideoStarted " + config.streams.assetID);CTVVideoRelatedContentHandler.setPlaying(config.relatedContent);CTVVideoLibraryHandler.setPlaying(config.streams.assetID);CTVVideoPicksHandler.setPlaying(config.streams.assetID);var nextVideoInfo=CTVVideoPicksHandler.getNextInfo();if(nextVideoInfo){var image='<img src=\' '+ nextVideoInfo.imageUrl + '\' height=\'35\' width=\'71\' />';$('videoNextInfoTitle').update(image + '<div><a onclick=\'CTVVideoPicksHandler.playIt(1)\'>' + nextVideoInfo.title + '</a></div>');}};var onVideoFinished=function(videoId) {if(videoId<0) return;var config=playerHandler.getJsonLastVideoConfig();if(config===undefined) return;if(config.streams===undefined) return;log("CTVVideoPlayerHandler:onVideoFinished " + config.streams.assetID + " playnext? " + (CTVVideoPlayerHandler.actualVideoId==config.streams.assetID));CTVVideoRelatedContentHandler.setPlayed(config.relatedContent);CTVVideoLibraryHandler.setPlayed(config.streams.assetID);CTVVideoPicksHandler.setPlayed(config.streams.assetID);CTVVideoPicksHandler.videoList.removeById("editor",config.streams.assetID);CTVVideoPicksHandler.render();if(CTVVideoPlayerHandler.actualVideoId==config.streams.assetID) CTVVideoPicksHandler.playNext();};playerHandler.addEventHandler('evtAppStarted',onPluginStarted);playerHandler.addEventHandler('evtVideoStarted',onVideoStarted);playerHandler.addEventHandler('evtVideoFinished',onVideoFinished);},createJsonPath:function(videoId) {videoId=new String(videoId);var tmp=this.sourcePath;for(var i=0,len=videoId.length; i<len; i=i+4)tmp += '/' + videoId.substr(i,4);return tmp+ '/asset.txt';},play:function(videoId) {if(videoId===undefined) return;if(videoId=="") return;this.actualVideoId=videoId;var jsonPath=this.createJsonPath(videoId);var player=this.playerHandler;log("CTVVideoPlayerHandler:play " + videoId);if(!player.getInfoIsCurrentAdv()) player.setVideoFromJSON2(jsonPath);},playStatic:function(jsonPath){var player=this.playerHandler;player.setVideoFromJSON2(jsonPath);},pause:function() {this.playerHandler.pause();},getVideoShareUrl:function() {if(this.playerHandler==null) return "";var tmp=this.playerHandler.getJsonCurrentVideoConfig();if(tmp===undefined) return "";return tmp.shareUrl;},getVideoTitle:function() {if(this.playerHandler==null) return "";var tmp=this.playerHandler.getJsonCurrentVideoConfig();if(tmp===undefined) return "";return unescape(tmp.title);}};var VideoPlayer=Class.create({_classname:'[js] VideoPlayer',playerConfig:undefined,videoMetadata:undefined,videoMetadataString:undefined,player:undefined,containerID:undefined,playerID:undefined,isVideoMetadataLoaded:0,isPlayerLoaded:0,isAutoPlayAllowed:0,_jsonUrl:undefined,_autostartValue:-1,_pluginUrl:"../ClientBin/CTV.videoplayer.xap",_advMng:undefined,_playerSettings:undefined,_altImg:undefined,initialize:function(pConfObj) {log(this._classname + ".initialize(pConfObj:" + new BasePlaybackComponent().object2string(pConfObj) + ")")if(this.isDefined(pConfObj.containerId)) {this.containerID=pConfObj.containerId;this.playerID=this.containerID + '_' + Math.random().toString().split(".")[1];}else {log(this._classname + ".initialize() - ERR containerId undefined.")}if(this.isDefined(pConfObj.altImg)) this._altImg=pConfObj.altImg;this._setJsonUrl(pConfObj.jsonUrl);if(this.isDefined(pConfObj.autostartValue))this._autostartValue=pConfObj.autostartValue;if(this.isDefined(pConfObj.pluginUrl))this._pluginUrl=pConfObj.pluginUrl;if(this.isDefined(pConfObj.playerSettings))this._playerSettings=pConfObj.playerSettings;var advIsEnabled=true;if(this.isDefined(pConfObj.advertEnabled))advIsEnabled=pConfObj.advertEnabled;this._advMng=new CtvAdvManager(advIsEnabled,this._playerSettings);log(this._classname + ".initialize(),jsonUrl:" + this._jsonUrl);this.loadPlayer();},_setJsonUrl:function(pJsonUrl) {var isValid=this.isDefined(pJsonUrl);log(this._classname + "._setJsonUrl(pJsonUrl:" + pJsonUrl + ")")if(isValid)this._jsonUrl=pJsonUrl;elselog(this._classname + "._setJsonUrl() - ERR pJsonUrl undefined.")return isValid;},loadPlayer:function() {this.playerConfig={containerID:this.containerID,playerID:this.playerID,urlXAP:this._pluginUrl,metricsInSec:120,metricsInPerc:"20|40|60|80",autostart:this._autostartValue,voc:"/vocabularies/videoplayer.xml",debugMode:1,altImg:this._altImg};this.player=new SilverlightPlaybackComponent(this.playerConfig);this.player.onAppStarted=this._onAppStarted.bind(this);this.player.onVideoPlay=this._onVideoPlay.bind(this);this.player.onVideoOpened=this._onVideoStarted.bind(this);this.player.onVideoStopped=this._onVideoFinished.bind(this);this.player.onMainVideoStatusChanged=this._onMainVideoStatusChanged.bind(this);this.player.onTraffickingPercentageReached=this._onVideoPercReceived.bind(this);this.player.onTraffickingSecondsReached=this._onVideoSecReceived.bind(this);this.player.buildPlayer();},jsonDownload:function(jsonURL) {log(this._classname + ".jsonDownload(jsonURL:" + jsonURL + ")");new Ajax.Request(jsonURL,{method:'post',evalJSON:true,sanitizieJSON:true,onSuccess:this._onJsonDownloaded.bind(this),onFailure:function(transport) {log("[js] VideoPlayer.jsonDownload(jsonURL:" + jsonURL + ") - ERR can't download json");}});},_onJsonDownloaded:function(transport) {var jsonConfiguration=transport.responseText.evalJSON(true);var isJSON=transport.responseText.isJSON();log(this._classname + "._onJsonDownloaded() json isValid:" + isJSON);if(isJSON) {this.videoMetadata=jsonConfiguration;this.videoMetadataString=transport.responseText;var showad=true;log(this._classname + "._onJsonDownloaded() json preroll flag:" + showad);var advExists=showad&&this._advMng.advExists();this.setInfoIsCurrentAdv(advExists);if(advExists) {this._advMng.advExec(this.videoMetadata,this._onAdvSuccessDownload.bind(this),this._onAdvErrorDonwload.bind(this));}else {this._advMng.setVideoPlayback(false);this.clearPlaylist();this.setVideoFromJSON();this.launchEvent(this._eventList.evtJsonDownloaded);}}else {log(this._classname + "._onJsonDownloaded() ERR - json is not valid");}},setVideoFromJSON2:function(pJsonUrl) {log(this._classname + ".setVideoFromJSON2(pJsonUrl:" + pJsonUrl + ")");var isJsonValid=this._setJsonUrl(pJsonUrl);if(false==isJsonValid)return;this.jsonDownload(pJsonUrl);},setVideoFromJSON:function() {this.player.setVideoByJsonConfiguration(this.videoMetadataString);},_onAdvSuccessDownload:function(pAdvVideoUrl,pAdvLink) {log(this._classname + "._onAdvSuccessDownload(pAdvVideoUrl:" + pAdvVideoUrl + ",pAdvLink:" + pAdvLink + ")");this.clearPlaylist();this.player.setAdv(pAdvVideoUrl,pAdvLink);this._advMng.setVideoPlayback(true);},_onAdvErrorDonwload:function() {log(this._classname + "._onAdvErrorDonwload(..)");this.clearPlaylist();if(typeof this._jsonUrl!='undefined')this.setVideoFromJSON2(this._jsonUrl);},start:function() {if(this.isPlayerLoaded!=1) {log(this._classname + ".play() this.isPlayerLoaded!=1");return -1;}this.player.start();},play:function() {this.player.play();},playAt:function(pPositionSeconds) {log(this._classname + ".play(pPositionSeconds:" + pPositionSeconds + ")");this.player.playAt(pPositionSeconds);},pause:function() {this.player.pause();},stop:function() {this.player.stop();},clearPlaylist:function() {this.player.clearPlaylist();},getVideoTimelineVal:function() {var timelineValue=this.player.getVideoTimelineVal();return timelineValue;},_onVideoPlay:function(pVideoId) {log(this._classname + "._onVideoPlay(pVideoId:" + pVideoId + ")")this.launchEvent(this._eventList.evtVideoPlay,{'pVideoId':pVideoId});},_onVideoStarted:function(pVideoId,pIsAutostartStart) {log(this._classname + "._onVideoStarted(pVideoId:" + pVideoId + ",pIsAutostartStart:" + pIsAutostartStart + ")")this.launchEvent(this._eventList.evtVideoStarted,{'pVideoId':pVideoId,'pIsAutostartStart':pIsAutostartStart});},_onVideoFinished:function(pVideoId) {log(this._classname + "._onVideoFinished(pVideoId:" + pVideoId + ")")var advIsFinished=pVideoId==-1;if(advIsFinished&&this.isDefined(this._jsonUrl)) {this.clearPlaylist();this.setVideoFromJSON2(this._jsonUrl);}this.launchEvent(this._eventList.evtVideoFinished,{'pVideoId':pVideoId});this.launchEvent(this._eventList.evtVideoFinished2,{'pVideoId':pVideoId,'pVideoConf':this.videoMetadata});},_onVideoPercReceived:function(pVideoId,pPercValue) {log(this._classname + "._onVideoPercReceived(pVideoId:" + pVideoId + ",pPercValue:" + pPercValue + ")")this.launchEvent(this._eventList.evtVideoPercReceived,{'pVideoId':pVideoId,'pPercValue':pPercValue});},_onVideoSecReceived:function(pVideoId,pSecValue) {log(this._classname + "._onVideoSecReceived(pVideoId:" + pVideoId + ",pSecValue:" + pSecValue + ")")this.launchEvent(this._eventList.evtVideoSecReceived,{'pVideoId':pVideoId,'pSecValue':pSecValue});},_onAppStarted:function() {log(this._classname + "._onAppStarted()");this.isPlayerLoaded=1; if(this.isDefined(this._jsonUrl))this.jsonDownload(this._jsonUrl);this.launchEvent(this._eventList.evtAppStarted);},_onMainVideoStatusChanged:function(sStatus) {log(this._classname + "._onMainVideoStatusChanged(),status:" + sStatus);this.launchEvent(this._eventList.evtVideoStatusChanged,{ 'pStatusString':sStatus });},isDefined:function(pObj) {return pObj!=undefined&&typeof pObj!='undefined';},getJsonLastVideoConfig:function() {var resultObj=undefined;var lastJsonStr=this.player.getLastJsonConfigString();if(typeof lastJsonStr!=undefined&&lastJsonStr.length>0)resultObj=eval('(' + lastJsonStr + ')');return resultObj;},getJsonCurrentVideoConfig:function() {return this.videoMetadata;},_isCurrentAdv:false,getInfoIsCurrentAdv:function() {return this._isCurrentAdv;},setInfoIsCurrentAdv:function(pIsAdv) {this._isCurrentAdv=pIsAdv;},_functionsEvtHandlerHash:new Hash(),addEventHandler:function(pFunctionName,pFunctionHandler) {var funcExists=this._eventList[pFunctionName]!=undefined;if(!funcExists) {log(this._classname + ".addEventHandler() - ERR " + pFunctionName + " not exists.");return;}var currentArray=this._functionsEvtHandlerHash.get(pFunctionName);if(currentArray===undefined)currentArray=new Array(pFunctionHandler);elsecurrentArray.push(pFunctionHandler);this._functionsEvtHandlerHash.set(pFunctionName,currentArray);},removeEventHandler:function(pFunctionName,pFunctionHandler) {var funcExists=this._eventList[pFunctionName]!=undefined;if(funcExists) {var currentArray=this._functionsEvtHandlerHash.get(pFunctionName);if(typeof currentArray!='undefined') {currentArray=currentArray.without(pFunctionHandler);this._functionsEvtHandlerHash.set(pFunctionName,currentArray);}}},hasEventHandler:function(pFunctionName,pFunctionHandler) {var res=false;var funcExists=this._eventList[pFunctionName]!=undefined;if(funcExists) {var currentArray=this._functionsEvtHandlerHash.get(pFunctionName);if(typeof currentArray!='undefined') {res=currentArray.indexOf(pFunctionHandler)>0;}}return res;},_eventList:{'evtVideoStarted':'evtVideoStarted','evtVideoPercReceived':'evtVideoPercReceived','evtVideoSecReceived':'evtVideoSecReceived','evtVideoPlay':'evtVideoPlay','evtJsonDownloaded':'evtJsonDownloaded','evtVideoFinished':'evtVideoFinished','evtVideoFinished2':'evtVideoFinished2','evtAppStarted':'evtAppStarted','evtVideoStatusChanged':'evtVideoStatusChanged'},launchEvent:function(pFunctionName,pParameters) {var funcList=this._functionsEvtHandlerHash.get(pFunctionName);if(typeof funcList!='undefined'&&funcList.length>0) {switch (pFunctionName) {case this._eventList.evtVideoStarted:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId,pParameters.pIsAutostartStart);break;case this._eventList.evtVideoPercReceived:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId,pParameters.pPercValue);break;case this._eventList.evtVideoPlay:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId);break;case this._eventList.evtJsonDownloaded:for (var i=0; i<funcList.length; i++)funcList[i]();break;case this._eventList.evtVideoFinished:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId);break;case this._eventList.evtVideoFinished2:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId,pParameters.pVideoConf);break;case this._eventList.evtAppStarted:for (var i=0; i<funcList.length; i++)funcList[i]();break;case this._eventList.evtVideoSecReceived:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pVideoId,pParameters.pSecValue);break;case this._eventList.evtVideoStatusChanged:for (var i=0; i<funcList.length; i++)funcList[i](pParameters.pStatusString);break;default:log(this._classname + ".launchEvent() - ERR [" + pFunctionName + "] is not managed");break;}}}});var CtvAdvManager=Class.create({_classname:"[js] CtvAdvManager",_advModule:undefined,_advDownloaded:false,_callbackFunctionExternalSuccess:undefined,_callbackFunctionExternalError:undefined,_advTimeoutDownloader:undefined,initialize:function(pIsEnabled,pPlayerSettings) {log(this._classname + ".initialize(pIsEnabled:" + pIsEnabled + ")");this._advModule=new AdvComponent(pPlayerSettings);this._settings.flagAdvEnabled=pIsEnabled;this.printAdvSettings();},getIsEnabled:function() {return this._settings.flagAdvEnabled;},_settings:{MINUTES_BETWEEN_CLIPS:3,MAX_CLIPS_WHITOUT_ADS:3,flagAdvEnabled:false,flagStartWithAdv:true,timeoutOnErrorSecs:5},printAdvSettings:function() {var base=new BasePlaybackComponent();log(this._classname + ".printAdvSettings():" + base.object2string(this._settings));},advExists:function() {log(this._classname + ".advExists(isEnabled:" + this.getIsEnabled() + ") ");if(!this.getIsEnabled())return false;var useAdv=this._decideIfAdvNeeded();if(useAdv) {}return useAdv;},advExec:function(pJsonObj,pCallbackSuccess,pCallbackError) {if(!this.getIsEnabled())return;log(this._classname + ".advExec() ");this._callbackFunctionExternalSuccess=pCallbackSuccess;this._callbackFunctionExternalError=pCallbackError;var videoUrlPart=pJsonObj.adverts.prerollVideo;log("videourlpart:" + videoUrlPart + ".advExec() ");this._advDownloaded=false; this._advModule.getVideoUrlAsynch(videoUrlPart,this._onDownloadSuccess.bind(this));this._advTimeoutDownloader=this._onDonwloadError.bind(this).delay(this._settings.timeoutOnErrorSecs);},_onDonwloadError:function() {if(false==this._advDownloaded) {log(this._classname + "._onDonwloadError() - ERR no adv downloading (t-out of " + this._settings.timeoutOnErrorSecs + " secs)");this._advDownloaded=true;this._callbackFunctionExternalError();}this._resetCallbacks();},_onDownloadSuccess:function(pAdvVideoUrl,pAdvLink) {if(true==this._advDownloaded) {log(this._classname + "._onDownloadSuccess(..) ERR _onDonwloadError() was launched before ?!? ");return;}else {log(this._classname + "._onDownloadSuccess(pAdvVideoUrl:" + pAdvVideoUrl + ",pAdvLink:" + pAdvLink + ")");this._advDownloaded=true;this._callbackFunctionExternalSuccess(pAdvVideoUrl,pAdvLink);}this._resetCallbacks();},_resetCallbacks:function() {this._callbackFunctionExternalError=undefined;this._callbackFunctionExternalSuccess=undefined;},_decideIfAdvNeeded:function() {var advIsNeeded=false;if(this.getIsFirstVideo()&&this._settings.flagStartWithAdv) {advIsNeeded=true;}elseif(this.getFromLastAdvTimeSpan()>this._settings.MINUTES_BETWEEN_CLIPS) {advIsNeeded=true;}elseif(this.getVideoNoAdvQtyFromLastAdv()>=this._settings.MAX_CLIPS_WHITOUT_ADS) {advIsNeeded=true;}log(this._classname + "._decideIfAdvNeeded():" + advIsNeeded);return advIsNeeded;},getIsFirstVideo:function() {var result=this.getTotalVideoCounter()==0;log(this._classname + ".getIsFirstVideo():" + result);return result;},getFromLastAdvTimeSpan:function() {var now=new Date();var result=this.getTimeDiffMinutes(now);log(this._classname + ".getFromLastAdvTimeSpan():" + result + " min");return result;},getVideoNoAdvQtyFromLastAdv:function() {var result=this.getCounterNewVideoPlayback();log(this._classname + ".getVideoQtyFromLastAdv():" + result);return result;},_totalVideoPlaybackCounter:0,addTotalCounter:function() {this._totalVideoPlaybackCounter++;},getTotalVideoCounter:function() {return this._totalVideoPlaybackCounter;},_counterNoAdvVideoFromLastAdv:0,setCounterNewVideoPlayback:function() {this.counterNoAdvVideoFromLastAdv++;},resetCounterNewVideoPlayback:function() {this.counterNoAdvVideoFromLastAdv=0;},getCounterNewVideoPlayback:function() {return this.counterNoAdvVideoFromLastAdv;},_lastAdvTime:undefined,setAdvTime:function() {this._lastAdvTime=new Date();},getAdvTime:function() {var res=0;if(typeof this._lastAdvTime!='undefined') {res=this._lastAdvTime;}return res;},getTimeDiffMinutes:function(pDateToCompare) {var res=0;if(typeof this._lastAdvTime!='undefined') {var diffSecs=(pDateToCompare.getTime() - this._lastAdvTime.getTime()) / 1000;var diffMinutes=diffSecs / 60;res=diffMinutes;}return res;},setAdvPlayed:function() {},setVideoPlayback:function(pIsAdv) {this.addTotalCounter();if(pIsAdv) {this.resetCounterNewVideoPlayback();this.setAdvTime();}else {this.setCounterNewVideoPlayback();}}});var playbackTimeManager={ TOUT_SECS:120 ,RESET_VALUE:-1 ,_objectName:'playbackTimeManager' ,_lastNotifyDatetime:undefined ,_vid:-1 ,_stopping:undefined ,_toutInstance:undefined ,callbackNotification:undefined ,_pauseStart:undefined ,init:function() {playbackTimeManager.write("init(),TOUT_SECS:" + playbackTimeManager.TOUT_SECS);playbackTimeManager._lastNotifyDatetime=playbackTimeManager.RESET_VALUE;playbackTimeManager._stopping=false;playbackTimeManager._pauseStart=playbackTimeManager.RESET_VALUE;},onStart:function(vid) {playbackTimeManager.write("start(vid:" + vid + ")");playbackTimeManager.onStop(playbackTimeManager._vid);playbackTimeManager._vid=vid;playbackTimeManager._lastNotifyDatetime=new Date();playbackTimeManager.launchTimeout();},onStop:function(vid) {if(playbackTimeManager._lastNotifyDatetime!=playbackTimeManager.RESET_VALUE) {playbackTimeManager.write("stop(vid:" + vid + ")");playbackTimeManager._stopping=true;playbackTimeManager.notify();playbackTimeManager.reset();}},onStatusChange:function(sStatus) {log(playbackTimeManager._objectName + ".onStatusChange(..),status_received:" + sStatus);var pauseCommand=sStatus.indexOf("Pause")>=0;var playCommand=sStatus.indexOf("Play")>=0;var stopped=playbackTimeManager._lastNotifyDatetime==playbackTimeManager.RESET_VALUE;var wasPaused=playbackTimeManager._pauseStart!=playbackTimeManager.RESET_VALUE;if(stopped&&playCommand)playbackTimeManager.onStart(playbackTimeManager._vid);if(stopped)return;if(pauseCommand) {log(playbackTimeManager._objectName + ".onStatusChange(..),exec PAUSE");playbackTimeManager._pauseStart=new Date();} else if(playCommand&&wasPaused) {log(playbackTimeManager._objectName + ".onStatusChange(..),exec RESUME");var msecDiff=(new Date()).getTime() - playbackTimeManager._pauseStart.getTime();var pauseDurationSeconds=msecDiff / 1000;if(playbackTimeManager._lastNotifyDatetime!=playbackTimeManager.RESET_VALUE) {log(playbackTimeManager._objectName + ".onStatusChange(..),date before:" + playbackTimeManager._lastNotifyDatetime);playbackTimeManager._lastNotifyDatetime.setSeconds(playbackTimeManager._lastNotifyDatetime.getSeconds() + pauseDurationSeconds);log(playbackTimeManager._objectName + ".onStatusChange(..),date after:" + playbackTimeManager._lastNotifyDatetime);}playbackTimeManager._pauseStart=playbackTimeManager.RESET_VALUE;}},reset:function() {playbackTimeManager.write("reset()");playbackTimeManager._lastNotifyDatetime=playbackTimeManager.RESET_VALUE;playbackTimeManager._stopping=false;if(typeof (playbackTimeManager._toutInstance)!="undefined")clearTimeout(playbackTimeManager._toutInstance);playbackTimeManager._toutInstance=undefined;playbackTimeManager._pauseStart=playbackTimeManager.RESET_VALUE;},notify:function() {var diff=playbackTimeManager.TOUT_SECS;if(playbackTimeManager._lastNotifyDatetime!=playbackTimeManager.RESET_VALUE) {var now=new Date();var msecDiff=now.getTime() - playbackTimeManager._lastNotifyDatetime.getTime();var secDiff=msecDiff / 1000;diff=Math.round(secDiff);}var hasValue=diff>0;var pause=playbackTimeManager._pauseStart!=playbackTimeManager.RESET_VALUE;if(typeof (playbackTimeManager.callbackNotification)!='undefined') {if(!pause) {if(hasValue) {playbackTimeManager.write("notify(),diff:" + diff + "secs,vid:" + playbackTimeManager._vid + ",from [" + playbackTimeManager._lastNotifyDatetime + "] to [" + now + "]");playbackTimeManager.callbackNotification(playbackTimeManager._vid,diff);}}}if(playbackTimeManager._lastNotifyDatetime!=playbackTimeManager.RESET_VALUE)if(!playbackTimeManager._stopping) {if(!pause)playbackTimeManager._lastNotifyDatetime=new Date();playbackTimeManager.launchTimeout();}},launchTimeout:function() {var msecs=playbackTimeManager.TOUT_SECS * 1000;playbackTimeManager._toutInstance=setTimeout("playbackTimeManager.notify()",msecs);},write:function(msg) {log(playbackTimeManager._objectName + "." + msg);}};playbackTimeManager.init();var BasePlaybackComponent=Class.create({className:'[js] BasePlaybackComponent',getClassName:function() {return this.className;},initialize:function() {},play:function() {},stop:function() {},pause:function() {},status:function() {},trace:function() {},setVideoByURL:function() {},setVideoByJsonConfiguration:function() {},_onPluginReady:function() {}});BasePlaybackComponent.prototype.object2string=function(obj) {MAX_LEN=40;res='';for (property in obj) {if(property=='toString')continue; val=('' + obj[property]).replace(/\n/g,' ').replace(/\r/g,'');if(val.length>MAX_LEN)val=val.substring(0,MAX_LEN) + '..';type=typeof (val);res += '\n\t |';res += '\n\t +->' + property + ' [' + type + ']=' + val;}return res;}if(!window.console||!console.firebug) {var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for (var i=0; i<names.length; ++i)window.console[names[i]]=function() {}}function log(level,message) {if(typeof(message)=='undefined')console.log(level);elseconsole.log("(level:" + level + ") " + message);}(function() {var id=0;var head=$$('head')[0];this.getJSON=function(url) {log('JSONP url:' + url);var script=document.createElement('script'),token='__jsonp' + id;script.src=url;if(!Object.isUndefined(head)){head.appendChild(script);}id++;}})();global=this;var BrowserDetect={init:function() {this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data) {for (var i=0; i<data.length; i++) {var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString) {if(dataString.indexOf(data[i].subString)!=-1)return data[i].identity;}else if(dataProp)return data[i].identity;}},searchVersion:function(dataString) {var index=dataString.indexOf(this.versionSearchString);if(index==-1) return;return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{ string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{ string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{ string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();var SilverlightTools={urlDecode:function(pString) {var res=unescape(pString.replace(/\+/g," "));return res;}};var AdvComponent=Class.create({_classname:"[js] AdvComponent",_advProviderUrl:"",_callbackFunction:undefined,_settings:{'type':'sl','mode':'normal','size':'512x288'},initialize:function(pSettings) {this._settings=pSettings;},isDefined:function(pObj) {return typeof pObj!='undefined';},getVideoUrlAsynch:function(pAdvVideoUrlPart,pCallbackFunction) {global.Ad=new AdvResponseObject(pCallbackFunction);var url=this.getOmnitureUrl(pAdvVideoUrlPart);log("getVideoUrlAsynch:" + url);getJSON(url);},getOmnitureUrl:function(pVideoUrlPart) {var url="http://ad.doubleclick.net/pfadx/" + this._settings.dcSite + "/" + pVideoUrlPart;var rndNumber=Math.random() * 1000000000;url += ";ord=" + rndNumber;url += ";format=wmv";url=url.replace(/PLAYER/g,this._settings.type);url=url.replace(/MODE/g,this._settings.mode);url=url.replace(/SIZE/g,this._settings.size);log(this._classname + ".getOmnitureUrl():" + url);return url;}});function AdvResponseObject(pCallback) {log(this._classname + ".AdvResponseObject(),ctor");this._callbackFunction=pCallback;}AdvResponseObject.prototype._classname="AdvResponseObject";AdvResponseObject.prototype.evtAdvJsonLoaded=function(pJson) {};AdvResponseObject.prototype.Load=function(pAdvJson) {log(this._classname + ".Load(pAdvJson)");var isOK=typeof pAdvJson!='undefined'&&typeof pAdvJson.Preroll!='undefined';if(isOK) {this._callbackFunction(pAdvJson.Preroll,pAdvJson.CoAdLink);Prototype.Browser.IE7=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==7;if(!Object.isUndefined(this.evtAdvJsonLoaded)) {this.evtAdvJsonLoaded(pAdvJson);}try {if(window.attachEvent) window.attachEvent("onload",function() {var imageElement=new Element('img',{'src':pAdvJson.StartPlayImage});document.body.appendChild(imageElement);});} catch (err) {}}};var SilverlightPlaybackComponent=Class.create(BasePlaybackComponent,{_classname:"[js] SilverlightPlaybackComponent",config:undefined,slContainer:undefined,slObject:undefined,videoMetadata:undefined,videoMetadataString:undefined,initialize:function($super,confObject) {this.config=confObject;base=new BasePlaybackComponent();log(this._classname + '.initialize() ' + base.object2string(confObject));},buildPlayer:function() {var html="";var playerHTML=""this.slContainer=$(this.config.containerID);var paramMetricSecs='';if(this.config.metricsInSec!=undefined)paramMetricSecs=',metricsInSec=' + this.config.metricsInSec;var paramMetricPerc='';if(this.config.metricsInPerc!=undefined)paramMetricPerc=',metricsInPerc=' + this.config.metricsInPerc;var paramAutostart='';if(this.config.autostart!=undefined)paramAutostart=',autostart=' + this.config.autostart;var vocString='';if(this.config.voc!=undefined)vocString=',voc=' + this.config.voc;var debugModeString=1;if(this.config.debugMode!=undefined)debugModeString=',debugMode=' + this.config.debugMode;eval('window.onPluginReady_' + this.config.playerID.toString() + '=(function(){this._onPluginReady()}).bind(this)');var isSafari=BrowserDetect.browser.toLowerCase()=='safari';var altImg='/img/videopage/GetSirverlight_home.jpg';if(this.config.altImg!=undefined) altImg=this.config.altImg;playerHTML='<object id="' + this.config.playerID + '" data="data:application/x-silverlight," \type="application/x-silverlight-2" width="100%" height="100%"> \<param name="source" value="' +this.config.urlXAP +'" /> \<param name="maxframerate" value="25" />     \<param name="background" value="transparent" />    \<param name="enablehtmlaccess" value="1" />     \<param name="windowless" value="' + (isSafari ? '0':'1') + '" />      \<param name="initParams" value="mode=normal' +debugModeString +vocString +paramMetricSecs +paramMetricPerc +paramAutostart +'"/>\<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration:none;">\<img src="' + altImg + '" \alt="Get Microsoft Silverlight"       \style="border-style:none"/>      \</a>              \</object>              \<iframe style="visibility:hidden;height:0;width:0;border:0px"></iframe>';log(this._classname + ".buildPlayer() " + playerHTML)this.slContainer.innerHTML=playerHTML;this.slContainer=$(this.config.containerID);this.slObject=$(this.config.playerID);},setVideoByURL:function(videoMetadata) {log('SilverlightPlaybackComponent:setVideo');this.videoMetadata=videoMetadata;var videoUri=this.videoMetadata.streams.sl.high;this.slObject.Content.SLOrchestrator.SetMainVideoByURL(videoUri.toString());},setVideoByJsonConfiguration:function(pJsonConfigString) {this.videoMetadataString=pJsonConfigString;this.videoMetadata=pJsonConfigString.evalJSON(true);this._addPlaylistJSON(this.videoMetadataString);},setAdv:function(pAdvVideoUrl,pAdvLink) {log(this._classname + ".setAdv(pAdvVideoUrl:" + pAdvVideoUrl + ",pAdvLink:" + pAdvLink + ") ");if(this.slObject.Content.SLOrchestrator) this.slObject.Content.SLOrchestrator.SetMainVideoByAdv(pAdvVideoUrl,pAdvLink);},_addPlaylistJSON:function(pJsonConfString) {log(this._classname + "._addPlaylistJSON() ");this.slObject.Content.SLOrchestrator.SetMainVideoByJSON(pJsonConfString);},getLastJsonConfigString:function() {var lastString=this.slObject.Content.SLOrchestrator.GetLastJsonConfigString();return lastString;},start:function() {this.slObject.Content.SLOrchestrator.StartMainVideo();},play:function() {this.slObject.Content.SLOrchestrator.PlayMainVideo();},playAt:function(pPositionSeconds) {log(this._classname + ".playAt(secs:" + pPositionSeconds + ")");this.slObject.Content.SLOrchestrator.PlayMainVideoAt(pPositionSeconds);},pause:function() {this.slObject.Content.SLOrchestrator.PauseMainVideo();},stop:function() {this.slObject.Content.SLOrchestrator.StopMainVideo();},clearPlaylist:function() {var defined=!Object.isUndefined(this.slObject);var defined=defined&&!Object.isUndefined(this.slObject.Content);var defined=defined&&!Object.isUndefined(this.slObject.Content.SLOrchestrator);if(defined) this.slObject.Content.SLOrchestrator.ClearMainVideoPlaylist();},injectVideo:function(videoUrl,videoKind) {log("(" + this._classname + ".injectVideo(..)");this.slObject.Content.SLOrchestrator.InjectVideo(videoUrl,videoKind);},_registerEvents:function() {this.slObject.Content.SLOrchestrator.OnMainVideoStatusChanged=this._onMainVideoStatusChanged.bind(this);this.slObject.Content.SLOrchestrator.OnMainVideoPlay=this._onMainVideoPlay.bind(this);this.slObject.Content.SLOrchestrator.OnMainVideoStopped=this._onMainVideoStopped.bind(this);this.slObject.Content.SLOrchestrator.OnMainVideoOpened=this._onVideoOpened.bind(this);this.slObject.Content.SLOrchestrator.OnVideoTickInSecReached=this._onVideoTickInSecReached.bind(this);this.slObject.Content.SLOrchestrator.OnTraffickingPercentageReached=this._onTraffickingPercentageReached.bind(this);this.slObject.Content.SLOrchestrator.OnInjectedVideoStarted=this._onInjectedVideoStarted.bind(this);this.slObject.Content.SLOrchestrator.OnInjectedVideoEnded=this._onInjectedVideoEnded.bind(this);},status:function() {return this.slObject.Content.SLOrchestrator.GetStatus();},statusCode2String:function(statusCode) {log(this._classname + ".statusCode2String(" + statusCode + ")");var mapping=['Unknown','Ready','Buffering','Playing','Stopped','Paused','Error'];return mapping[statusCode];},onAppStarted:function() {},_onMainVideoPlay:function(sender,args) {log(this._classname + "._onMainVideoPlay()");this.onVideoPlay(args.videoid);},onVideoPlay:function(pVideoId) {},_onVideoOpened:function(sender,args) {var videoid=args.videoid;log(this._classname + "._onVideoOpened(pVideoId:" + videoid + ")");var isAutostart=this.config.autostart>0;this.onVideoOpened(videoid,isAutostart);},onVideoOpened:function(pVideoId,pIsAutostart) { },onVideoPaused:function() {},onInjectedVideoStarted:function() {},onInjectedVideoEnded:function() {},_onMainVideoStopped:function(sender,args) {var videoid=args.videoid;log(this._classname + "._onMainVideoStopped(pVideoId:" + videoid + ")");this.onVideoStopped(videoid);},onVideoStopped:function(videoid) {},_onMainVideoStatusChanged:function(sender,args) {var statusCode=args.Value; var sStatus=this.statusCode2String(statusCode);log("" + this._classname + "._onMainVideoStatusChanged() " + sStatus);this.onMainVideoStatusChanged(sStatus);},onMainVideoStatusChanged:function(sStatus) {},_onVideoTickInSecReached:function(sender,args) {var secs=args.value;var videoid=args.videoid;this.onTraffickingSecondsReached(videoid,secs);},onTraffickingSecondsReached:function(pVideoId,pSecValue) { },_onTraffickingPercentageReached:function(sender,args) {var percentage=args.value;var videoid=args.videoid;this.onTraffickingPercentageReached(videoid,percentage);},onTraffickingPercentageReached:function(pVideoId,pPercvalue) { },_onInjectedVideoStarted:function(sender,args) {log("" + this._classname + "._onInjectedVideoStarted()");this.onInjectedVideoStarted();},_onInjectedVideoEnded:function(sender,args) {log("" + this._classname + "._onInjectedVideoEnded()");this.onInjectedVideoEnded();},getVideoTimelineVal:function() {var res=this.slObject.Content.SLOrchestrator.GetVideoTimelineVal();return res;},_onPluginReady:function() {log(this._classname + "._onPluginReady()");this._registerEvents();this.onAppStarted();}});function omniVideoSetMetrics(){omniProcessing();s.server=metAdd[0];s.channel=metAdd[1];s.eVar38=s.channel;s.eVar1=metAdd[2];s.eVar2=metAdd[3];s.eVar3=metAdd[4];s.eVar4=vp.getJsonLastVideoConfig().metrics[0];s.eVar5=vp.getJsonLastVideoConfig().metrics[1];s.eVar6=vp.getJsonLastVideoConfig().metrics[2];s.eVar7=vp.getJsonLastVideoConfig().metrics[3];s.eVar8=vp.getJsonLastVideoConfig().metrics[4];s.eVar9=vp.getJsonLastVideoConfig().metrics[5];s.eVar10=vp.getJsonLastVideoConfig().metrics[6];s.eVar11=vp.getJsonLastVideoConfig().metrics[7];s.eVar12=vp.getJsonLastVideoConfig().metrics[8];s.prop13=vp.getJsonLastVideoConfig().metrics[9];s.prop14=vp.getJsonLastVideoConfig().metrics[10];s.prop15=vp.getJsonLastVideoConfig().metrics[11];s.eVar32=vp.getJsonLastVideoConfig().metrics[18];s.eVar33=vp.getJsonLastVideoConfig().metrics[19];}function omnitureLog(pOmnitureEvent){if(typeof log=='function') {log("omnitureVideo.js>" + pOmnitureEvent + " - events:" + s.events);}}function callST(){try {s.t();} catch(error) {omnitureLog("ERROR:"+error);}}function omniVideoStart(videoId,manualStart){if(videoId==-1) return;omniVideoSetMetrics();if(manualStart==true) {s.events='event6';}else {s.events='event7';}omnitureLog('omniVideoStart');callST();return;}function omniVideoFinish(videoId){if(videoId==-1) return;omniVideoSetMetrics();s.events='event8';omnitureLog('omniVideoFinish');callST();return;}function omniVideoPercentage(videoId,percentage){if(videoId==-1) return;omniVideoSetMetrics();switch (percentage) {case 20:s.events='event9';break;case 40:s.events='event10';break;case 60:s.events='event11';break;case 80:s.events='event12';break;default:omnitureLog('omniVideoPercentage - ERROR percentage received:' + percentage);break;}omnitureLog('omniVideoPercentage');callST();return;}function omniVideoMinuteIncr(videoId,msecondsPlayed){if(videoId==-1) return;omniVideoSetMetrics();s.events='event13';s.products=';;;;event13='+msecondsPlayed+',';omnitureLog('omniVideoMinuteIncr');callST();s.products='';return;}var VideoPlayerEmbedded={_videoHomePageToPlayAfterCreation:undefined,_videoPlayerInstance:undefined,_videoConfig:undefined,init:function(pConfigObject){this._videoConfig=pConfigObject;},play:function(pJsonUrl){if(this._videoPlayerInstance===undefined) {this._videoHomePageToPlayAfterCreation=pJsonUrl;this._videoPlayerInstance=new VideoPlayer(this._videoConfig);this._videoPlayerInstance.addEventHandler('evtAppStarted',this.onStarted.bind(this));this._videoPlayerInstance.addEventHandler('evtVideoFinished',this.onFinished.bind(this));if(typeof vp=='undefined')vp=this._videoPlayerInstance;this._videoPlayerInstance.addEventHandler('evtVideoStarted',omniVideoStart);this._videoPlayerInstance.addEventHandler('evtVideoFinished',omniVideoFinish);this._videoPlayerInstance.addEventHandler('evtVideoPercReceived',omniVideoPercentage);this._videoPlayerInstance.addEventHandler('evtVideoStarted',playbackTimeManager.onStart);this._videoPlayerInstance.addEventHandler('evtVideoFinished',playbackTimeManager.onStop);playbackTimeManager.callbackNotification=omniVideoMinuteIncr;}else {this.startVideoFromJsonUrl(pJsonUrl);}return false;},onFinished:function(pVideoId){if(typeof globalAdvJsonConfigObject!='undefined') {try {var imageElement=new Element('img',{'src':globalAdvJsonConfigObject.EndPlayImage});globalAdvJsonConfigObject=undefined;document.body.appendChild(imageElement);}catch (err) {}}},startVideoFromJsonUrl:function(pJsonUrl){if(!this._videoPlayerInstance.getInfoIsCurrentAdv()) {this._videoPlayerInstance.setVideoFromJSON2(pJsonUrl);}},onStarted:function(){if(typeof this._videoHomePageToPlayAfterCreation=='undefined')return;this._videoPlayerInstance.setVideoFromJSON2(this._videoHomePageToPlayAfterCreation);this._videoHomePageToPlayAfterCreation=undefined;}};if(typeof AdvResponseObject!='undefined') {AdvResponseObject.prototype.evtAdvJsonLoaded=function(pJson){if(typeof pJson!='undefined') {globalAdvJsonConfigObject=pJson;}};}var undefined;var CTVVideoLibraryOTBHandler={videoList:undefined,actualVideoListName:undefined,canvas:undefined,entryTemplate:undefined,resultSummaryTemplate:undefined,enablePick:false,enablePlay:false,containerHeight:353,runtimeHeight:0,animationSmoothness:20,animationSpeed:10,animationThread:null,animationRunning:false,sportCanvas:null,libraryParamName:"lib",isInserted:true,lastParameter:null,getLibraryParam:function() {var querystring=new String(window.location.search);if(querystring=="") return "";var tmp=querystring.substr(1).split("&");for(var i=0,len=tmp.length; i<len; i++) {var paramInfo=tmp[i].split("=");if(paramInfo[0]==this.libraryParamName) return paramInfo[1];}return "";},initialize:function(canvas,videoListsNames) {this.videoList=new CTVVideoListsHandler(videoListsNames);this.canvas=new Object();for(var i=0,len=videoListsNames.length; i<len; i++)this.canvas[videoListsNames[i]]=canvas[i];},add:function(listName,id,title,description,imageUrls,source,isInserted) {this.videoList.add(listName,id,title,description,imageUrls,source);if(listName==this.actualVideoListName) this.render();},playIt:function(index) {var list=this.videoList.getList(this.actualVideoListName);if(!list) return;for(var i=0,len=list.length; i<len; i++){if(i!=index) $('videoEntry_'+list[i].id).removeClassName('ctvo_EntryOTBSelected');else{$('videoEntry_'+list[index].id).addClassName('ctvo_EntryOTBSelected');CTVVideoPlayerOTBHandler.play(list[index].id);}}},playNext:function(id){var list=this.videoList.getList(this.actualVideoListName);for(var i=0,len=list.length; i<len; i++){if(list[i].id==id) {if(list[i+1]) this.playIt(i+1);return;}}},setPlaying:function(id) {},setPlayed:function(id) {},loadVideoIn:function(parameter,canvas) {if(this.lastParameter!=parameter){this.lastParameter=parameter;var d=new Date();var t=this;var ar=new Ajax.Request("/over-the-bolts/episode=" + parameter + "/list.html?t="+d.getTime(),{method:'get',onComplete:function(transport) {CTVVideoLibraryOTBHandler.videoList.flushIt("videoGallery");CTVVideoLibraryOTBHandler.canvas=canvas;var list=eval(transport.responseText);for(var i=0,len=list.length; i<len; i++)CTVVideoLibraryOTBHandler.videoList.add("videoGallery",list[i].id,list[i].title,list[i].description,[list[i].imageUrl,list[i].thumbUrl],"");CTVVideoLibraryOTBHandler.renderDetail(list,canvas);CTVVideoLibraryOTBHandler.playIt(0);}});}},renderDetail:function(list,canvas){var _html="";for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$title/g,list[i].title);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$imageUrl/g,list[i].imageUrl);htmlEntry=htmlEntry.replace(/\$source/g,list[i].source);htmlEntry=htmlEntry.replace(/\$index/g,i);htmlEntry=htmlEntry.replace(/\$assetId/g,list[i].id);_html += htmlEntry;}$(canvas).update(_html);},render:function(videoListName) {try {var toShow=this.canvas[videoListName];var toHide=(this.actualVideoListName===undefined)? undefined:this.canvas[this.actualVideoListName];if(this.np>=0) {toShow.style.height=(this.runtimeHeight - this.np - 3) + 'px';toShow.style.marginBottom='3px';if(!(toHide===undefined)) toHide.style.height=this.np + 'px';this.np -= this.animationSmoothness;}else{clearInterval(this.animationThread);if(!(toHide===undefined)) {toHide.style.display='none';toHide.style.visibility='hidden';toHide.style.height='0px';}toShow.style.height=this.runtimeHeight + 'px';this.actualVideoListName=videoListName;this.animationRunning=false;}} catch(e) {clearInterval(this.animationThread);this.animationRunning=false;}}};var CTVVideoRelatedContentOTBHandler={canvas:null,entryTemplate:null,emptyTemplate:null,initialize:function(canvas,emptyTemplate) {this.canvas=canvas;this.canvas.ancestors()[0].hide();this.emptyTemplate=emptyTemplate;},setPlaying:function(relatedContent) {if(this.canvas) this.render(relatedContent);},setPlayed:function(relatedContent) {if(this.canvas) this.canvas.update('');},open:function(url) {if(window.opener==null)window.location=url;elsewindow.opener.location=url;},render:function(list) {var html="";if(list===undefined) html += this.emptyTemplate;else {if(list.length==0){html += this.emptyTemplate;this.canvas.ancestors()[0].hide();}else this.canvas.ancestors()[0].show();for(var i=0,len=list.length; i<len; i++) {var htmlEntry=new String(this.entryTemplate);htmlEntry=htmlEntry.replace(/\$description/g,list[i].description);htmlEntry=htmlEntry.replace(/\$url/g,list[i].url);html += htmlEntry;}this.canvas.update(html);}}};var CTVVideoPlayerOTBHandler={playerHandler:undefined,sourcePath:undefined,actualVideoId:undefined,videoOnDemand:false,libraryParamName:"assetid",videoList:undefined,reloaded:false,getPlayerParam:function() {var querystring=new String(window.location.search);if(querystring=="") return "";var tmp=querystring.substr(1).split("&");for(var i=0,len=tmp.length; i<len; i++) {var paramInfo=tmp[i].split("=");if(paramInfo[0]==this.libraryParamName) return paramInfo[1];}return "";},initialize:function(playerHandler,sourcePath) {this.playerHandler=playerHandler;this.sourcePath=sourcePath;this.videoList=new CTVVideoListsHandler("editor");this.attachEvents();},attachEvents:function() {var playerHandler=this.playerHandler;var onPluginStarted=function() {var playThis=CTVVideoPlayerOTBHandler.getPlayerParam();if(playThis!=""){CTVVideoPlayerOTBHandler.videoOnDemand=true;CTVVideoPlayerOTBHandler.play(playThis);}};var onVideoStarted=function(videoId) {if(videoId<0) return;var config=playerHandler.getJsonCurrentVideoConfig();if(config===undefined) return;if(config.streams===undefined) return;if(CTVVideoPlayerOTBHandler.videoOnDemand) {CTVVideoPicksHandler.add("user",config.streams.assetID,unescape(config.title),unescape(config.description),[config.thumbnails.large,config.thumbnails.small],config.metrics[4]);CTVVideoPlayerOTBHandler.videoOnDemand=false;}CTVVideoRelatedContentOTBHandler.setPlaying(config.relatedContent);CTVVideoLibraryOTBHandler.setPlaying(config.streams.assetID);};var onVideoFinished=function(videoId) {if(videoId<0) return;var config=playerHandler.getJsonLastVideoConfig();if(config===undefined) return;if(config.streams===undefined) return;CTVVideoRelatedContentOTBHandler.setPlayed(config.relatedContent);CTVVideoLibraryOTBHandler.setPlayed(config.streams.assetID);if(CTVVideoPlayerOTBHandler.actualVideoId==config.streams.assetID){CTVVideoLibraryOTBHandler.playNext(CTVVideoPlayerOTBHandler.actualVideoId);}};playerHandler.addEventHandler('evtAppStarted',onPluginStarted);playerHandler.addEventHandler('evtVideoStarted',onVideoStarted);playerHandler.addEventHandler('evtVideoFinished',onVideoFinished);},createJsonPath:function(videoId) {videoId=new String(videoId);var tmp=this.sourcePath;for(var i=0,len=videoId.length; i<len; i=i+4)tmp += '/' + videoId.substr(i,4);return tmp+ '/asset.txt';},play:function(videoId,assetFile) {if(videoId===undefined) return;if(videoId=="") return;this.actualVideoId=videoId;try{var jsonPath=assetFile ? assetFile:this.createJsonPath(videoId);var player=this.playerHandler;if(!player.getInfoIsCurrentAdv()) player.setVideoFromJSON2(jsonPath);}catch(e){window.LoadVideo(videoId,'TwoColumnsSf',true,null,'2');}},playStatic:function(jsonPath){var player=this.playerHandler;player.setVideoFromJSON2(jsonPath);},pause:function() {this.playerHandler.pause();},getVideoShareUrl:function() {if(this.playerHandler==null) return "";var tmp=this.playerHandler.getJsonCurrentVideoConfig();if(tmp===undefined) return "";return tmp.shareUrl;},getVideoTitle:function() {if(this.playerHandler==null) return "";var tmp=this.playerHandler.getJsonCurrentVideoConfig();if(tmp===undefined) return "";return unescape(tmp.title);}};
