Function.prototype.createDelegate=function(C,B,A){var E=this;return function(){var G=B||arguments;if(A===true){G=Array.prototype.slice.call(arguments,0);G=G.concat(B)}else{if(typeof A=="number"){G=Array.prototype.slice.call(arguments,0);var F=[A,0].concat(B);Array.prototype.splice.apply(G,F)}}return E.apply(C||window,G)}};String.prototype.toCharCode=function(){var C=this.split("");var A=new Array(C.length);for(var B=0;B<C.length;B++){A[B]=C[B].charCodeAt(0)}return A.join(",")};Date.prototype.dayStrings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.prototype.monthStrings=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.prototype.getDayString=function(){return this.dayStrings[this.getDay()]};Date.prototype.getMonthString=function(){return this.monthStrings[this.getMonth()]};Date.prototype.addDays=function(A){this.setDate(this.getDate()+A);return this};Date.prototype.addHours=function(A){this.setHours(this.getHours()+A);return this};Date.prototype.addMonths=function(A){this.setMonth(this.getMonth()+A);return this};function getDayDropDown(C,E){var B='<select id="'+E+'">';for(var A=1;A<=31;A++){B+='<option value="'+A+'"';if(A==C.getUTCDate()){B+=" selected"}B+=">"+A+"</option>"}B+="</select>";return B}function getMonthDropDown(C,E){var B='<select id="'+E+'">';for(var A=0;A<12;A++){B+='<option value="'+A+'"';if(A==C.getMonth()){B+=" selected"}B+=">"+C.monthStrings[A].slice(0,3)+"</option>"}B+="</select>";return B}function getYearDropDown(C,F,E){var B='<select id="'+F+'">';for(var A=C.getFullYear()-E;A<=C.getFullYear();A++){B+='<option value="'+A+'"';if(A==C.getFullYear()){B+=" selected"}B+=">"+A+"</option>"}B+="</select>";return B}function copyProps(G,C){var A={};if(G){try{for(var B=0;B<C.length;B++){var F=C[B];if(C[B]&&typeof (G[C[B]])!="null"){A[C[B]]=G[C[B]]}}}catch(E){}}return A}function makeElement(A){var C=document.createElement(A.tagName||"div");for(var B in A){if(B!="parent"&&B!="tagName"){C[B]=A[B]}}if(typeof (A.parent)=="string"){A.parent=D(A.parent)}(A.parent||document.body).appendChild(C);return C}function absoluteX(B){var A=0;var C=B;while(C&&C!=document.documentElement){A-=C.scrollLeft||0;C=C.parentNode}var C=B;while(C){A+=C.offsetLeft||0;C=C.offsetParent}return A}function absoluteY(B){var A=0;var C=B;while(C&&C!=document.documentElement){A-=C.scrollTop||0;C=C.parentNode}var C=B;while(C){A+=C.offsetTop||0;C=C.offsetParent}return A}function formatTime(E){var A=Math.floor(E/3600)+"";if(A.length==1){A="0"+A}var C=Math.floor(E%3600/60)+"";if(C.length==1){C="0"+C}var B=(E%60)+"";if(B.length==1){B="0"+B}return A+":"+C+":"+B}function longUnixTimeToString(F,B){if(B==null){B=true}var H=new Date(F);var E=String("0"+H.getHours()).slice(-2);var A=String("0"+H.getMinutes()).slice(-2);var C=String("0"+H.getSeconds()).slice(-2);var G=E+":"+A;if(B){G=G+":"+C}return G}function configureForBrowser(){window.isIE=false;window.isIE6=false;window.isIE7=false;window.isIE8=false;window.isSafari=false;window.isFirefox=false;window.isIpod=false;window.browserDetected=true;if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){window.isIE=true;getEltContent=ie_getEltContent;selectMultiElements=ie_selectMultiElements;selectElement=ie_selectElement;var A=new Number(RegExp.$1);window.isIE8=A<9&&A>=8;window.isIE7=A<8&&A>=7;window.isIE6=A<7&&A>=6}else{if(navigator.appVersion.indexOf("Safari")!=-1){window.isSafari=true;getEltContent=safari_getEltContent;selectMultiElements=ns_selectMultiElements;selectElement=ns_selectElement}else{window.isFirefox=true;getEltContent=ns_getEltContent;selectMultiElements=ns_selectMultiElements;selectElement=ns_selectElement}}window.isWindows=navigator.platform.toLowerCase().indexOf("win")!=-1;window.isMac=navigator.platform.toLowerCase().indexOf("mac")!=-1;window.isLinux=navigator.platform.toLowerCase().indexOf("lin")!=-1;window.isIpod=navigator.userAgent.match(/(iPhone|iPod|BlackBerry)/)}function ns_getEltContent(C,B){var A=C.getElementsByTagName(B);return A.length>0?A[0].textContent:""}function safari_getEltContent(C,B){var A=C.getElementsByTagName(B);return A[0]&&A[0].firstChild?A[0].firstChild.nodeValue:""}function ie_getEltContent(C,B){var A=C.selectSingleNode(B);return A&&A.firstChild?A.firstChild.nodeValue:""}function ns_selectMultiElements(B,A){return B.getElementsByTagName(A)}function ie_selectMultiElements(B,A){if(!B){return new Array()}return B.selectNodes(A)}function ns_selectElement(B,A){return B.getElementsByTagName(A)[0]}function ie_selectElement(B,A){if(!B){return null}return B.selectSingleNode(A)}function D(A){return document.getElementById(A)}function getContent(A){if(!A||!A.firstChild){return""}else{if(A.childNodes.length>1){return A.childNodes[1].nodeValue}else{return A.firstChild.nodeValue}}}function getElementsByClass(F,H,A){var E=new Array();if(F==null){F=document}if(A==null){A="*"}var C=F.getElementsByTagName(A);var B=C.length;var G=new RegExp("(^|\\s)"+H+"(\\s|$)");for(i=0,j=0;i<B;i++){if(G.test(C[i].className)){E[j]=C[i];j++}}return E}function debug(E){var A="";if(typeof (E)=="object"){A+=E+"\n";try{for(var B in E){A+="  "+B+" => "+E[B]+"\n"}}catch(C){}}else{A+=E+"\n"}if(window.console){console.log(A)}if(D("debug")){D("debug").innerHTML+=A+"<br />"}return A}function setCapture(A){if(A.setCapture){A.setCapture()}else{if(!window.fakeCaptureInstalled){window.addEventListener("mousemove",function(B){if(window.fakeCaptureEl&&B.target!=window.fakeCaptureEl){window.fakeCaptureEl.onmousemove(B);preventDefault(B)}},false);window.addEventListener("mouseup",function(B){if(window.fakeCaptureEl&&B.target!=window.fakeCaptureEl){window.fakeCaptureEl.onmouseup(B);preventDefault(B)}},false)}window.fakeCaptureEl=A}}function releaseCapture(A){if(A.releaseCapture){A.releaseCapture()}else{window.fakeCaptureEl=null}}function preventDefault(A){for(i in ["preventDefault","cancelBubble","stopPropagation"]){if(A[i]){A[i]()}}}function setCookie(C,B,E){var A=new Date();A.setDate(A.getDate()+E);document.cookie=C+"="+escape(B)+((E==null)?"":";expires="+A.toGMTString())}function getCookie(B){if(document.cookie.length>0){var A=document.cookie.indexOf(B+"=");if(A!=-1){A=A+B.length+1;cookieEnd=document.cookie.indexOf(";",A);if(cookieEnd==-1){cookieEnd=document.cookie.length}return unescape(document.cookie.substring(A,cookieEnd))}}return null}function deleteCookie(A){setCookie(A,"",-1)}var cbSplit;if(!cbSplit){cbSplit=function(J,G,F){if(Object.prototype.toString.call(G)!=="[object RegExp]"){return cbSplit._nativeSplit.call(J,G,F)}var C=[],A=0,E=(G.ignoreCase?"i":"")+(G.multiline?"m":"")+(G.sticky?"y":""),G=RegExp(G.source,E+"g"),B,H,I,K;J=J+"";if(!cbSplit._compliantExecNpcg){B=RegExp("^"+G.source+"$(?!\\s)",E)}if(F===undefined||+F<0){F=Infinity}else{F=Math.floor(+F);if(!F){return[]}}while((H=G.exec(J))){I=H.index+H[0].length;if(I>A){C.push(J.slice(A,H.index));if(!cbSplit._compliantExecNpcg&&H.length>1){H[0].replace(B,function(){for(var L=1;L<arguments.length-2;L++){if(arguments[L]===undefined){H[L]=undefined}}})}if(H.length>1&&H.index<J.length){Array.prototype.push.apply(C,H.slice(1))}K=H[0].length;A=I;if(C.length>=F){break}}if(G.lastIndex===H.index){G.lastIndex++}}if(A===J.length){if(K||!G.test("")){C.push("")}}else{C.push(J.slice(A))}return C.length>F?C.slice(0,F):C};cbSplit._compliantExecNpcg=/()??/.exec("")[1]===undefined;cbSplit._nativeSplit=String.prototype.split}String.prototype.split=function(B,A){return cbSplit(this,B,A)};var debugstr;var dodgyreferences={};var cacheTimes={};function handleAjaxXml(C){var B=C.responseXML.getElementsByTagName("serialized")[0];debug(getContent(C.responseXML.getElementsByTagName("message")[0]));var A=new Object();unserialize(B,A);return A}function loadXMLDoc(E,H,G,B,F){var A=Math.random();var C=function(){doReadyStateChange(A,H,B)};(function(){if(window.XMLHttpRequest){var I=new XMLHttpRequest()}else{if(window.ActiveXObject){var I=new ActiveXObject("Microsoft.XMLHTTP")}}if(I){dodgyreferences[A]={};dodgyreferences[A].URL=E;dodgyreferences[A].xhr=I;I.onreadystatechange=C;if(F){if(E.indexOf("?")>-1){E+="&"}else{E+="?"}E+="_emCBx="+Math.round(Math.random()*100000)}I.open("GET",E,G);if(cacheTimes[E]&&!F){I.setRequestHeader("If-Modified-Since",cacheTimes[E].toGMTString())}else{I.setRequestHeader("If-Modified-Since",(new Date(0)).toGMTString())}try{I.send(null)}catch(J){if(B){B(I)}}}})()}function doReadyStateChange(A,C,B){var E=dodgyreferences[A].xhr;if(!E||!E.readyState){return }if(self.showStatus){if(E.readState==4||!isIE){showStatus(E.responseText.length+" bytes loaded")}}if(E.readyState==4){try{if(E.status&&(E.status==200||E.status==304)){if(C){if(E.status==200){var F=new Date(E.getResponseHeader("Last-Modified"));if(F+""!="NaN"){cacheTimes[dodgyreferences[A].URL]=F}else{if(!cacheTimes[dodgyreferences[A].URL]){cacheTimes[dodgyreferences[A].URL]=new Date(0)}}}C(E,dodgyreferences[A].URL)}}else{if(B){B(E,dodgyreferences[A].URL)}else{}}}finally{E=null;if(dodgyreferences[A]){delete (dodgyreferences[A])}}}}function unserialize(C,A){for(var E=0;E<C.childNodes.length;E++){var F=C.childNodes[E];if(F.nodeType!=1){continue}var B=F.getAttribute("name");if(String(B).match("^[^a-zA-Z]")){B="_"+B}if(F.tagName=="object"){A[B]=new Object();unserialize(F,A[B])}else{A[B]=getContent(F)}}}var mediaPlayerStates={PS_UNDEFINED:0,PS_STOPPED:1,PS_PAUSED:2,PS_PLAYING:3,PS_SCANFORWARD:4,PS_SCANREVERSE:5,PS_BUFFERING:6,PS_WAITING:7,PS_MEDIAENDED:8,PS_TRANSITIONING:9,PS_READY:10,PS_RECONNECTING:11,PS_UNKNOWN:12};function translateWMP6PlayState(A){switch(A){case 0:return mediaPlayerStates.PS_STOPPED;break;case 1:return mediaPlayerStates.PS_PAUSED;break;case 2:return mediaPlayerStates.PS_PLAYING;break;case 3:return mediaPlayerStates.PS_WAITING;break;case 4:return mediaPlayerStates.PS_SCANFORWARD;break;case 5:return mediaPlayerStates.PS_SCANREVERSE;break;default:return mediaPlayerStates.PS_UNDEFINED}}function translateVLCPlayState(A){switch(A){case 0:return mediaPlayerStates.PS_READY;break;case 1:return mediaPlayerStates.PS_WAITING;break;case 2:return mediaPlayerStates.PS_BUFFERING;break;case 3:return mediaPlayerStates.PS_PLAYING;break;case 4:return mediaPlayerStates.PS_PAUSED;break;case 5:return mediaPlayerStates.PS_TRANSITIONING;break;case 6:case 7:return mediaPlayerStates.PS_PLAYING;break;case 8:return mediaPlayerStates.PS_MEDIAENDED;break;case 9:return mediaPlayerStates.PS_READY;break}}function handleMissingPlugin(C){var E,B;if(isWindows){E="windows"}else{if(isMac){E="mac"}else{if(isLinux){E="linux"}else{E="other"}}}if(isIE){B="ie"}else{if(isFirefox){B="firefox"}else{if(isSafari){B="safari"}else{B="other"}}}if(!C){C="wmp"}var A="http://www.encodedmedia.com/plugins/"+E+"-"+B+"-"+C;return'<div id="vl_genMediaPlayer"><p>You require a plugin to view the media on this page.</p><p><b><a href='+A+' target="_blank">Download the recommended plugin now</a>.</b></p>'}function forcePlugin(){var A=window.open();A.document.write('<html><head><link rel="stylesheet" href="../common3/all.css"><link rel="stylesheet" href="main.css"><title>Plugin Install</title></head><body><embed style="visibility: hidden" type="application/x-ms-wmp" data="missing.wmv"></embed><p class="vl_pluginmsg">Click the "Install Missing Plugins" button above. If you cannot see a yellow bar above this text, <a href="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx">click here</a> to manually install the plugin.</p><p class="vl_pluginmsg"> Close this window once the plugin is installed.</p></body></html>');A.document.close()}function makePlayerWrapper(elt,isMpeg2,forceVLC){var p={elt:elt,vlcPlaylistId:-1,isAlive:function(){switch(this.type){case"ie":return true;case"fx":return typeof (this.elt.controls)!="undefined";case"flip4mac":case"wmp6":return typeof (this.elt.Play)!="undefined";case"vlc2":return typeof (this.elt.video)!="undefined"}},getCurrentPosition:function(){switch(this.type){case"ie":case"fx":if(this.isAlive()){return this.elt.controls.currentPosition}else{return -1}break;case"flip4mac":case"wmp6":return this.elt.CurrentPosition;case"vlc2":return this.elt.input.time/1000}},setCurrentPosition:function(pos){switch(this.type){case"ie":case"fx":this.pendingProps["controls.currentPosition"]=pos;break;case"flip4mac":case"wmp6":this.pendingProps.CurrentPosition=pos;break;case"vlc2":this.pendingProps["input.time"]=Math.round(pos*1000);break}this.doPending()},unicastPort:1024+Math.round(Math.random()*(65535-1024)),unicastKeepalive:function(req){try{eval("var resp = "+req.responseText)}catch(e){resp={success:false,message:"Unknown error"}}if(resp.success){if(this.realUnicastUrl&&!this.unicastTimeoutHandle){this.unicastTimeoutHandle=setTimeout(function(){this.unicastTimeoutHandle=null;if(!this.realUnicastUrl){return }var url=this.realUnicastUrl.substr(this.realUnicastUrl.indexOf("://")+2)+"&port="+this.unicastPort;loadXMLDoc(url,this.unicastKeepalive.createDelegate(this),true,null,true)}.createDelegate(this),20000)}}else{alert(resp.message)}},setUrl:function(url){if(this.unicastTimeoutHandle){clearTimeout(this.unicastTimeoutHandle);this.unicastTimeoutHandle=null}if(url&&url.indexOf("emudp://")!=-1){this.realUnicastUrl=url;loadXMLDoc(url.substr(url.indexOf("://")+2)+"&port="+this.unicastPort,this.unicastKeepalive.createDelegate(this),true,null,true);url="emcast://0.0.0.0:"+this.unicastPort}else{this.realUnicastUrl=null}switch(this.type){case"ie":case"fx":this.pendingProps.URL=url;break;case"flip4mac":case"wmp6":this.pendingProps.FileName=url;break;case"vlc2":if(this.isAlive()){this.elt.playlist.items.clear()}this.pendingProps.URL=url;break}if(url!=""){this.doPending()}},getUrl:function(){if(this.realUnicastUrl){return this.realUnicastUrl}if(!this.isAlive()){return this.pendingProps.FileName||this.pendingProps.URL}else{switch(this.type){case"ie":case"fx":return this.elt.URL||this.pendingProps.URL;break;case"flip4mac":case"wmp6":return this.elt.FileName;break;case"vlc2":return this.elt.playlist.items[0]}}},getDuration:function(){if(!this.isAlive()){return 0}else{switch(this.type){case"ie":case"fx":return this.elt.currentMedia?this.elt.currentMedia.duration:-1;break;case"flip4mac":case"wmp6":return this.elt.Duration;break;case"vlc2":return this.elt.input.length/1000}}},play:function(){if(this.isAlive()){switch(this.type){case"ie":case"fx":this.elt.controls.play();break;case"flip4mac":case"wmp6":this.elt.Play();break;case"vlc2":this.elt.playlist.playItem(this.vlcPlaylistId)}}},pause:function(){if(this.isAlive()){switch(this.type){case"ie":case"fx":this.elt.controls.pause();break;case"flip4mac":case"wmp6":this.elt.Pause();break;case"vlc2":this.elt.playlist.pause()}}},stop:function(){if(this.isAlive()){switch(this.type){case"ie":case"fx":this.elt.controls.stop();break;case"flip4mac":case"wmp6":this.elt.Stop();break;case"vlc2":this.realUnicastUrl=null;this.elt.playlist.stop();this.elt.playlist.items.clear()}}},getVolume:function(){switch(this.type){case"ie":case"fx":return this.elt.settings.volume;break;case"flip4mac":case"wmp6":return 0;case"vlc2":return Math.round(this.elt.audio.volume/2)}},setVolume:function(vol){switch(this.type){case"ie":case"fx":this.pendingProps["settings.volume"]=vol;break;case"flip4mac":case"wmp6":this.pendingProps.Volume=(vol>0)?Math.round(-5000*(2-(Math.log(vol)/Math.log(10)))):-10000;break;case"vlc2":this.pendingProps["audio.volume"]=vol*2;break}this.doPending()},setMute:function(v){if(this.isAlive()){switch(this.type){case"ie":case"fx":this.elt.settings.mute=(v?true:false);break;case"flip4mac":case"wmp6":this.elt.Mute=(v?true:false);break;case"vlc2":this.elt.audio.mute=(v?true:false)}}},getStatistics:function(v){if(this.isAlive()){switch(this.type){case"ie":case"fx":try{return{bufferingCount:this.elt.network.bufferingCount,framesSkipped:this.elt.network.framesSkipped,lostPackets:this.elt.network.lostPackets,receivedPackets:this.elt.network.receivedPackets,recoveredPackets:this.elt.network.recoveredPackets,receptionQuality:this.elt.network.receptionQuality}}catch(e){return{}}break;case"flip4mac":case"wmp6":return{};break;case"vlc2":return{}}}},getMute:function(v){if(this.isAlive()){switch(this.type){case"ie":case"fx":return this.elt.settings.mute;break;case"flip4mac":case"wmp6":return this.elt.Mute;break;case"vlc2":return this.elt.audio.mute}}else{return false}},getPlayState:function(){if(!this.isAlive()){return this.pendingPlayState||mediaPlayerStates.PS_UNDEFINED}else{switch(this.type){case"ie":return this.pendingPlayState||this.elt.playState;break;case"fx":if(this.resizeStage){return mediaPlayerStates.PS_PLAYING}else{return this.pendingPlayState||this.elt.playState}break;case"flip4mac":case"wmp6":return translateWMP6PlayState(this.elt.PlayState);break;case"vlc2":if(this.elt.style.display=="block"){return translateVLCPlayState(this.elt.input.state)}}}},setFullScreen:function(fullscreen){switch(this.type){case"ie":case"fx":this.elt.fullScreen=fullscreen;break;case"flip4mac":case"wmp6":this.elt.DisplaySize=fullscreen?3:1;break;case"vlc2":this.elt.video.fullscreen=fullscreen;break}},resizeTo:function(x,yy){switch(this.type){case"fx":if(this.isAlive()&&(this.elt.offsetWidth!=x||this.elt.offsetHeight!=yy)){var savedUrl=this.getUrl();var savedPos=this.getCurrentPosition();var savedPlayState=this.getPlayState();this.elt.style.display="none";this.resizeStage=1;this.attempts=0;if(this.delayHandle){clearInterval(this.delayHandle)}this.delayHandle=setInterval(function(){if(!this.isAlive()&&this.attempts++>1){this.resizeStage=2;clearInterval(this.delayHandle);this.pendingProps["settings.autoStart"]=true;this.pendingProps.stretchToFit=true;this.setUrl(savedUrl);if(savedPlayState!=mediaPlayerStates.PS_STOPPED&&savedPlayState!=mediaPlayerStates.PS_READY&&savedPlayState!=mediaPlayerStates.PS_MEDIAENDED){this.setCurrentPosition(savedPos)}this.setPendingState(savedPlayState);this.elt.style.width=Math.round(Math.abs(x))+"px";this.elt.style.height=Math.round(Math.abs(yy))+"px";this.elt.style.display="block"}else{if(this.attempts++>6){clearInterval(this.delayHandle);debug("giving up")}}}.createDelegate(this),50)}else{}break;case"ie":case"wmp6":case"flip4mac":case"none":case"vlc2":this.elt.style.width=Math.round(Math.abs(x))+"px";this.elt.style.height=Math.round(Math.abs(yy))+"px";break}},setPendingState:function(state){this.pendingPlayState=state;this.doPending()},doPending:function(){if(this.retryHandle){clearTimeout(this.retryHandle);this.retryHandle=null}if(!this.isAlive()){this.retryHandle=setTimeout(function(){this.doPending()}.createDelegate(this),100);return false}this.resizeStage=0;for(var i in this.pendingProps){if(i=="playState"){}else{if(this.type=="vlc2"&&i=="URL"){var absoluteUrl="";var url=this.pendingProps[i];if(url.indexOf("://")==-1){location.protocol+"//"+location.host+escape(this.pendingProps[i])}else{if(url.indexOf("emcast://")!=-1){absoluteUrl="udp://@"+url.substr(9)}else{absoluteUrl=url}}debug("Setting VLC mrl to "+absoluteUrl);this.vlcPlaylistId=this.elt.playlist.add(absoluteUrl,"",":vout-filter=deinterlace :deinterlace-mode=bob");this.pendingPlayState=mediaPlayerStates.PS_PLAYING}else{var parts=i.split(".");try{if(parts.length==1){this.elt[parts[0]]=this.pendingProps[i];debug("Setting "+parts[0]+" to "+this.pendingProps[i])}else{if(parts.length==2){this.elt[parts[0]][parts[1]]=this.pendingProps[i]}}}catch(e){}}}}switch(this.pendingPlayState){case mediaPlayerStates.PS_PLAYING:setTimeout(function(){this.play()}.createDelegate(this),10);break;case mediaPlayerStates.PS_PAUSED:setTimeout(function(){this.pause()}.createDelegate(this),10);break;case mediaPlayerStates.PS_STOPPED:setTimeout(function(){this.play()}.createDelegate(this),10);break}this.pendingPlayState=undefined;this.pendingProps={};return true}};if(elt.tagName.toLowerCase()=="div"){if(forceVLC||(!isWindows&&isMpeg2)){if(isIE){try{if(new ActiveXObject("VideoLAN.VLCPlugin")){elt.innerHTML='<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"  codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"  id="vl_genMediaPlayer" events="true" VIEWASTEXT> 	<param name="ShowDisplay" value="True" /></object> ';p.type="vlc2"}else{throw"vlc"}}catch(e){elt.innerHTML=handleMissingPlugin("vlc");p.type="none"}}else{if(navigator.mimeTypes["application/x-vlc-plugin"]&&navigator.mimeTypes["application/x-vlc-plugin"].enabledPlugin){elt.innerHTML='<embed type="application/x-vlc-plugin"  id="vl_genMediaPlayer" version="VideoLAN.VLCPlugin.2"  showdisplay="true"  /> ';p.type="vlc2"}else{elt.innerHTML=handleMissingPlugin("vlc");p.type="none"}}window.onunload=function(){try{D("vl_genMediaPlayer").parentNode.innerHTML=""}catch(e){}}}else{if(isIE||(isWindows&&isSafari)){debug("plugin for IE");elt.innerHTML='<object id="vl_genMediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="100%" height="100%"><param name="ShowPositionControls" value="false"/></object><script for="vl_genMediaPlayer" event="ScriptCommand(bstrType, bstrParam)" language="JavaScript">onSlide(bstrParam);<\/script>';p.type="ie"}else{if(isMac){debug("plugin for safari");if(navigator.mimeTypes["video/x-ms-wvx"]){elt.innerHTML='<object id="vl_genMediaPlayer" type="video/x-ms-wvx" showcontrols="true" showpositioncontrols="false" src=""></object>';if(navigator.mimeTypes["video/x-ms-wvx"].enabledPlugin.name.toLowerCase().indexOf("flip4mac")!=-1){p.type="flip4mac"}else{p.type="vlc"}}else{elt.innerHTML=handleMissingPlugin();p.type="none"}}else{if(isWindows&&isFirefox){debug("plugin for FX");if(navigator.mimeTypes["video/x-ms-wvx"]&&navigator.mimeTypes["video/x-ms-wvx"].enabledPlugin&&navigator.mimeTypes["video/x-ms-wvx"].enabledPlugin.filename=="np-mswmp.dll"){elt.innerHTML='<object id="vl_genMediaPlayer" type="video/x-ms-wvx"><param name="ShowPositionControls" value="false"/></object>';p.type="fx";window.OnDSScriptCommandEvt=function(eventType,parameter){if(eventType=="EMSLIDE"){if(p.onSlide){p.onSlide(parameter)}}}}else{elt.innerHTML=handleMissingPlugin();p.type="none"}}else{if(isLinux&&isFirefox){elt.innerHTML='<embed type="application/x-vlc-plugin"  id="vl_genMediaPlayer" version="VideoLAN.VLCPlugin.2"  showdisplay="true"  /> ';p.type="vlc2"}else{elt.innerHTML=handleMissingPlugin();p.type="none"}}}}}elt=D("vl_genMediaPlayer");p.pendingProps={stretchToFit:true,StretchToFit:true,"settings.autoStart":true,AutoStart:true};p.elt=elt}else{p.type="wmp6"}return p}if(!window.folders){var folders=new Array()}if(!window.allVids){var allVids=new Array()}var subtitles=new Array();var subtitleStyles=new Array();var defaultStyle=new Object;var serverTime=new Date();var liveUrlsToQuery={};var liveVids={};var liveSlidePrefix;var folderContentChanged=false;var videoContentChanged=false;var frontPageContentChanged=false;var selectedFolderIdx=-1;var selectedVideoIdx=-1;var selectedFolderName="";var selectedVideoPid=0;var currentMode;var currentSlideIdx=-1;var needToJump;var videoJumpTarget;var staticLayout=false;var modeTypes=["frontpage","videos","details","searchResults"];var modes={};var templates={folderTemplate:{options:{}},videoTemplate:{options:{}},detailsTemplate:{options:{}},linkTemplate:{options:{}},downloadTemplate:{options:{}},searchResultTemplate:{options:{}},recentTemplate:{options:{}},featLiveVideoTemplate:{options:{}},featAnnouncementTemplate:{options:{}},liveVideoTemplate:{options:{}},announcementTemplate:{options:{}},announceDetailsTemplate:{options:{}},liveDetailsTemplate:{options:{}}};var vidSortProp="date";var vidSortAsc=false;var vidSortUseIndex=true;var player;var sz;var subtitlesDiv;var statusDiv;var _matched;var _matchDescription;var searchText;var searchDates;var hist;var lastChaptersMouseEventTime=new Date(0);var prevPos=0;var startPos=0;var accumTime=0;var duration=0;var lastUsageReport=null;lastEventSlideUrl="";liveSlideOffset=0;var deploymentDefaults={tocUrl:"/toc3.xml",liveUrl:"/_1.2/liveslides/?path=",getDownloadsLink:function(A){return A},getLiveSlideLink:function(A){return"/_1.2/liveslides/"},getMMSLink:function(A){return A},getSlideLink:function(A){return A},redirPort:2500,translateLiveUrl:function(A){return A}};var configDefaults={thumbnail:{x:100,y:75},plusimg:{img:new Image(16,16),src:"images/plus.gif"},nochildrenimg:{img:new Image(16,16),src:"images/nochildren.gif"},minusimg:{img:new Image(16,16),src:"images/minus.gif"},disableAdHocLive:false,announcementsAtTop:true,doBreadcrumbs:doBreadcrumbs,linkPathName:window.location.pathname,setUIMode:function(A){},vidMinWidth:230,allSlidesAreChapters:false,subtitlesHook:null,enableSlideFade:true,logUploadInterval:120000,breadcrumbSeparator:"&nbsp;&gt;&nbsp;",splitWidth:4,infoMinHeight:100,chaptersMinHeight:100,vidButtonsHeight:76,allChaptersJump:false,liveStatusRefreshInterval:4000,listHiddenVids:false,pdfWidth:1024,pdfHeight:768};var shim="images/common/x.gif";var bg_fnFixPng=function(B){var E="scale";var A=B.currentStyle.backgroundImage;var C=A.substring(5,A.length-2);C=C.substring(String(document.location).lastIndexOf("/")+1,100000);if(B.currentStyle.backgroundRepeat=="no-repeat"){E="crop"}B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+C+"', sizingMethod='"+E+"')";B.style.backgroundImage="url("+shim+")"};var el_fnFixPng=function(A){var B=A.src;B=B.substring(String(document.location).lastIndexOf("/")+1,100000);if(A.currentStyle.backgroundRepeat=="no-repeat"){mode="crop"}A.style.width=A.width+"px";A.style.height=A.height+"px";A.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+B+"', sizingMethod='scale')";A.src=shim};function init(E){configureForBrowser();if(!config.disablePNGFix&&isIE6){for(var B=document.all.length-1,C=null;(C=document.all[B]);B--){if(C.currentStyle.backgroundImage.match(/\.png/i)!==null){bg_fnFixPng(C)}if(C.tagName=="IMG"&&C.src.match(/\.png$/i)!==null){el_fnFixPng(C)}}}parseParams(unescape(location.search));if(window.fixupVid){fixupVid()}if(!window.config){window.config={}}if(!window.deployment){window.deployment={}}for(B in configDefaults){if(config[B]==undefined){config[B]=configDefaults[B]}}for(B in deploymentDefaults){if(deployment[B]==undefined){deployment[B]=deploymentDefaults[B]}}for(B in {plusimg:0,minusimg:0,nochildrenimg:0}){config[B].img.src=config[B].src;config[B]=config[B].img}if(!window.deployment.staticMode){hist=document.createElement("iframe");hist.style.display="none";hist.src="history.html?";hist.id="vl_history";document.getElementsByTagName("body")[0].appendChild(hist)}if(window.initTabs){initTabs()}if(!config.nothumbImg){config.nothumbImg={img:new Image(config.thumbnail.x,config.thumbnail.y),src:"images/nothumbnail.jpg?x="+config.thumbnail.x+"&y="+config.thumbnail.y}}sz=new SlideZoom(D("vl_slides"));initLayout();for(B in modeTypes){modes[modeTypes[B]]=D("vl_"+modeTypes[B])}player=makePlayerWrapper(D("vl_mediaplayer"));player.onSlide=onSlide;templates.liveVideoTemplate.html=templates.liveVideoTemplate.html||templates.videoTemplate.html;templates.announcementTemplate.html=templates.announcementTemplate.html||templates.videoTemplate.html;templates.featAnnouncementTemplate.html=templates.featAnnouncementTemplate.html||templates.recentTemplate.html;templates.featLiveVideoTemplate.html=templates.featLiveVideoTemplate.html||templates.featAnnouncementTemplate.html;templates.announceDetailsTemplate.html=templates.announceDetailsTemplate.html||templates.detailsTemplate.html;templates.liveDetailsTemplate.html=templates.liveDetailsTemplate.html||templates.detailsTemplate.html;for(B in templates){var A=templates[B];A.container=D(B+"Container");A.html=A.html||"";A.prefix=A.prefix||"";A.suffix=A.suffix||"";A.tokens=makeTokens(A.html);A.setData=function(H,I){var G=this.prefix+I+this.suffix;if(this.hook){var F=this.hook(H,G);if(F){G=F}}if(this.container){this.container.innerHTML=G}if(this.postHook){this.postHook(H)}}}subtitlesDiv=D("vl_subtitles");statusDiv=D("vl_status");defaultStyle.color="black";defaultStyle.align="bottomleft";if(player.type=="flip4mac"){liveSlideOffset=-20}if(!templates.recentTemplate.options.sortAsc){templates.recentTemplate.options.sortAsc=false}if(!templates.recentTemplate.options.number){templates.recentTemplate.options.number=4}if(!templates.folderTemplate.options.folderIndentPx){templates.folderTemplate.options.folderIndentPx=18}if(config.initHook){config.initHook()}setTimeout(function(){setInterval(processSlides,200);if(!E&&!deployment.staticMode){if(config.liveStatusRefreshInterval){setInterval(function(){if(window.vid&&vid.isLive=="LiveNow"&&(player.getPlayState()==mediaPlayerStates.PS_PLAYING||player.getPlayState()==mediaPlayerStates.PS_BUFFERING)){setTimeout(getLiveStatuses,500)}},config.liveStatusRefreshInterval)}needToJump=true;debug("loading toc: "+deployment.tocUrl);showStatus("Fetching data...");loadXMLDoc(deployment.tocUrl,handleFolders,true,tocError)}else{if(window.vid){selectVideo(vid.pid,vid.folder,0,false)}else{if(opener){folders=opener.folders;allVids=opener.allVids}needToJump=true;jumpToLocation(params.jump,params.search)}}},50)}function reportUsage(F){if(window.deployment.logUrl&&selectedFolderIdx!=-1&&selectedVideoIdx!=-1){lastUsageReport=(new Date()).getTime();var A=folders[selectedFolderIdx].videos[selectedVideoIdx];if(!reportUsage.sessionId){reportUsage.sessionId="EM"+Math.abs(Math.round((Math.random()*(1<<31))))+Math.abs(Math.round((Math.random()*(1<<31))))}var B=window.deployment.logUrl+"?video="+escape(A.title)+"&folder="+escape(A.folder)+"&pid="+A.pid+"&sid="+A.sid+"&start="+startPos+"&end="+(startPos+accumTime)+"&length="+duration+"&sessionId="+reportUsage.sessionId+"&isLive="+(A.isLive=="LiveNow");var E=player.getStatistics();if(E){for(var C in E){B+="&"+C+"="+escape(E[C])}}if(!F){if(!window.logImg){window.logImg=new Image()}logImg.src=B+"&date="+(new Date()).getTime();debug("Reporting usage to "+B)}}}function tocError(A){if(A.status==401||A.status==403){setMode("frontpage");templates.recentTemplate.setData(null,"<b>You do not have permission to access this data</b>");templates.folderTemplate.setData(null,"Could not download data: "+A.statusText)}else{templates.folderTemplate.setData(null,"Could not download data: "+A.statusText)}}function doSort(A){isSearch=currentMode=="searchResults";if(A=="title"){vidSortProp="title";vidSortAsc=true}else{if(A=="titleR"){vidSortProp="title";vidSortAsc=false}else{if(A=="date"){vidSortProp="creationDate";vidSortAsc=true}else{if(A=="dateR"){vidSortProp="creationDate";vidSortAsc=false}else{if(A=="length"){vidSortProp="length";vidSortAsc=true}else{if(A=="lengthR"){vidSortProp="length";vidSortAsc=false}else{if(A=="folder"){vidSortProp="folder";vidSortAsc=true}else{if(A=="default"){setDefaultSort()}}}}}}}}vidSortUseIndex=(A=="default"&&currentMode=="videos");if(isSearch){searchResults()}else{showVideos()}}function expandFolder(C,F,H){var G=0;var I=templates.folderTemplate.container;while(C.className!="vl_folder_row"){C=C.parentNode}if(H){var A;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(window.getSelection){A=window.getSelection();if(A&&A.removeAllRanges){A.removeAllRanges()}}}}var E=getFolderButton(C);if(E==""||E==config.nochildrenimg.src){return }var B=!H&&(F||(E==config.plusimg.src));var J=getElementsByClass(I,"vl_folder_row","table");var G=-1;while(G<J.length-1&&J[++G]!=C){}G++;while(G<J.length&&(parseInt(J[G].style.marginLeft)||0)>(parseInt(C.style.marginLeft)||0)){if(B){if((parseInt(J[G].style.marginLeft)||0)-(parseInt(C.style.marginLeft)||0)<=templates.folderTemplate.options.folderIndentPx){J[G].parentNode.style.display="block";if(getFolderButton(J[G].parentNode)==config.minusimg.src){setFolderButton(J[G].parentNode,config.plusimg.src)}}}else{J[G].parentNode.style.display="none"}++G}setFolderButton(C,B?config.minusimg.src:config.plusimg.src)}function getFolderButton(A){var B=A.getElementsByTagName("img");for(j in B){if(B[j].src==config.plusimg.src){return config.plusimg.src}else{if(B[j].src==config.nochildrenimg.src){return config.nochildrenimg.src}else{if(B[j].src==config.minusimg.src){return config.minusimg.src}}}}}function setFolderButton(B,A){var C=B.getElementsByTagName("img");for(j in C){if(C[j].src==config.plusimg.src||C[j].src==config.minusimg.src||C[j].src==config.nochildrenimg.src){C[j].src=A}}}function compareFolders(B,A){if(B.path.toLowerCase()>A.path.toLowerCase()){return 1}if(B.path.toLowerCase()<A.path.toLowerCase()){return -1}return 0}function XPStringCompare(C,B){C=C.toLowerCase();B=B.toLowerCase();var H=C.split(/[^0-9.]+/);var A=C.split(/[0-9.]+/);var F=B.split(/[^0-9.]+/);var I=B.split(/[0-9.]+/);var E=Math.max(H.length,F.length,A.length,I.length);for(var G=0;G<E;G++){if(A[G]>I[G]){return 1}else{if(A[G]<I[G]){return -1}}if(H[G]!=F[G]){return(H[G]-0)-(F[G]-0)}}return 0}function compareVids(C,B){var A=0;if(vidSortUseIndex){if(C.realTitle.match(/^\d+\)/)){if(B.realTitle.match(/^\d+\)/)){return XPStringCompare(C.realTitle,B.realTitle)}else{return -1}}else{if(B.realTitle.match(/^\d+\)/)){return 1}else{}}}if(typeof (C[vidSortProp])=="string"||C[vidSortProp] instanceof String){A=XPStringCompare(C[vidSortProp],B[vidSortProp])}else{A=C[vidSortProp]>B[vidSortProp]?1:C[vidSortProp]<B[vidSortProp]?-1:0}if(vidSortAsc){return A}else{return -A}}function handleSubtitles(C){subtitles.length=0;if(!C||!C.responseXML){subsError();return }var E=C.responseXML.getElementsByTagName("style");subtitleStyles.length=0;for(i=0;i<E.length;i++){var B=new Object();B.color=selectElement(E[i],"fontstyle").getAttribute("color");if(B.color=="white"||B.color=="#fff"||B.color=="#ffffff"||B.color=="rgb(255,255,255)"){B.color="black"}B.align=selectElement(E[i],"position").getAttribute("alignment");subtitleStyles[E[i].getAttribute("name")]=B}if(!subtitleStyles.Default){subtitleStyles.Default=defaultStyle}var E=selectMultiElements(selectElement(C.responseXML.documentElement,"subtitles"),"subtitle");for(i=0;i<E.length;i++){var A=new Object;A.text=getEltContent(E[i],"text");A.style=selectElement(E[i],"text").getAttribute("style");if(!A.style){A.style="Default"}A.start=E[i].getAttribute("start")-0;if(E[i].getAttribute("stop")){A.stop=E[i].getAttribute("stop")-0}else{if(E[i].getAttribute("duration")){A.stop=A.start+(E[i].getAttribute("duration")-0)}else{A.stop=A.start+2}}subtitles.push(A)}if(config.subtitlesHook){config.subtitlesHook(subtitles)}}function handleFolders(K){if(K.status==304){showStatus("");setTimeout(getLiveStatuses,500);return }showStatus("Got "+K.responseText.length+" bytes of xml...");debug("Toc has changed - processing");if(!K.responseXML){debug("Invalid toc, retrying ");if(isSafari){setTimeout(function(){location.reload()},1000)}return }folders.length=0;allVids.length=0;liveUrlsToQuery={};var M=K.responseXML.getElementsByTagName("live");if(M.length>0){liveUrlsToQuery[M[0].getAttribute("defaultLiveUrl")]=1}var J=new Date();var E=new Date(J.getFullYear(),J.getMonth(),J.getHours()>5?J.getDate():J.getDate()-1,5,0,0,0);var M=K.responseXML.getElementsByTagName("service");for(var F=0;F<M.length;F++){var B=M.item(F);var A=new Object();var G=B.getAttribute("name").split(/\//);A.level=G.length-1;if(A.level==0){A.toplevel="toplevel"}else{A.toplevel=""}A.indent=A.level*templates.folderTemplate.options.folderIndentPx;A.name=G[G.length-1];A.path=B.getAttribute("name");A.folderUrl=location.protocol+"//"+location.host+config.linkPathName+"?"+escape(A.path);A.sid=B.getAttribute("sid");folders.push(A);A.videos=new Array();A.videos.length=0;var H=selectMultiElements(B,"video");for(var C=0;C<H.length;C++){var L=createVideoFromXml(A,H.item(C));if(window.serverIP&&L.creationDate>E){L.unavailable=true}A.videos.push(L);allVids.push(L);if(allVids.length%10==0){showStatus(allVids.length+" videos loaded...")}}}if(config.vidsHandledHook){config.vidsHandledHook(allVids)}debug("Processed folders");for(var F in liveVids){if(liveVids[F].isFake){addFakeVid(liveVids[F])}}setTimeout(getLiveStatuses,500);showStatus("Sorting data");if(config.sortFolders){config.sortFolders(folders)}else{folders.sort(compareFolders)}folderContentChanged=true;videoContentChanged=true;frontPageContentChanged=true;var I=false;if(needToJump){needToJump=false;if(params.jump||params.search){I=jumpToLocation(params.jump,params.search)}}if(!I){selectVideo(selectedVideoPid,selectedFolderName)}showStatus("")}function getLiveStatuses(){if(deployment.liveUrl){for(i in liveUrlsToQuery){loadXMLDoc(deployment.liveUrl+escape(i)+"/livestatus.xml",handleLiveStatus,true,handleLiveStatus)}}}function createVideoFromXml(A,I){var M=new Object;M.pid=I.getAttribute("pid");M.length=I.getAttribute("lengthsecs")-0;if(I.getAttribute("hidden")){M.hidden="yes"}else{M.hidden="no"}M.categories={};M.slides=[];M.chapters=[];M.links=[];M.folder=A.path;M.sid=A.sid;M.jumpPoints=[];var C=selectElement(I,"embargodate");if(C){M.embargo=new Date(C.getAttribute("timestamp")-0)}else{M.embargo="none"}C=selectElement(I,"expirydate");if(C){M.expiry=new Date(C.getAttribute("timestamp")-0)}else{M.expiry="none"}M.realTitle=getEltContent(I,"title");M.title=hideIndex(M.realTitle);M.comment=getEltContent(I,"comment");M.longDescription=getEltContent(I,"longdescription");M.keywords=getEltContent(I,"keywords");M.email=getEltContent(I,"email");M.author=getEltContent(I,"author");M.copyright=getEltContent(I,"copyright");M.mmslink=getEltContent(I,"mms");M.httplink=getEltContent(I,"http");M.creationDate=new Date(selectElement(I,"lastmodified").getAttribute("timestamp")-0);var H=selectMultiElements(selectElement(I,"categories"),"category");for(F=0;F<H.length;F++){M.categories[H[F].getAttribute("name")]=getContent(H[F])}M.extendedData={};if(selectElement(I,"extendeddata")){var N=selectMultiElements(selectElement(I,"extendeddata"),"data");for(F=0;F<N.length;F++){M.extendedData[N[F].getAttribute("name")]=getContent(N[F])}}var L=selectMultiElements(selectElement(I,"slides"),"slide");var J=selectElement(I,"slides").getAttribute("allJump")=="yes";var B;for(var F=0;F<L.length;F++){var E=L[F];var O=new Object;O.url=E.getAttribute("url");O.time=E.getAttribute("time");O.title=getEltContent(E,"title").replace(/\n/g,"");O.keywords=getEltContent(E,"keywords");O.description=getEltContent(E,"description");if(E.getAttribute("mouseX")||E.getAttribute("mouseX")=="0"){O.cursor={x:E.getAttribute("mouseX")-0,y:E.getAttribute("mouseY")-0}}if(E.getAttribute("width")!=""){O.width=E.getAttribute("width")-0;O.height=E.getAttribute("height")-0}O.level=E.getAttribute("level")-0;if(O.title==""&&config.allSlidesAreChapters){O.title="Slide "+(M.slides.length+1)}if(O.url){M.slides.push(O)}if(O.title){M.chapters.push(O)}else{if(config.allSlidesAreChapters){O.title="Untitled";M.push(O)}}var G=O.title&&(config.allSlidesAreChapters||O.title!="Untitled");if(G&&(config.allChaptersJump||E.getAttribute("isJump")=="yes"||J)){if(B){O.length=O.time-B.time}else{O.length=O.time}O.jumpPid=M.pid;O.jumpFolder=M.folder;M.jumpPoints.push(O)}}L=selectMultiElements(selectElement(I,"links"),"a");for(F=0;F<L.length;F++){var K=new Object;K.linkTitle=getContent(L[F]);K.linkUrl=L[F].getAttribute("href");if(config.showPdfPattern){if(K.linkUrl.indexOf(config.showPdfPattern.url)!=-1||K.linkTitle.indexOf(config.showPdfPattern.title)!=-1){M.pdf=K.linkUrl}}M.links.push(K)}if(M.categories["em:liveLinkUrl"]){M.liveTime=new Date(M.categories["em:liveTime"]*1000);if(liveVids[M.pid]){M.isLive="LiveNow";M.liveUrl=liveVids[M.pid].liveUrl;debug("Keeping live vid live across content change: "+M.title)}else{M.isLive="Announce"}liveUrlsToQuery[M.categories["em:liveLinkUrl"]]=1}else{M.isLive=""}M.url=location.protocol+"//"+location.host+config.linkPathName+"?"+escape(M.folder)+":"+M.pid;return M}function refresh(){if(!deployment.tocUrl){return }showStatus("Fetching data...");parseStateParams(loadState());needToJump=true;loadXMLDoc(deployment.tocUrl,handleFolders,true)}function showStatus(A){if(statusDiv){statusDiv.innerHTML=A}}function handleLiveStatus(J,A){var F=0;if(J.status==304){return }else{if(J.status!=200){}else{var G=false;var I=false;var H=getContent(J.responseXML.getElementsByTagName("linkUrl")[0]);var M=J.responseXML.getElementsByTagName("liveBroadcast");if(M.length==1){var C=M[0];F=C.getAttribute("pid")-0}else{F=0}}}for(E in allVids){var L=allVids[E];if(L.pid==F){if(L.isLive=="Announce"){L.isLive="LiveNow";liveVids[L.pid]=L;debug("announce has become live");G=true}else{if(selectedVideoPid==F){var K=J.responseXML.getElementsByTagName("slide");if(K&&K.length>0){var O=(L.slides.length==0);var Q=lastEventSlideUrl.split("/");var P=-1;if(Q.length>1){debug("Newest slide is "+K[K.length-1].getAttribute("url"));for(var E=0;E<K.length;E++){var B=K[E];var N=B.getAttribute("url");if(P==-1&&L.slides.length>0&&(Q[0]+"/"+N==L.slides[L.slides.length-1].url)){P=E}}if(liveSlideOffset){for(var E=P+1;E<K.length;E++){var B=K[E];var N=B.getAttribute("url");L.slides[L.slides.length]={url:Q[0]+"/"+N,isLive:true,time:liveSlideOffset+(B.getAttribute("time")-0),width:B.getAttribute("width")-0,height:B.getAttribute("height")-0};debug("Added new upcoming liveslide: "+N+" at "+(liveSlideOffset+(B.getAttribute("time")-0)))}}}}}}I=true;L.liveUrl=getEltContent(C,"url")}else{if(A==deployment.liveUrl+escape(L.categories["em:liveLinkUrl"])+"/livestatus.xml"){if(L.isLive=="LiveNow"){if(L.isFake){debug(L.title+": ad-hoc broadcast has finished");removeVid(L);G=true}else{debug(L.title+" is no longer live. Current live pid is "+F+", whilst this vid's pid is "+L.pid);G=true;L.isLive="Announce";delete liveVids[L.pid]}}}}}if(!I&&F!=0){if(!config.disableAdHocLive){var L={length:0,lang:"en-GB",hidden:"no",longDescription:"",keywords:"",email:"",author:"",copyright:"",creationDate:new Date(),downloads:[],subtitles:[],slides:[],chapters:[],links:[],jumpPoints:[],subtitleStyles:{},categories:{},extendedData:{}};L.pid=F;L.title=getEltContent(C,"title");L.comment=getEltContent(C,"comment");L.description=getEltContent(C,"description");L.folder=getEltContent(C,"folder");L.liveUrl=getEltContent(C,"url");L.liveTime=new Date(C.getAttribute("startedAt")-0);L.hasLiveSlides=C.getAttribute("liveSlides")=="yes";L.isLive="LiveNow";L.categories["em:liveLinkUrl"]=H;L.httpLink=getEltContent(C,"linkUrl");L.httplink=getEltContent(C,"linkUrl");L.isFake=true;debug("adhoc live vid arrived");addFakeVid(L);G=true}}if(G){folderContentChanged=true;videoContentChanged=true;frontPageContentChanged=true;selectVideo(selectedVideoPid,selectedFolderName)}}function addFakeVid(A){liveVids[A.pid]=A;var B=findFolder(A.folder);if(B!=-1){folders[B].videos[folders[B].videos.length]=A}allVids[allVids.length]=A}function removeVid(A){var C;for(C=0;C<allVids.length;C++){if(allVids[C].pid==A.pid){allVids.splice(C,1)}}var B=findFolder(A.folder);if(B!=-1){for(C=0;C<folders[B].videos.length;C++){if(folders[B].videos[C].pid==A.pid){folders[B].videos.splice(C,1)}}}else{debug("can't find folder: "+A.folder)}delete liveVids[A.pid]}function setMode(B){if(isIE7&&modes[currentMode]){var C=modes[currentMode].offsetHeight}for(var A in modes){if(A==B){modes[A].style.display="block"}else{if(modes[A].style){modes[A].style.display="none"}}if(isIE7&&modes[A].style&&C>10){modes[A].style.height=C+"px"}else{}}if(isIE7){clearTimeout(window.resizeH);window.resizeH=setTimeout(function(){for(var E in modes){modes[E].style.height="auto"}},500)}config.doBreadcrumbs(B=="searchResults");if(B!=currentMode){currentMode=B;setDefaultSort();vidSortUseIndex=B=="videos";D("vl_sortselect").value="default"}if(config.setUIMode){config.setUIMode(B)}D("sz_hover").style.display="none";setTimeout(function(){refreshLayout(0)},5)}function setDefaultSort(){if(config.defaultSortProp!=undefined){vidSortProp=config.defaultSortProp}if(config.defaultSortAsc!=undefined){vidSortAsc=config.defaultSortAsc}if(currentMode=="videos"){if(templates.videoTemplate.options.sortAsc!=undefined){vidSortAsc=templates.videoTemplate.options.sortAsc}if(templates.videoTemplate.options.sortProp!=undefined){vidSortProp=templates.videoTemplate.options.sortProp}}else{if(currentMode=="searchResults"){if(templates.searchResultTemplate.options.sortAsc!=undefined){vidSortAsc=templates.searchResultTemplate.options.sortAsc}if(templates.searchResultTemplate.options.sortProp!=undefined){vidSortProp=templates.searchResultTemplate.options.sortProp}}}}function jumpToLocation(H,J,I){debug("jumping to ["+H+"], dontSave="+I);if(J){searchResults(false,J);return true}else{H=H+"";if(H==""){selectVideo(0,"***",0,I);return true}else{var F=H.split(":",3);var A;if(F[0]&&F[0].length>=1){A=F[0];showFolders()}else{A="***"}var G=0;if(F[1]=="latest"){var B=folders[findFolder(A)].videos;var C;for(i=0;i<B.length;i++){if(!C||B[i].creationDate.getTime()>lates.creationDate.getTime()){C=B[i]}}G=C.pid}else{G=F[1]?F[1]-0:0}var E=F[2]?parseFloat(F[2]):0;selectVideo(G,A,E,I);return true}}return false}function seekToChapter(B){try{player.setCurrentPosition(B-0+0.05)}catch(A){}}function selectFolder(A){selectVideo(0,A)}function findFolder(A){for(i in folders){if(folders[i].path==A){return i}}return -1}function findVideo(B,A){if(A==-1){return -1}for(i in folders[A].videos){if(folders[A].videos[i].pid==B){return i}}return -1}function makeTokens(E){var B=new RegExp(/\$(\$([a-zA-Z]+)(\[(\d+)\])?{([^}]*)}|([a-zA-Z.]+)(::)?([a-zA-Z:]*)(.))/mg);var C=new Array();var A=0;while((parts=B.exec(E))){C[C.length]={type:"text",text:E.substring(A,parts.index)};A=parts.index+parts[0].length;if(parts[1].indexOf("{")!=-1){C[C.length]={type:"subtemplate",property:parts[2],max:parts[4]-0,tokens:makeTokens(parts[5])}}else{C[C.length]={type:"property",property:parts[6],format:parts[8]};if(parts[9]!="|"){A--}}}C[C.length]={type:"text",text:E.substring(A,E.length)};return C}function doBBTags(A){return A.replace(/\[br\]/g,"<br/>")}function htmlEscape(A){A=A+"";return A.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")}function hideIndex(A){return A.replace(/(^|\/)(\d+\)\s*)/g,"$1")}function substituteProperties(I,E,N){var O="";for(var F=0;F<I.length;F++){var M=I[F];if(M.type=="text"){O+=M.text}else{if(M.type=="subtemplate"){if(!E[M.property]){continue}var K=M.max>0?Math.min(M.max,E[M.property].length):E[M.property].length;for(var C=0;C<K;C++){O+=substituteProperties(M.tokens,E[M.property][C],null)}}else{if(M.type=="property"){if(M.property.indexOf(".")!=-1){var A=E;var B=M.property.split(".");for(C in B){A=A[B[C]];if(!A){break}}}else{var A=E[M.property];if(!A){A=""}}if(M.property=="httplink"){A=deployment.getSlideLink(A)}if(A!=null){var J=M.format.split("::");for(var L=0;L<J.length;L++){var G=J[L];switch(G){case"jsEscape":A=htmlEscape(A);A=A.replace(/\'/g,"\\'");A=A.replace(/\"/g,"%22");break;case"urlEscape":A=escape(A);break;case"noEscape":break;case"searchHilight":A=hilightMatch(N,A,true);break;case"hideIndex":A=htmlEscape(hideIndex(A));break;case"formatTime":A=formatTime(A);break;case"date":if(A.toDateString){A=A.toLocaleDateString()}break;case"time":if(A.toTimeString){A=A.toLocaleTimeString()}break;case"bool":if(A){A="true"}else{A="false"}break;case"empty":if(A+""==""){A="empty"}else{A=""}break;case"shortTime":if(A.toTimeString){var H=A.toLocaleTimeString();A=H.substring(0,H.lastIndexOf(":"))}break;case"bbtags":A=doBBTags(htmlEscape(A));case"":A=htmlEscape(A);break}}O+=""+A}else{O+=htmlEscape(M.property)}}}}}return O}function showFolders(){var B="";for(var A=0;A<folders.length;A++){if(folders[A].level>0){folders[A]["display"]="none"}else{folders[A]["display"]="block"}if(A==folders.length-1||folders[A+1].level<=folders[A].level){folders[A]["plus"]=configDefaults.nochildrenimg.src}else{folders[A]["plus"]=configDefaults.plusimg.src}B+=substituteProperties(templates.folderTemplate.tokens,folders[A])}templates.folderTemplate.setData(folders,B)}function shouldShow(A){return !A.unavailable&&(!A.categories.notPublicListed||config.listHiddenVids)}function showRecent(){frontPageContentChanged=false;var F="";vidSortProp=templates.recentTemplate.options.sortProp||"creationDate";vidSortAsc=templates.recentTemplate.options.sortAsc;allVids.sort(compareVids);var B=templates.recentTemplate.options.number;var C=0;for(i=0;i<allVids.length&&C<B;i++){var A=allVids[i];if(shouldShow(A)){if(A.isLive=="LiveNow"){C++;F+=substituteProperties(templates.featLiveVideoTemplate.tokens,A)}}}if(config.announcementsAtTop){for(i=0;i<allVids.length&&C<B;i++){var A=allVids[i];if(shouldShow(A)){if(A.isLive=="Announce"){C++;F+=substituteProperties(templates.featAnnouncementTemplate.tokens,A)}}}}var E=[];for(i=0;i<allVids.length&&C<B;i++){var A=allVids[i];if(shouldShow(A)){if(A.categories.featured&&(!A.isLive||(A.isLive=="Announce"&&!config.announcementsAtTop))){E[E.length]=A}}}E.sort(function(H,G){if(parseInt(H.categories.featured)>parseInt(G.categories.featured)){return 1}else{if(parseInt(H.categories.featured)<parseInt(G.categories.featured)){return -1}else{return compareVids(H,G)}}});for(i=0;i<E.length;i++){var A=E[i];C++;F+=substituteProperties(templates.recentTemplate.tokens,A)}for(i=0;i<allVids.length&&C<B;i++){A=allVids[i];if(shouldShow(A)){if(!A.categories.featured&&(!A.isLive||(A.isLive=="Announce"&&!config.announcementsAtTop))&&!A.categories.notFeatured){C++;F+=substituteProperties(templates.recentTemplate.tokens,A)}}}templates.recentTemplate.setData(allVids,F)}function showVideos(){folderContentChanged=false;var C="";folder=folders[selectedFolderIdx];if(D("vl_folder_name")){D("vl_folder_name").innerHTML=folder.name.replace(/(^|\/)(\d+\)\s*)/,"$1")}folder.videos.sort(compareVids);var B=0;for(i in folder.videos){var A=folder.videos[i];if(shouldShow(A)){if(A.isLive=="Announce"){C+=substituteProperties(templates.announcementTemplate.tokens,A)}else{if(A.isLive=="LiveNow"){C+=substituteProperties(templates.liveVideoTemplate.tokens,A)}else{C+=substituteProperties(templates.videoTemplate.tokens,A)}}B++}}if(D("vl_folder_numVids")){D("vl_folder_numVids").innerHTML=B}templates.videoTemplate.setData(folder.videos,C)}function doBreadcrumbs(B){var C=config.breadcrumbSeparator;var F="<a href=\"javascript:selectFolder('')\"><b>Home</b></a>";if(B){F+=C+'<a onclick="">Search Results</a>';if(D("vl_vbreadcrumbs")){D("vl_vbreadcrumbs").innerHTML=F}else{if(D("vl_breadcrumbs")){D("vl_breadcrumbs").innerHTML=F}}}else{var A="";if(selectedFolderIdx==-1){parts=[]}else{parts=folders[selectedFolderIdx].path.split("/");rparts=[];for(var E=0;E<parts.length;E++){rparts[rparts.length]=parts[E].replace(/^\d+\)\s*/,"")}}var E;for(E=0;E<parts.length;E++){A=parts.slice(0,E+1).join("/");F+=C+"<a href=\"javascript:selectFolder('"+A+"')\">"+rparts[E]+"</a>"}if(selectedVideoIdx!=-1){F+=C+'<a href="javascript:player.stop();player.play();">'+folders[selectedFolderIdx].videos[selectedVideoIdx].title+"</a>";if(D("vl_vbreadcrumbs")){D("vl_vbreadcrumbs").innerHTML=F}else{if(D("vl_breadcrumbs")){D("vl_breadcrumbs").innerHTML=F}}}else{if(selectedFolderIdx!=-1){if(D("vl_breadcrumbs")){D("vl_breadcrumbs").innerHTML=F}}}}}function searchResults(A,B){if(player){player.stop()}if(!B){if(A){searchText=D("vl_searchtextA").value;D("vl_searchtext").value=searchText}else{searchText=D("vl_searchtext").value;D("vl_searchtextA").value=searchText}}else{searchText=B;D("vl_searchtext").value=searchText;D("vl_searchtextA").value=searchText}if(searchText==""){selectFolder("");return }searchDates=null;if(D("vl_searchAdded1")&&D("vl_searchAdded2")){if(D("vl_searchAdded1").checked){searchDates=[new Date().addDays(-D("vl_searchAddedSpecific").value),new Date()]}else{searchDates=[new Date(D("vl_searchAddedMinY").value,D("vl_searchAddedMinM").value,D("vl_searchAddedMinD").value),new Date(D("vl_searchAddedMaxY").value,D("vl_searchAddedMaxM").value,D("vl_searchAddedMaxD").value)]}}setMode("searchResults");templates.searchResultTemplate.setData(null,"Please wait...");saveState(encodeState());setTimeout(_searchResults,100)}function _searchResults(){var accumHTML="";var searchMatches=new Array();D("vl_searchQuery").innerHTML=searchText;if(D("vl_searchLink")){D("vl_searchLink").innerHTML=location.protocol+"//"+location.host+linkPathName+"?search="+escape(searchText)}try{var regex=new RegExp("("+searchText+")","ig")}catch(e){alert("Invalid search string");templates.searchResultTemplate.setData(null,"Invalid search string");exit}var matches=0;var i;var j;for(h in folders){var folder=folders[h];for(i in folder.videos){var vid=folder.videos[i];if(shouldShow(vid)&&(!searchDates||searchDates.length==0||(vid.creationDate>=searchDates[0]&&vid.creationDate<=searchDates[1]))){var matched=false;var matchDescription="";if(D("vl_searchTitle").checked){if(regex.exec(vid.title)){matched=true}}if(!matched&&D("vl_searchAuthor").checked){if(regex.exec(vid.comment)){matched=true}}if(
/*matched &&*/
D("vl_searchAll").checked){if(regex.exec(vid.keywords)!=null){matched=true;if(window.showKeywordMatches){matchDescription=makeMatchDesc("keywords",regex,vid.keywords)}}if(!matched&&regex.exec(vid.comment)){matched=true;matchDescription=makeMatchDesc("description",regex,vid.comment)}if(!matched&&regex.exec(vid.author)){matched=true;matchDescription=makeMatchDesc("author",regex,vid.author)}if(!matched&&regex.exec(vid.copyright)){matchDescription=makeMatchDesc("copyright text",regex,vid.copyright);matched=true}if(!matched&&regex.exec(vid.email)){matchDescription=makeMatchDesc("email address",regex,vid.email);matched=true}if(!matched){for(j in vid.links){if(regex.exec(vid.links[j].linkTitle)){matchDescription=makeMatchDesc("related link "+(j- -1),regex,vid.links[j].linkTitle);matched=true;break}}}if(!matched){for(j in vid.chapters){if(regex.exec(vid.chapters[j].title)){matchDescription=makeMatchDesc("chapter "+(j- -1),regex,vid.chapters[j].title);matched=true}if(regex.exec(vid.chapters[j].description)){matchDescription=makeMatchDesc("chapter "+(j- -1),regex,vid.chapters[j].description);matched=true}if(regex.exec(vid.chapters[j].keywords)){if(window.showKeywordMatches){matchDescription=makeMatchDesc("keywords for chapter "+(j- -1),regex,vid.chapters[j].keywords)}matched=true}if(matched){matchDescription='<a href="javascript:selectVideo('+vid.pid+", '"+escape(vid.folder)+"', "+vid.chapters[j].time+')">'+matchDescription+"</a>"}if(matched){break}}}}if(matched){vid.matchDescription=matchDescription;searchMatches[searchMatches.length]=vid}}}}searchMatches.sort(compareVids);matches=searchMatches.length;var accumHTML="";for(var i=0;i<searchMatches.length;i++){var vid=searchMatches[i];accumHTML+=substituteProperties(templates.searchResultTemplate.tokens,vid,regex);delete (vid.matchDescription)}if(matches>0){D("vl_searchMatches").innerHTML="Results 1-"+matches+" "}else{D("vl_searchMatches").innerHTML="No matches "}templates.searchResultTemplate.setData(matches,accumHTML)}function handleSearchSubtitles(A){handleSubtitles(A);for(i in subtitles){if(_regex.exec(subtitles[i].text)){_matchDescription=makeMatchDesc("subtitle at <a href=\"javascript:selectVideo('"+_video+"', '"+_folder+"', "+subtitles[i].start+')">'+subtitles[i].start+"s</a>",_regex,subtitles[i].text);_matched=true;break}}}function handleDownloads(F){if(selectedVideoIdx==-1||selectedFolderIdx==-1){return }var B=F.responseXML.getElementsByTagName("body")[0];var G=selectMultiElements(B,"a");var A=folders[selectedFolderIdx].videos[selectedVideoIdx];for(var E=0;E<G.length;E++){var C=G[E];var H=new Object();H.icon="images/file_icon.gif";H.url=deployment.getDownloadsLink(A.httplink)+"Downloads/"+C.getAttribute("href");H.name=getContent(C);A.retrievedDownloads[A.retrievedDownloads.length]=H}showDownloads()}function showDownloads(){var B="";var A=folders[selectedFolderIdx].videos[selectedVideoIdx];for(var C=0;C<A.retrievedDownloads.length;C++){var E=A.retrievedDownloads[C];if(E.name){B+=substituteProperties(templates.downloadTemplate.tokens,E)}}templates.downloadTemplate.setData(A.retrievedDownloads,B)}function hilightMatch(E,C,B){E.exec("");if(!E.exec(C)){return htmlEscape(C)}var I=200;var G=15;var H;if(C.length>I){E.exec("");var A=E.exec(C);if(A.index<G){H=C.substr(0,I-3)+"..."}else{H="..."+C.substr(A.index-G,I-6)+"..."}}else{H=C}var F=H.replace(E,'@@@LTspan class="searchMatchHilight"@@@GT$1@@@LT/span@@@GT');F=htmlEscape(F).replace(/@@@LT/g,"<").replace(/@@@GT/g,">");return F}function makeMatchDesc(B,C,A){return"<div>Matched in "+B+":<br /><i>"+hilightMatch(C,A)+"</i></div>"}function onSlide(A){if(deployment.liveUrl&&vid&&vid.isLive=="LiveNow"){var F=A.split(/[?=&]/);if(vid.slides.length>1000){vid.slides=vid.slides.slice(-750)}debug("live slide event: "+F[0]);var C=[];var E=player.getCurrentPosition();if(lastEventSlideUrl!=F[0]){liveSlideOffset=E-F[6];debug("Live slide offset is now "+liveSlideOffset);lastEventSlideUrl=F[0];var B=false;for(i=0;i<vid.slides.length;i++){if(vid.slides[i].url==F[0]){vid.slides[i].time=E;B=true;break}}if(!B){vid.slides[vid.slides.length]={url:F[0],isLive:true,time:E,width:F[2]-0,height:F[4]-0};debug("Added liveslide straight from event (because it was never listed in a livestatus): "+F[0]+" at "+E)}sz.updateSlideAndCache(deployment.liveUrl+vid.categories["em:liveLinkUrl"]+"/slides/",vid.slides,player.getCurrentPosition(),player.getPlayState()==mediaPlayerStates.PS_STOPPED,false,vid.pid)}}}function selectVideo(I,F,B,O){showBackButtonCount=0;lastPlayedVid=0;searchText="";var A=selectedFolderName;var L=selectedVideoPid;var P;if(F||F===""){P=findFolder(F)}else{P=selectedFolderIdx}var N=findVideo(I,P);if(N!=selectedVideoIdx||P!=selectedFolderIdx){updateUsageStats()}selectedVideoIdx=N;selectedFolderIdx=P;selectedFolderName=F;if(selectedVideoIdx!=-1){var M=folders[selectedFolderIdx].videos[selectedVideoIdx];if(!selectedFolderName){selectedFolderName=M.folder}selectedVideoPid=M.pid}else{selectedVideoPid=-1}if(!O&&encodeState()!=escape(loadState())){saveState(encodeState())}if(selectedVideoIdx==-1){if(player){player.stop()}if(selectedFolderIdx==-1){selectedFolderName="";selectedVideoPid=-1;if(frontPageContentChanged){setMode("frontpage");showFolders();showRecent()}else{setMode("frontpage")}if(F!="***"&&F!=""){}}else{selectedFolderName=F;selectedVideoPid=-1;debug("selected: folder: "+F);if(selectedFolderName!=A||folderContentChanged){setMode("videos");showVideos()}else{setMode("videos")}}return }window.staticLayout=M.categories.staticLayout!=null;initLayout();var E=false;if(currentMode=="details"&&L==selectedVideoPid){if(!videoContentChanged){return }E=true}videoContentChanged=false;if(!M.downloads){M.retrievedDownloads=new Array();if(M.httplink!=undefined){loadXMLDoc(deployment.getDownloadsLink(M.httplink)+"Downloads/index.xml",handleDownloads,true,function(Q){templates.downloadTemplate.setData(null,"")},true)}}else{M.retrievedDownloads=new Array();for(var H=0;H<M.downloads.length;H++){var K=new Object();K.icon="images/file_icon.gif";K.url=deployment.getDownloadsLink(M.httplink)+"Downloads/"+M.downloads[H];if(M.downloads[H].indexOf("/")!=-1){K.name=M.downloads[H].substring(M.downloads[H].lastIndexOf("/")+1,M.downloads[H].length)}else{K.name=M.downloads[H]}M.retrievedDownloads[M.retrievedDownloads.length]=K}showDownloads()}if(M.isLive=="LiveNow"){templates.detailsTemplate.setData(M,substituteProperties(templates.liveDetailsTemplate.tokens,M))}else{if(M.isLive=="Announce"){templates.detailsTemplate.setData(M,substituteProperties(templates.announceDetailsTemplate.tokens,M))}else{templates.detailsTemplate.setData(M,substituteProperties(templates.detailsTemplate.tokens,M))}}var C="";for(H=0;H<M.links.length;H++){C+=substituteProperties(templates.linkTemplate.tokens,M.links[H])}templates.linkTemplate.setData(M.links,C);var G=D("vl_chaptersSelect");var J=function(){lastChaptersMouseEventTime=new Date()};G.onmousemove=G.onmousedown=G.onmouseup=J;G.onkeydown=G.onkeyup=J;G.onmouseout=function(){lastChaptersMouseEventTime=new Date(0)};G.options.length=0;G.options[G.options.length]=new Option("Go to...",0);if(M.isLive=="LiveNow"){M.slides.length=0;liveSlidePrefix=deployment.getLiveSlideLink("_1.2/liveslides/")+escape(M.categories["em:liveLinkUrl"]+"/slides/");if(!E){if(M.hasLiveSlides){sz.setNoSlide(true)}else{sz.setNoSlide(false)}}}else{if(M.isLive=="Announce"){sz.setNoSlide(true)}else{liveSlidePrefix=false;for(H=0;H<M.chapters.length;H++){if(M.chapters[H].title=="Untitled"){M.chapters[H].title="Slide "+(H+1)}G.options[G.options.length]=new Option(formatChapterForLevel(unescape(M.chapters[H].title),M.chapters[H].level),M.chapters[H].time);if(M.chapters[H].level==1){G.options[G.options.length-1].style.fontWeight="bold";G.options[G.options.length-1].style.backgroundColor="silver"}}if(M.chapters.length==0){debug("no chapters");G.options[0]=new Option("No chapters available");if(G.className.indexOf("noHide")==-1){G.style.display="none"}}else{G.style.display="block"}}}subtitlesDiv.innerHTML="";subtitles.length=0;if(!M.isLive&&!M.subtitles){loadXMLDoc(deployment.getDownloadsLink(M.httplink)+"subtitles.xml",handleSubtitles,true,subsError,true)}else{if(!M.subtitles){subsError()}else{if(config.subtitlesHook){subtitles=M.subtitles;if(M.subtitleStyles){subtitleStyles=M.subtitleStyles}config.subtitlesHook(M.subtitles)}}}prevPos=0;accumTime=0;lastUsageReport=null;if(!E||(M.liveUrl&&M.isLive=="LiveNow"&&M.liveUrl!=player.getUrl())||(M.isLive=="Announce")){if(M.isLive=="LiveNow"){debug("Updating player url from "+player.getUrl()+" to "+deployment.translateLiveUrl(M.liveUrl));player.setUrl(deployment.translateLiveUrl(M.liveUrl))}else{player.setUrl(unescape(deployment.getMMSLink(M.mmslink)));if(B){debug("jumping video to "+B);videoJumpTarget=Math.round(B)}}player.setPendingState(mediaPlayerStates.PS_PLAYING);setMode("details");currentSlideIdx=-1}}function formatChapterForLevel(C,E){if(E<=1){return C}else{var A=C;for(var B=E-1;B>0;B--){A="  "+A}return A}}function subsError(A){subtitles.length=0;if(config.subtitlesHook){config.subtitlesHook(subtitles)}}function parseParams(E){window.params={jump:""};if(!E){return }var C=E.split(/[?&]/);for(var A=0;A<C.length;A++){var B=C[A].split("=",2);if(B.length>1){window.params[B[0]]=unescape(B[1])}else{window.params.jump=[C[A]]}}}function parseStateParams(A){window.params={jump:A}}function loadState(){if(deployment.staticMode){return }try{return unescape(hist.contentWindow.location.search.substring(1))}catch(A){debug("error loading state:"+A.message)}}function saveState(A){if(deployment.staticMode){return }try{if(hist&&hist.contentWindow&&hist.contentWindow.location){hist.contentWindow.location.search=A}}catch(B){debug("error saving state: "+B.message)}}function encodeState(){if(searchText&&searchText!=""){return escape("search="+escape(searchText))}if(selectedFolderIdx==-1){return""}else{if(selectedVideoIdx==-1){return escape(selectedFolderName)}else{return escape(selectedFolderName+":"+selectedVideoPid)}}}function syncWithHistory(){if(deployment.staticMode){return }if(needToJump){return }try{if(escape(loadState())!=encodeState()){debug("History: ["+escape(loadState())+"] != ["+encodeState()+"]: jumping to: "+loadState());parseStateParams(loadState());jumpToLocation(params.jump,params.search,true)}}catch(A){}}var showBackButtonCount=0;var lastPlayedVid=0;function processSlides(B){if(player.resizeStage){return }if(!folders[selectedFolderIdx]){selectedFolderIdx=-1}if(selectedFolderIdx==-1||selectedVideoIdx==-1){sz.updateSlideAndCache("",null,0,true,true,0);return }vid=folders[selectedFolderIdx].videos[selectedVideoIdx];if(player.getPlayState()==mediaPlayerStates.PS_READY||player.getPlayState()==mediaPlayerStates.PS_STOPPED||player.getPlayState()==mediaPlayerStates.PS_MEDIAENDED){showBackButtonCount++;if(showBackButtonCount==5&&vid==lastPlayedVid){D("vl_mediaplayer").style.visibility="hidden";D("vl_homebutton").style.visibility="visible"}}else{showBackButtonCount=0;D("vl_mediaplayer").style.visibility="visible";D("vl_homebutton").style.visibility="hidden"}if(player.getPlayState()==mediaPlayerStates.PS_PLAYING){lastPlayedVid=vid}var F=window.player&&player.getCurrentPosition?player.getCurrentPosition():0;updateUsageStats(F);if(vid.isLive!="LiveNow"){if(vid.slides.length==0&&vid.pdf){sz.setPdf(vid.pdf)}else{sz.updateSlideAndCache(deployment.getSlideLink(vid.httplink),vid.slides,F,player.getPlayState()==mediaPlayerStates.PS_STOPPED,false,vid.pid)}if(F!=0&&videoJumpTarget){debug("Actually jumping to "+videoJumpTarget-0);player.setCurrentPosition(videoJumpTarget-0);videoJumpTarget=0}for(i in subtitles){var E=subtitles[i];if((E.start>F||E.stop<F)&&E.div){subtitlesDiv.removeChild(E.div);E.div=undefined}else{if(E.start<=F&&E.stop>F&&!E.div){E.div=document.createElement("div");if(E.style!="Default"){E.div.title=E.style}E.div.innerHTML=E.text;E.div.style.color=subtitleStyles[E.style].color;if(subtitleStyles[E.style].align.indexOf("right")!=-1){E.div.style.textAlign="right"}else{E.div.style.textAlign="left"}debug(E);subtitlesDiv.appendChild(E.div)}}}if(vid.chapters){var A=0;while(A<vid.chapters.length&&vid.chapters[A].time<=F){A++}var C=D("vl_chaptersSelect");if(C.selectedIndex!=A&&(new Date()).getTime()-lastChaptersMouseEventTime>10000){C.selectedIndex=A}}}else{sz.updateSlideAndCache(deployment.liveUrl+vid.categories["em:liveLinkUrl"]+"/slides/",vid.slides,F,player.getPlayState()==mediaPlayerStates.PS_STOPPED,false,vid.pid)}}function updateUsageStats(A){if(!deployment.logUrl){return }if(player.getDuration()>0){duration=player.getDuration()}else{duration=0}if(!A){A=0}if(A<prevPos||A>prevPos+2){if(accumTime>0){debug("Reporting usage due to a skip/stop: prev "+prevPos+" now "+A+" accumulated "+accumTime);reportUsage()}accumTime=0;startPos=A;prevPos=A}else{if(A==prevPos&&accumTime>2){debug("Reporting usage due to a stop: prev "+prevPos+" now "+A+" accumulated "+accumTime);reportUsage();startPos=A;accumTime=0}else{if(A>prevPos&&startPos!=0){if(lastUsageReport+config.logUploadInterval<(new Date()).getTime()){debug("Extra failsafe report: prev "+prevPos+" now "+A+" accumulated "+accumTime);reportUsage();accumTime=A-startPos;prevPos=A;startPos=A}else{accumTime=A-startPos;prevPos=A}}}}if(!lastUsageReport&&duration!=0){debug("Reporting startup: prev "+prevPos+" now "+A+" accumulated "+accumTime);reportUsage()}}var MAX_CACHE_SIZE=100;var noslides=new Image();noslides.origUrl="images/noslides.jpg";noslides.src="images/noslides.jpg";var beforeslides=new Image();beforeslides.origUrl="images/beforeslides.jpg";beforeslides.src="images/beforeslides.jpg";function getX(A){if(!isIE){return A.offsetLeft}else{return A.style.pixelLeft}}function getY(A){if(!isIE){return A.offsetTop}else{return(A&&A.style)?A.style.pixelTop:0}}function setOpacity(B,A){var C=B.style;if(isIE){C.filter=(C.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(A==1?"":" alpha(opacity="+A*100+")")}else{C.opacity=A}B._opacity=A}function getOpacity(A){return A._opacity||0}function SlideZoom(E){this.estSlideLoadTime=0.1;this.fullSize={x:800,y:600};this.backCompatFullSize={x:0,y:0};this.cache={get:function(G){if(G=="images/noslides.jpg"){return noslides}if(G=="images/beforeslides.jpg"){return beforeslides}return this.store[G]},contains:function(G){if(G=="images/noslides.jpg"){return true}if(G=="images/beforeslides.jpg"){return true}return this.store[G]!=undefined},isComplete:function(G){if(G=="images/noslides.jpg"){return true}if(G=="images/beforeslides.jpg"){return true}return this.store[G]&&this.store[G].complete},put:function(H,G){if(this.store[H]){for(var I=0;I<this.names.length;I++){if(this.names[I]==H){this.names.splice(I,1);break}}}this.store[H]=G;this.names[this.names.length]=H;if(this.names.length>MAX_CACHE_SIZE){this.expireOld()}},expireOld:function(){var G=Math.round(MAX_CACHE_SIZE/2);while(this.names.length>G){delete (this.store[this.names.shift()])}},clear:function(){this.names.length=0;this.store={}},store:{},names:[]};if(E){this.parent=E;this.elt=document.createElement("div");this.elt.id="sz_wrap";var F=this.parent.getElementsByTagName("img")[0];this.img=document.createElement("img");this.img.id="vl_slide";this.img.setAttribute("galleryimg","no");this.img2=document.createElement("img");this.img2.setAttribute("galleryimg","no");this.img2.id="sz_slide2";this.img2.src="images/beforeslides.jpg";setOpacity(this.img2,0);if(F&&F.src){this.img.src=F.src}this.parent.innerHTML="";this.parent.appendChild(this.elt);this.fullSize.x=beforeslides.naturalWidth||beforeslides.width||300;this.fullSize.y=beforeslides.naturalHeight||beforeslides.height||200;this.pdf=document.createElement("div");this.pdf.id="sz_pdf";this.pdf.style.width=this.elt.style.width;this.pdf.style.height=this.elt.style.height;this.parent.appendChild(this.pdf);this.setImgSizeToElt();var A=document.createElement("div");A.id="sz_slide2cont";A.style.width=this.elt.style.width;A.style.height=this.elt.style.height;A.appendChild(this.img2);this.elt.appendChild(A);this.elt.appendChild(this.img);this.overlay=document.createElement("div");setOpacity(this.overlay,0);this.overlay.id="sz_overlay";this.overlay.innerHTML='<div id="sz_overlaytext">Click to zoom</div>';this.overlay.style.height="140px";this.elt.appendChild(this.overlay);this.animCursor=document.createElement("img");this.animCursor.id="sz_animCursor";this.animCursor.src="images/common/cursor.png";this.elt.appendChild(this.animCursor);this.zoomAnim=document.createElement("div");this.zoomAnim.id="sz_zoomAnim";this.elt.appendChild(this.zoomAnim);this.elt.onmouseover=this.mouseOver.createDelegate(this);this.elt.onmouseout=this.mouseOut.createDelegate(this);this.elt.onmousedown=this.mouseDown.createDelegate(this);this.elt.onmouseup=this.mouseUp.createDelegate(this);this.elt.onmousemove=this.mouseMove.createDelegate(this);this.elt.ondblclick=this.dblClick.createDelegate(this);this.zoomed=false;this.isNoSlides=true}var C=document.createElement("div");C.id="sz_hover";var B=document.createElement("img");B.id="sz_hoverImg";document.getElementsByTagName("body")[0].appendChild(C);C.appendChild(B)}SlideZoom.prototype.setImgSizeToElt=function(A){if(isIE){windowX=parseInt(this.parent.currentStyle.width);windowY=parseInt(this.parent.currentStyle.height)}else{windowX=this.parent.clientWidth;windowY=this.parent.clientHeight}if(!this.isNoSlides&&window.vid&&!vid.extendedData.vpVersion&&deployment.staticMode&&(vid.categories.slideWidth||vid.extendedData.slideWidth)){imageX=vid.categories.slideWidth||vid.extendedData.slideWidth;imageY=vid.categories.slideHeight||vid.extendedData.slideHeight}else{if(windowX/windowY>this.fullSize.x/this.fullSize.y){imageY=Math.min(windowY,this.fullSize.y);imageX=Math.min(windowY*this.fullSize.x/this.fullSize.y,this.fullSize.x)}else{imageX=Math.min(windowX,this.fullSize.x);imageY=Math.min(windowX*this.fullSize.y/this.fullSize.x,this.fullSize.y)}}if(!A){this.img.style.width=imageX+"px";this.img.style.height=imageY+"px";this.img.style.left=Math.round((windowX-imageX)/2)+"px"}this.img2.style.width=imageX+"px";this.img2.style.height=imageY+"px";this.img2.style.left=Math.round((windowX-imageX)/2)+"px";if(this.isNoSlides){if(!A){this.img.style.top=Math.round((windowY-imageY)/2)+"px"}this.img2.style.top=Math.round((windowY-imageY)/2)+"px"}else{if(!A){this.img.style.top=Math.min(0,Math.round((windowY-imageY)/2))+"px"}this.img2.style.top=Math.min(0,Math.round((windowY-imageY)/2))+"px"}this.pdf.style.width=windowX+"px";this.pdf.style.height=windowY+"px";if(D("sz_pdfembed")){D("sz_pdfembed").style.width=windowX+"px";D("sz_pdfembed").style.height=windowY+"px"}this.elt.style.width=windowX+"px";this.elt.style.height=windowY+"px"};function Fade(F,G,A,E,C,B){this.elt=F;this.min=G;this.max=A;this.steps=E;this.ondone=B;this.cur=0;this.apply=C;if(F.fade){F.fade.cancel()}F.fade=this;this.easefn=function(H){return Math.sin(H*Math.PI/2)};C(F,G);this.handle=setTimeout(this.sz_fade.createDelegate(this),10)}Fade.prototype.scale=function(A,B){return(A(B/this.steps)*(this.max-this.min))+this.min};Fade.prototype.cancel=function(){clearTimeout(this.handle);this.elt.fade=undefined};Fade.prototype.sz_fade=function(){this.apply(this.elt,this.scale(this.easefn,this.cur),this.cur/this.steps);this.cur++;if(this.cur>this.steps){this.ondone(this.elt);this.elt.fade=undefined}else{this.handle=setTimeout(arguments.callee.createDelegate(this),10)}};SlideZoom.prototype.mouseOver=function(){if(this.canZoom){this.overlay.style.top=(this.elt.offsetHeight-140)+"px";this.overlay.style.width=this.elt.offsetWidth+"px";setOpacity(this.overlay,0.8)}};SlideZoom.prototype.mouseOut=function(){setOpacity(this.overlay,0)};SlideZoom.prototype.mouseDown=function(A){if(!A){A=window.event}if(A.button!=0&&!(isIE&&A.button==1)){return }setCapture(this.elt);if(!this.zoomed&&this.canZoom){this.zoom(A)}else{this.dragMouseStart={x:A.clientX,y:A.clientY};this.dragEltStart={x:getX(this.img),y:getY(this.img)}}preventDefault(A)};SlideZoom.prototype.dblClick=function(A){if(!A){A=window.event}if(A.button!=0){return }if(this.zoomed&&(this.zoomTime||0)+700<(new Date).getTime()){this.unZoom();this.elt.style.cursor='url("images/common/zoom.cur"), pointer';D("sz_overlaytext").innerHTML="Click to zoom"}};SlideZoom.prototype.zoom=function(C){debug("zoom");this.zoomed=true;this.elt.style.cursor="move";D("sz_overlaytext").innerHTML="Loading...";this.zoomTime=(new Date).getTime();D("sz_overlaytext").innerHTML="Drag the image, or double-click to zoom out";this.zoomAnim.style.left=C.clientX-absoluteX(this.elt)+"px";this.zoomAnim.style.top=C.clientY-absoluteY(this.elt)+"px";this.zoomAnim.style.width="0px";this.zoomAnim.style.height="0px";this.zoomAnim.style.visibility="visible";setOpacity(this.zoomAnim,1);new Fade(this.zoomAnim,0,500,4,function(J,N,L){var K=parseInt(J.style.width);var I=parseInt(J.style.left);var M=parseInt(J.style.top);J.style.width=N+"px";J.style.height=N+"px";J.style.left=Math.round(I-(N-K)/2)+"px";J.style.top=Math.round(M-(N-K)/2)+"px";setOpacity(J,1-L)},function(I){I.style.visibility="hidden"});var G=C.clientX-absoluteX(this.img);var F=C.clientY-absoluteY(this.img);var B=this.elt.offsetWidth-this.fullSize.x;var H=this.elt.offsetHeight-this.fullSize.y;var E=Math.round(Math.max(B,Math.min(0,-1*G/parseInt(this.img.style.width)*this.fullSize.x+G+parseInt(this.img.style.left))));var A=Math.round(Math.max(H,Math.min(0,-1*F/parseInt(this.img.style.height)*this.fullSize.y+F+parseInt(this.img.style.top))));this.img.style.left=E+"px";this.img.style.top=A+"px";this.img.style.width=this.fullSize.x+"px";this.img.style.height=this.fullSize.y+"px";this.img2.style.width=this.fullSize.x+"px";this.img2.style.height=this.fullSize.y+"px";this.img2.style.left=E+"px";this.img2.style.top=A+"px";this.img.src=this.getSlideUrl(this.prevSlide,deployment.staticMode,this.zoomed,this.prevHttpLink,this.fullSize.x,this.fullSize.y)};SlideZoom.prototype.unZoom=function(){debug("unzoom");this.zoomed=false;this.setImgSizeToElt();this.img.src=this.getSlideUrl(this.prevSlide,deployment.staticMode,this.zoomed,this.prevHttpLink,this.fullSize.x,this.fullSize.y)};SlideZoom.prototype.mouseUp=function(A){this.dragMouseStart=null;this.dragEltStart=null;releaseCapture(this.elt);preventDefault(A)};SlideZoom.prototype.mouseMove=function(B){if(this.dragMouseStart&&this.zoomed){if(!B){B=window.event}if(this.elt.offsetWidth<this.img.width){var E=(this.dragEltStart.x+(B.clientX-this.dragMouseStart.x));var A=this.elt.offsetWidth-this.img.width;this.img.style.left=Math.min(0,Math.max(A,E))+"px";this.img2.style.left=Math.min(0,Math.max(A,E))+"px"}if(this.elt.offsetHeight<this.img.height){var C=(this.dragEltStart.y+(B.clientY-this.dragMouseStart.y));var F=this.elt.offsetHeight-this.img.height;this.img.style.top=Math.min(0,Math.max(F,C))+"px";this.img2.style.top=Math.min(0,Math.max(F,C))+"px"}preventDefault(B)}};SlideZoom.prototype.animateCursor=function(){if(this.targetCursor){var C=(new Date()).getTime()-this.cursorAnimStart;if(C<=this.animTime&&this.animTime<3000&&player&&player.getPlayState()==PS_PLAYING){var B=Math.round((this.startCursor.x+(this.targetCursor.x-this.startCursor.x)*C/this.animTime)/this.xscale);var A=Math.round((this.startCursor.y+(this.targetCursor.y-this.startCursor.y)*C/this.animTime)/this.yscale);this.animCursor.style.left=(absoluteX(this.img)-32+B)+"px";this.animCursor.style.top=(absoluteY(this.img)-32+A)+"px"}else{this.animCursor.style.left=Math.round(absoluteX(this.img)-32+this.animCursor.x/this.xscale)+"px";this.animCursor.style.top=Math.round(absoluteY(this.img)-32+this.animCursor.y/this.yscale)+"px"}}};SlideZoom.prototype.setPdf=function(A){if(A!=this.prevPdfUrl){this.prevPdfUrl=A;this.pdfMode=true;this.elt.style.display="none";this.pdf.style.display="block";this.pdf.innerHTML='<embed src="'+A+'#toolbar=0&navpanes=0&scrollbar=1" id="sz_pdfembed" style="width:'+this.pdf.style.width+"; height:"+this.pdf.style.height+'"/>'}};SlideZoom.prototype.setSlide=function(C,A,F,E){this.pdf.style.display="none";this.elt.style.display="block";if(!this.elt){return }this.isNoSlides=false;this.fullSize.x=A.width||this.backCompatFullSize.x;this.fullSize.y=A.height||this.backCompatFullSize.y;var B=this.getSlideUrl(A.url,deployment.staticMode,this.zoomed,C,this.fullSize.x,this.fullSize.y);this.prevSlide=A.url;this.prevZoomed=this.zoomed;this.prevHttpLink=C;this.enableZoom(A);this._setSlide(B,E);if(A.cursor){if(this.zoomed){this.xscale=1;this.yscale=1}else{this.xscale=A.width/this.elt.offsetWidth;this.yscale=A.height/this.elt.offsetHeight}this.animCursor.style.left=(absoluteX(this.elt)-32+Math.round(A.cursor.x/this.xscale))+"px";this.animCursor.style.top=(absoluteY(this.elt)-32+Math.round(A.cursor.y/this.yscale))+"px"}this.startCursor=A.cursor};SlideZoom.prototype.setNoSlide=function(A){if(!this.elt){return }if((A&&this.prevUrl==beforeslides.origUrl)||(!A&&this.prevUrl==noslides.origUrl)){return }this.prevZoomed=this.zoomed;this.enableZoom(false);this.isNoSlides=true;if(A){this.fullSize.x=beforeslides.naturalWidth||beforeslides.width||300;this.fullSize.y=beforeslides.naturalHeight||beforeslides.height||200;this.prevSlide=beforeslides.origUrl;this.prevHttpLink=beforeslides.origUrl;this._setSlide(beforeslides.origUrl,false)}else{this.prevSlide=noslides.origUrl;this.prevHttpLink=noslides.origUrl;this.fullSize.x=noslides.naturalWidth||noslides.width||300;this.fullSize.y=noslides.naturalHeight||noslides.height||200;this._setSlide(noslides.origUrl,false)}};SlideZoom.prototype._setSlide=function(A,B){if(this.prevUrl!=A||B){if(!this.cache.isComplete(A)){return }this.prevUrl=A;if(config.enableSlideFade&&(!isIE||isIE7)){if(!this.zoomed){this.setImgSizeToElt(true)}setOpacity(this.img2,0);this.img2.src=this.cache.get(A).src;new Fade(this.img2,0,1,10,setOpacity,function(){if(!this.zoomed){this.setImgSizeToElt()}this.img.onload=function(){this.img.onload=null;setOpacity(this.img2,0)}.createDelegate(this);this.img.src=this.img2.src}.createDelegate(this))}else{if(!this.zoomed){this.setImgSizeToElt()}this.img.src=this.cache.get(A).src}}};SlideZoom.prototype.enableZoom=function(A){if(A&&(this.fullSize.x>this.elt.offsetWidth||this.fullSize.y>this.elt.offsetHeight)){this.canZoom=true;if(this.zoomed){if(this.elt.style.cursor.indexOf("move")==-1){this.elt.style.cursor="move"}}else{if(this.elt.style.cursor.indexOf("zoom.cur")==-1){this.elt.style.cursor='url("images/common/zoom.cur"), pointer'}}}else{if(this.zoomed){this.unZoom()}this.canZoom=false;if(this.elt.style.cursor.indexOf("default")==-1){this.elt.style.cursor="default"}if(getOpacity(this.overlay)!=0){setOpacity(this.overlay,0)}}};SlideZoom.prototype.updateSize=function(){this.setImgSizeToElt();this.enableZoom(this.canZoom)};SlideZoom.prototype.getSlideUrl=function(A,K,G,B,F,E){var C;if(!A){A=""}if(!B){C=""}else{if(A){if(G||!K){C=B+"full_res/"}else{C=B+"www_res/"}}else{C=B}}if(K||G){return C+A}else{var N=(A.indexOf("?")!=-1)?"&":"?";var M,L;var J,I;if(isIE){M=parseInt(this.elt.currentStyle.width);L=parseInt(this.elt.currentStyle.height)}else{M=Math.floor(this.elt.offsetWidth-1);L=Math.floor(this.elt.offsetHeight-1)}if(M/L>this.fullSize.x/this.fullSize.y){I=Math.min(L,E);J=Math.min(Math.round(L*this.fullSize.x/this.fullSize.y),F)}else{J=Math.min(M,F);I=Math.min(Math.round(M*this.fullSize.y/this.fullSize.x),E)}if(C.indexOf("?")!=-1){var H=C.indexOf("=");return C.substr(0,H+1)+escape(C.substr(H+1)+A+N+"x="+J+"&y="+I)}else{return deployment.getSlideLink(C+A)+N+"x="+J+"&y="+I}}};SlideZoom.prototype.updateSlideAndCache=function(F,E,G,C,B,L){if(L!=this.prevPid){this.backCompatFullSize={};this.cache.clear();this.prevPid=L}if(!C&&E){if(!this.backCompatFullSize.x&&E.length!=0&&!E[0].width&&!this.slideSizeFinder){var R=E[0];this.slideSizeFinder=new Image();this.slideSizeFinder.owner=this;this.slideSizeFinder.onload=function(){this.owner.slideSizeFinder=null;this.owner.backCompatFullSize.y=this.naturalHeight||this.height;this.owner.backCompatFullSize.x=this.naturalWidth||this.width};debug("Determining slide size: "+this.getSlideUrl(R.url,deployment.staticMode,true,F,9999,9999));this.slideSizeFinder.src=this.getSlideUrl(R.url,deployment.staticMode,true,F,9999,9999);return }else{var M,I,P;var N=0;for(var J=0;J<E.length;J++){var Q=E[J];var K=J==E.length-1?null:E[J+1];var A=this.getSlideUrl(Q.url,deployment.staticMode,this.zoomed,F,Q.width||this.fullSize.x,Q.height||this.fullSize.y);if(this.cache.isComplete(A)&&Q.time<=G){M=Q;N=J;I=K}if(!P&&Q.time<G+60){if((!K||K.time>G+this.estSlideLoadTime-0.5)&&!this.cache.contains(A)){P=A}else{}}}}}if(!C&&P&&this.stillLoading!=true){var H=new Image();this.slideLoadStartTime=(new Date()).getTime();H.onload=function(){this.stillLoading=false;this.estSlideLoadTime=(this.estSlideLoadTime+((new Date()).getTime()-this.slideLoadStartTime)/1000)/2;debug("Finished cacheing ("+this.estSlideLoadTime+"s): "+P);if(this.cache.contains(P)){this.cache.get(P).complete=true}H=null}.createDelegate(this);H.onerror=function(){this.stillLoading=false;debug("Failed to get:"+P)}.createDelegate(this);this.stillLoading=true;var O=copyProps(H,["complete","src","naturalHeight","naturalWidth","width","height"]);O.src=P;this.cache.put(P,O);debug("Starting to cache: "+P);H.src=P}if(!M||C){if(B){this.setNoSlide(false)}else{if(C||E.length>0&&G<E[0].time){this.setNoSlide(true)}}}else{if(M.url!=window.prevShownUrl){debug("Showing slide "+N+" of "+E.length+": "+M.url);prevShownUrl=M.url}this.setSlide(F,M,I)}};szHover=function(E,J,I,B,A){if(E.src!=config.nothumbImg.src){var H=D("sz_hover");var G=D("sz_hoverImg");H.style.left=absoluteX(E)+E.offsetWidth+"px";var C=100;if(document.documentElement.clientHeight+document.documentElement.scrollTop+C<absoluteY(E)+E.offsetHeight/2+I){H.style.top=absoluteY(E)+(E.offsetHeight/2)-I+"px"}else{H.style.top=absoluteY(E)+(E.offsetHeight/2)+"px"}G.src=B;H.style.width=J+"px";H.style.height=I+"px";new Fade(H,0,1,15,setOpacity,function(){});H.style.display="block";if(!E.onmouseout){E.onmouseout=function(){H.style.display="none";G.src=""}}var F=new Image(J,I);F.onload=function(){G.src=F.src};F.src=A}};var containerDiv;var vidDiv;var slideDiv;var chaptersDiv;var infoDiv;var splitDiv;var homeDiv;window.onresize=function(){var A=document.documentElement;if(A.offsetWidth!=window.onresize.prevWidth||A.offsetHeight!=window.onresize.prevHeight){window.onresize.prevWidth=A.offsetWidth;window.onresize.prevHeight=A.offsetHeight;doResize()}else{return }};function doResize(){if(deployment.staticMode||staticLayout){var C=(window.innerHeight||document.documentElement.clientHeight)-8;if(outerContainer&&outerContainer.offsetLeft!=outerContainer.vl_origLeft&&outerContainer.offsetLeft>0){var B=[containerDiv,vidDiv,slideDiv,chaptersDiv,infoDiv,splitDiv,homeDiv];for(var A=0;A<B.length;A++){var E=B[A];if(E&&E.style){E.style.left=Math.max(0,outerContainer.offsetLeft+(E.vl_layoutLeft||0))+"px"}}}}else{refreshLayout()}}function refreshLayout(B){if(selectedVideoIdx==-1){if(!isIE6){containerDiv.style.width="auto";containerDiv.style.height="auto"}return }else{var A=folders[selectedFolderIdx].videos[selectedVideoIdx];if(!A){return }if(A.isLive=="LiveNow"&&!isIE){A.slides.length=0}var E,C;if(deployment.staticMode||staticLayout){if(A.slides.length==0&&!A.isLive){if(A.pdf){E=config.pdfWidth;C=config.pdfHeight}else{C=0;if((A.categories.videoWidth||A.extendedData.videoWidth||0)>640){E=0}else{C=1;E=400}}}else{E=(A.categories.slideWidth||A.extendedData.slideWidth||640)-0;C=(A.categories.slideHeight||A.extendedData.slideHeight||480)-0}}else{if(A.isLive){E=1024;C=768}else{if(A.slides.length>0){E=(A.slides[0].width||1024)-0;C=(A.slides[0].height||768)-0}else{if(A.pdf){E=config.pdfWidth;C=config.pdfHeight}}}}layout(B,!A.categories.vidOnRight,(A.categories.videoWidth||A.extendedData.videoWidth||320)-0,(A.categories.videoHeight||A.extendedData.videoHeight||240)-0,E,C,A.chapters.length>0?config.chaptersMinHeight:0)}}function initLayout(){containerDiv=D("vl_layoutcontainer");vidDiv=D("vl_mediaplayer");slideDiv=D("vl_slides");chaptersDiv=D("chapters");infoDiv=D("clipinfo");splitDiv=D("vl_layoutsplit");homeDiv=D("vl_homebutton");outerContainer=D("vl_layoutcontainer_outer");if(deployment.staticMode||staticLayout){splitDiv.style.cursor="default";splitDiv.onmousedown=function(){};splitDiv.onmouseover=function(){};splitDiv.onmouseout=function(){};splitDiv.onmouseup=function(){}}else{splitDiv.onmouseover=function(){splitDiv.className="splitHover"};splitDiv.onmouseout=function(){splitDiv.className=""};splitDiv.onmousedown=function(A){if(!A){A=window.event}splitDiv.dragging=true;splitDiv.initEvtX=A.clientX;splitDiv.initDivX=splitDiv.offsetLeft;setCapture(splitDiv);preventDefault(A)};splitDiv.onmouseup=function(A){if(!A){A=window.event}if(splitDiv.dragging){releaseCapture(splitDiv);splitDiv.dragging=false;refreshLayout(A.clientX-10);preventDefault(A)}};splitDiv.onmousemove=function(A){if(!A){A=window.event}if(splitDiv.dragging){splitDiv.style.left=A.clientX+(splitDiv.initDivX-splitDiv.initEvtX)+"px";preventDefault(A)}}}}var titlebarHeight=31;function layout(U,S,Y,X,I,H,W){var P=containerDiv.offsetWidth-2;var R=containerDiv.offsetHeight-containerDiv.offsetTop-2;var d=1;var c,a,B,f;if(!deployment.staticMode&&!staticLayout){if(!U){var O=true;U=S?Y:P-Y-config.splitWidth}U=Math.max(config.vidMinWidth,Math.min(U,P-200));if(!isIE6){containerDiv.style.width="auto";containerDiv.style.height="auto"}}else{U=S?Math.max(config.vidMinWidth,Y):I;var L=I+Math.max(config.vidMinWidth,Y)+config.splitWidth;var N=Math.min(X+config.vidButtonsHeight,H);var C=Math.max(X+config.vidButtonsHeight,H);if(!I){var K=C+config.infoMinHeight}else{K=(N+W+config.infoMinHeight>C)?C+config.infoMinHeight:Math.max(N+W+d+config.infoMinHeight,C)}if(outerContainer){var A=outerContainer.offsetWidth-containerDiv.offsetWidth+L;outerContainer.style.width=Math.max(0,Math.round(A))+"px"}containerDiv.style.width=Math.round(L+25)+"px";containerDiv.style.height=Math.round(K+25)+"px";window.requestedX=L+2*absoluteX(containerDiv);window.requestedY=K+absoluteY(containerDiv);var G=L<P;P=L;R=K;if(!config.noResize&&(deployment.staticMode||staticLayout)&&(config.resizeCanShrink||!G)){try{window.resizeTo(requestedX,requestedY);setTimeout(function(){try{window.resizeTo(window.requestedX+(window.requestedX-document.documentElement.clientWidth),window.requestedY+(window.requestedY-document.documentElement.clientHeight))}catch(g){}},500)}catch(Z){}}}var E=300;if(!I){var Q=R-config.vidButtonsHeight;if(Y/X>(P-E)/Q){var M=(P-E)*(P-E)*X/Y}else{M=Q*Q*Y/X}if(Y/X>P/(Q-config.infoMinHeight)){var T=P*P*X/Y}else{T=(Q-config.infoMinHeight)*(Q-config.infoMinHeight)*Y/X}var V=T>M;if(!V){I=E;H=0;if(O){if(S){U=P-config.splitWidth-I}else{U=I}}}}if(V){c=P;a=Math.min(X*c/Y+config.vidButtonsHeight,R-config.infoMinHeight);setBounds(vidDiv,0,0,c,a);setBounds(homeDiv,0,0,c,a);setBounds(slideDiv,0,0,0,0);setBounds(splitDiv,0,0,0,0);if(W>0){setBounds(infoDiv,0,a,c/2,W?R-a:0);setBounds(chaptersDiv,c/2,a,c/2,R-a)}else{setBounds(chaptersDiv,0,0,0,0);setBounds(infoDiv,0,a,c,R-a)}}else{c=S?U:P-config.splitWidth-U;B=S?P-config.splitWidth-U:U;if(X){a=X*c/Y+config.vidButtonsHeight}else{a=config.vidButtonsHeight-8}a=Math.min(R,a);f=H/I*B;vspaceV=R-a;vspaceS=R-f;var b=S?0:U+config.splitWidth;var F=S?U+config.splitWidth:0;setBounds(splitDiv,S?c:B,0,config.splitWidth,R);if(vspaceV>vspaceS){if(vspaceV-W>vspaceS){a=Math.min(a,R-W-config.infoMinHeight);setBounds(vidDiv,b,0,c,a);setBounds(homeDiv,b,0,c,a);setBounds(slideDiv,F,0,B,R);setBounds(chaptersDiv,b,a+1,c,W-d);setBounds(infoDiv,b,a+W,c,R-a-W)}else{a=Math.min(a,R-W);f=Math.min(f,R-config.infoMinHeight);setBounds(vidDiv,b,0,c,a);setBounds(homeDiv,b,0,c,a);setBounds(slideDiv,F,0,B,f);setBounds(chaptersDiv,b,a+1,c,W?R-a:0);setBounds(infoDiv,F,f,B,R-f)}}else{if(vspaceS-W>vspaceV){f=Math.min(f,R-W-config.infoMinHeight);setBounds(slideDiv,F,0,B,f);setBounds(vidDiv,b,0,c,a);setBounds(homeDiv,b,0,c,a);setBounds(chaptersDiv,F,f,B,W-d);setBounds(infoDiv,F,f+W,B,R-f-W)}else{a=Math.min(a,R-config.infoMinHeight);f=Math.min(f,R-W);setBounds(vidDiv,b,0,c,a);setBounds(homeDiv,b,0,c,a);setBounds(slideDiv,F,0,B,f);setBounds(infoDiv,b,a,c,R-a);setBounds(chaptersDiv,F,f,B,W?R-f:0)}}}a=Math.max(0,a);c=Math.max(0,c);player.resizeTo(c,a);D("videotabs").style.height=Math.max(0,infoDiv.offsetHeight-D("info_tab_buttons").offsetHeight-16)+"px";if(homeDiv.previewImg){homeDiv.style.backgroundImage='url("'+homeDiv.previewImg.replace("\\","\\\\")+"?x="+Math.round(c)+"&y="+Math.round(a)+'&bars=0")';homeDiv.style.backgroundPosition="center center";homeDiv.style.backgroundRepeat="no-repeat"}sz.updateSize();var J=D("vl_chaptersSelect");if(J.getAttribute("size")>1&&W>0){J.style.height=chaptersDiv.offsetHeight+"px"}if(config.layoutHook){config.layoutHook()}}function setBounds(F,E,C,B,A){F.vl_layoutLeft=Math.max(0,Math.round(E));F.style.left=Math.max(0,Math.round(E))+"px";F.style.top=Math.max(0,Math.round(C))+"px";F.style.width=Math.max(0,Math.round(B))+"px";F.style.height=Math.max(0,Math.round(A))+"px";if(A<3||B<3){F.style.display="none"}else{F.style.display="block"}}function toggleVisibility(A){s=D(A).style;s.visibility=="visible"?s.visibility="hidden":s.visibility="visible"}function toggleDisplay(A){s=D(A).style;s.display=="block"?s.display="none":s.display="block"}function showLinks(B){btn=D(B);var A=D("permalink");A.style.top=parseInt(absoluteY(btn)+btn.offsetHeight-A.offsetHeight)+"px";A.style.left=parseInt(absoluteX(btn)-A.offsetWidth)+"px";toggleVisibility("permalink")}function selectTab(B,F){if(B.className.indexOf("visible_false")!=-1){selectTab(D("tab_button_overview"),"tab_overview");return }var C=D(F).parentNode;var A=getElementsByClass(document.rootElement,"tab_selected");for(i=0;i<A.length;i++){A[i].className="tab_hidden"}D(F).className="tab_selected";C=B.parentNode;for(i in C.childNodes){var E=C.childNodes[i];if(E.nodeType==1&&E.tagName==B.tagName){if(E.className.indexOf("visible_false")==-1){E.className="tab_button"}}}B.className="tab_button_selected";window.prevSelectedTab=F;window.prevSelectedTabButton=B}function timgerror(A){A.onerror=null;A.src=config.nothumbImg.src}function getThumbCode(){if(!window.browserDetected){configureForBrowser()}if(config.thumbnail.ie6y&&isIE6){config.thumbnail.y=config.thumbnail.ie6y}return'<a href="javascript:selectVideo($pid, \'$folder::jsEscape\')"><img onerror="timgerror(this)" onmouseover="hover(this, \'$httplink::jsEscape\')"class="thumbnail" style="width:'+config.thumbnail.x+"px;"+(config.thumbnail.y?";height:"+config.thumbnail.y+"px":"")+'" src="$httplink|preview.jpg?x='+config.thumbnail.x+"&y="+config.thumbnail.y+'"/></a>'}function hover(B,A){if(!window.browserDetected){configureForBrowser()}if(config.thumbnail.ie6y&&isIE6){config.thumbnail.y=config.thumbnail.ie6y}if(config.hover&&B.onerror){return szHover(B,config.hover.x,config.hover.y,A+"preview.jpg?x="+config.thumbnail.x+"&y="+config.thumbnail.y,A+"preview.jpg?x="+config.hover.x+"&y="+config.hover.y)}else{return false}}function initTabs(){window.config.subtitlesHook=function(A){if(!A||A.length==0){D("tab_button_subtitles").style.display="none";D("tab_subtitles").style.display="none"}else{D("tab_button_subtitles").style.display="inline"}}}function fullScreen(){if(player.getPlayState()==mediaPlayerStates.PS_PLAYING){player.setFullScreen(true)}};
