/* BUILD 1 on Sun Mar  1 13:02:30 2009 */
if(!("console" in window)||!("firebug" in console)){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.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)}};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 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 configureForBrowser(){window.isIE7=false;if(document.all){window.isIE=true;window.isSafari=false;window.isFirefox=false;debug("this is IE");getEltContent=ie_getEltContent;selectMultiElements=ie_selectMultiElements;selectElement=ie_selectElement;if(navigator.appVersion.indexOf("7.0")!=-1){window.isIE7=true}}else{if(navigator.appVersion.indexOf("Safari")!=-1){window.isSafari=true;window.isIE=false;window.isFirefox=false;debug("this is safari");getEltContent=safari_getEltContent;selectMultiElements=ns_selectMultiElements;selectElement=ns_selectElement}else{window.isIE=false;window.isSafari=false;window.isFirefox=true;debug("this is firefox");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}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};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(D,G,F,B,E){var A=Math.random();var C=function(){doReadyStateChange(A,G,B)};(function(){if(window.XMLHttpRequest){var H=new XMLHttpRequest()}else{if(window.ActiveXObject){var H=new ActiveXObject("Microsoft.XMLHTTP")}}if(H){dodgyreferences[A]={};dodgyreferences[A].URL=D;dodgyreferences[A].xhr=H;H.onreadystatechange=C;H.open("GET",D,F);if(cacheTimes[D]&&!E){H.setRequestHeader("If-Modified-Since",cacheTimes[D].toGMTString())}else{}try{H.send(null)}catch(I){if(B){B(H)}}}})()}function doReadyStateChange(A,C,B){var D=dodgyreferences[A].xhr;if(!D||!D.readyState){return }if(self.showStatus){if(D.readState==4||!isIE){showStatus(D.responseText.length+" bytes loaded")}}if(D.readyState==4){try{if(D.status&&(D.status==200||D.status==304)){if(C){if(D.status==200){var E=new Date(D.getResponseHeader("Last-Modified"));if(E+""!="NaN"){cacheTimes[dodgyreferences[A].URL]=E}else{if(!cacheTimes[dodgyreferences[A].URL]){cacheTimes[dodgyreferences[A].URL]=new Date(0)}}}C(D,dodgyreferences[A].URL)}}else{if(B){B(D,dodgyreferences[A].URL)}else{}}}finally{D=null;delete (dodgyreferences[A])}}}function unserialize(C,A){for(var D=0;D<C.childNodes.length;D++){var E=C.childNodes[D];if(E.nodeType!=1){continue}var B=E.getAttribute("name");if(String(B).match("^[^a-zA-Z]")){B="_"+B}if(E.tagName=="object"){A[B]=new Object();unserialize(E,A[B])}else{A[B]=getContent(E)}}};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 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(A,B,E){var C={elt:A,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(F){switch(this.type){case"ie":case"fx":this.pendingProps["controls.currentPosition"]=F;break;case"flip4mac":case"wmp6":this.pendingProps.CurrentPosition=F;break;case"vlc2":this.pendingProps["input.time"]=Math.round(F*1000);break}this.doPending()},setUrl:function(F){switch(this.type){case"ie":case"fx":this.pendingProps.URL=F;break;case"flip4mac":case"wmp6":this.pendingProps.FileName=F;break;case"vlc2":if(this.isAlive()){this.elt.playlist.items.clear()}this.pendingProps.URL=F;break}if(F!=""){this.doPending()}},getUrl:function(){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.play()}}},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.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(F){switch(this.type){case"ie":case"fx":this.pendingProps["settings.volume"]=F;break;case"flip4mac":case"wmp6":this.pendingProps.Volume=(F>0)?Math.round(-5000*(2-(Math.log(F)/Math.log(10)))):-10000;break;case"vlc2":this.pendingProps["audio.volume"]=F*2;break}this.doPending()},setMute:function(F){if(this.isAlive()){switch(this.type){case"ie":case"fx":this.elt.settings.mute=(F?true:false);break;case"flip4mac":case"wmp6":this.elt.Mute=(F?true:false);break;case"vlc2":this.elt.audio.mute=(F?true:false)}}},getStatistics:function(F){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(G){return{}}break;case"flip4mac":case"wmp6":return{};break;case"vlc2":return{}}}},getMute:function(F){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);case"vlc2":return translateVLCPlayState(this.elt.input.state)}}},setFullScreen:function(F){switch(this.type){case"ie":case"fx":this.elt.fullScreen=F;break;case"flip4mac":case"wmp6":this.elt.DisplaySize=F?3:1;break;case"vlc2":this.elt.video.fullscreen=F;break}},resizeTo:function(F,J){switch(this.type){case"fx":if(this.isAlive()&&(this.elt.offsetWidth!=F||this.elt.offsetHeight!=J)){var H=this.getUrl();var I=this.getCurrentPosition();var G=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"]=false;this.pendingProps.stretchToFit=true;this.setUrl(H);if(G!=mediaPlayerStates.PS_STOPPED&&G!=mediaPlayerStates.PS_READY&&G!=mediaPlayerStates.PS_MEDIAENDED){this.setCurrentPosition(I)}this.setPendingState(G);this.elt.style.width=F+"px";this.elt.style.height=J+"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=F+"px";this.elt.style.height=J+"px";break}},setPendingState:function(F){this.pendingPlayState=F;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 G in this.pendingProps){if(G=="playState"){}else{if(this.type=="vlc2"&&G=="URL"){var H="";var F=this.pendingProps[G];if(F.indexOf("://")==-1){location.protocol+"//"+location.host+escape(this.pendingProps[G])}else{if(F.indexOf("emcast://")!=-1){H="udp://@"+F.substr(9)}else{H=F}}debug("Setting VLC mrl to "+H);var K=this.elt.playlist.add(H,"",":vout-filter=deinterlace :deinterlace-mode=bob");debug("resultant id is "+K)}else{var J=G.split(".");try{if(J.length==1){this.elt[J[0]]=this.pendingProps[G];debug("Setting "+J[0]+" to "+this.pendingProps[G])}else{if(J.length==2){this.elt[J[0]][J[1]]=this.pendingProps[G]}}}catch(I){}}}}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(A.tagName.toLowerCase()=="div"){if(E||(!isWindows&&B)){if(isIE||navigator.mimeTypes["application/x-vlc-plugin"]&&navigator.mimeTypes["application/x-vlc-plugin"].enabledPlugin){if(isIE){A.innerHTML='<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"  codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0"  id="vl_genMediaPlayer"  events="True" VIEWASTEXT> 	<param name="ShowDisplay" value="True" /></object> '}else{A.innerHTML='<embed type="application/x-vlc-plugin"  id="vl_genMediaPlayer" version="VideoLAN.VLCPlugin.2"  showdisplay="true"  /> '}C.type="vlc2"}else{A.innerHTML='<div id="vl_genMediaPlayer"><p>You require a plugin to view the media on this page.</p><p> <a href="http://www.videolan.org">Click here</a> to download <b>VLC</b>, the recommended plugin for your platform.</p>';C.type="none"}window.onunload=function(){try{D("vl_genMediaPlayer").parentNode.innerHTML=""}catch(F){}}}else{if(isIE||(isWindows&&isSafari)){debug("plugin for IE");A.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>';C.type="ie"}else{if(isMac){debug("plugin for safari");if(navigator.mimeTypes["video/x-ms-wmv"]){A.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){C.type="flip4mac"}else{C.type="vlc"}}else{A.innerHTML='<div id="vl_genMediaPlayer"><p>You require a plugin to view the media on this page.</p><p> <a href="http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx" target="_blank">Click here</a> to download <b>flip4mac</b>, the recommended plugin. When you have finished, press F5 to refresh this page.</p>';C.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"){A.innerHTML='<object id="vl_genMediaPlayer" type="video/x-ms-wvx"><param name="ShowPositionControls" value="false"/></object>';if(isWindows){C.type="fx"}else{C.type="flip4mac"}window.OnDSScriptCommandEvt=function(F,G){if(F=="EMSLIDE"){if(C.onSlide){C.onSlide(G)}}}}else{A.innerHTML='<div id="vl_genMediaPlayer"><p>You require a plugin to view the media on this page.</p><p> <a href="javascript:forcePlugin()">Click here</a> to download the plugin. When you have finished, press F5 to refresh this page.</p>';C.type="none"}}else{if(isLinux&&isFirefox){A.innerHTML='<embed type="application/x-vlc-plugin"  id="vl_genMediaPlayer" version="VideoLAN.VLCPlugin.2"  showdisplay="true"  /> ';C.type="vlc2"}else{A.innerHTML='<div id="vl_genMediaPlayer"><p>Sorry we are unable to determine the correct plugin to display video on your platform.</p>';C.type="none"}}}}}A=D("vl_genMediaPlayer");C.pendingProps={stretchToFit:true,StretchToFit:true,"settings.autoStart":true,AutoStart:true};C.elt=A}else{C.type="wmp6"}return C};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 player;var sz;var subtitlesDiv;var statusDiv;var _matched;var _matchDescription;var searchText;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={nothumbImg:{img:new Image(100,75),src:"images/nothumbnail.jpg?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"},doBreadcrumbs:doBreadcrumbs,linkPathName:window.location.pathname,setUIMode:function(A){},vidMinWidth:230,allSlidesAreChapters:false,subtitlesHook:null,enableSlideFade:true,logUploadInterval:120000};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);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;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(B){configureForBrowser();parseParams(unescape(location.search));if(window.fixupVid){fixupVid()}if(!window.config){window.config={}}if(!window.deployment){window.deployment={}}for(i in configDefaults){if(config[i]==undefined){config[i]=configDefaults[i]}}for(i in deploymentDefaults){if(deployment[i]==undefined){deployment[i]=deploymentDefaults[i]}}for(i in {nothumbImg:0,plusimg:0,minusimg:0,nochildrenimg:0}){config[i].img.src=config[i].src;config[i]=config[i].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)}sz=new SlideZoom(D("vl_slides"));initLayout();for(i in modeTypes){modes[modeTypes[i]]=D("vl_"+modeTypes[i])}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(i in templates){var A=templates[i];A.container=D(i+"Container");A.html=A.html||"";A.prefix=A.prefix||"";A.suffix=A.suffix||"";A.tokens=makeTokens(A.html);A.setData=function(F,G){var C=this.prefix+G+this.suffix;if(this.hook){C=this.hook(F,C)}if(this.container){this.container.innerHTML=C;var H=this.container.getElementsByTagName("img");for(var E=0;E<H.length;E++){if(!H[E].onerror&&H[E].src.indexOf("preview")!=-1){H[E].onerror=function(){this.onerror=null;debug("Failed to load image: "+this.src);this.src=window.config.nothumbImg.src}}}}if(this.postHook){C=this.postHook(F)}}}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}setTimeout(function(){setInterval(processSlides,200);if(!B&&!deployment.staticMode){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(B,A){if(B=="title"){vidSortProp="title";vidSortAsc=true}else{if(B=="titleR"){vidSortProp="title";vidSortAsc=false}else{if(B=="date"){vidSortProp="creationDate";vidSortAsc=true}else{if(B=="dateR"){vidSortProp="creationDate";vidSortAsc=false}else{if(B=="length"){vidSortProp="length";vidSortAsc=true}else{if(B=="lengthR"){vidSortProp="length";vidSortAsc=false}else{if(B=="folder"){vidSortProp="folder";vidSortAsc=true}}}}}}}if(A){searchResults()}else{showVideos()}}function setSelectedSort(A){if(vidSortProp=="title"){A.value=vidSortAsc?"title":"titleR"}else{if(vidSortProp=="creationDate"){A.value=vidSortAsc?"date":"dateR"}else{if(vidSortProp=="length"){A.value=vidSortAsc?"length":"lengthR"}else{if(vidSortProp=="folder"){A.value=vidSortAsc?"folder":"folderR"}}}}}function expandFolder(E,A){var C=0;var B=templates.folderTemplate.container;while(E.className!="vl_folder_row"){E=E.parentNode}var G=getFolderButton(E);if(G==""||G==config.nochildrenimg.src){return }var H=A||(G==config.plusimg.src);var F=getElementsByClass(B,"vl_folder_row","table");var C=-1;while(C<F.length-1&&F[++C]!=E){}C++;while(C<F.length&&(parseInt(F[C].style.marginLeft)||0)>(parseInt(E.style.marginLeft)||0)){if(H){if((parseInt(F[C].style.marginLeft)||0)-(parseInt(E.style.marginLeft)||0)<=templates.folderTemplate.options.folderIndentPx){F[C].parentNode.style.display="block";if(getFolderButton(F[C].parentNode)==config.minusimg.src){setFolderButton(F[C].parentNode,config.plusimg.src)}}}else{F[C].parentNode.style.display="none"}++C}setFolderButton(E,H?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 compareVids(I,G){var B=0;if(typeof (I[vidSortProp])=="string"||I[vidSortProp] instanceof String){var E=I[vidSortProp].toLowerCase();var C=G[vidSortProp].toLowerCase();var F=new RegExp(/(\D*)(\d*)(\D*)(.*)/);var A=F.exec(E);F.index=0;var H=F.exec(C);if(A[1]>H[1]){B=1}else{if(A[1]<H[1]){B=-1}else{if(A[2]-0>H[2]-0){B=1}else{if(A[2]-0<H[2]-0){B=-1}else{if(A[3]>H[3]){B=1}else{if(A[3]<H[3]){B=-1}else{if(A[4]-0>H[4]-0){B=1}else{if(A[4]-0<H[4]-0){B=-1}else{B=0}}}}}}}}}else{B=I[vidSortProp]>G[vidSortProp]?1:-1}if(vidSortAsc){return B}else{return -B}}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(I){if(I.status==304){showStatus("");setTimeout(getLiveStatuses,500);return }showStatus("Got "+I.responseText.length+" bytes of xml...");debug("Toc has changed - processing");if(!I.responseXML){debug("Invalid toc, retrying ");if(isSafari){setTimeout(function(){location.reload()},1000)}return }folders.length=0;allVids.length=0;liveUrlsToQuery={};var K=I.responseXML.getElementsByTagName("live");if(K.length>0){liveUrlsToQuery[K[0].getAttribute("defaultLiveUrl")]=1}K=I.responseXML.getElementsByTagName("service");for(var E=0;E<K.length;E++){var B=K.item(E);var A=new Object();var F=B.getAttribute("name").split(/\//);A.level=F.length-1;if(A.level==0){A.toplevel="toplevel"}else{A.toplevel=""}A.indent=A.level*templates.folderTemplate.options.folderIndentPx;A.name=F[F.length-1];A.path=B.getAttribute("name");A.sid=B.getAttribute("sid");folders.push(A);A.videos=new Array();A.videos.length=0;var G=selectMultiElements(B,"video");for(var C=0;C<G.length;C++){var J=createVideoFromXml(A,G.item(C));A.videos.push(J);allVids.push(J);if(allVids.length%10==0){showStatus(allVids.length+" videos loaded...")}}A.numVids=A.videos.length}debug("Processed folders");for(var E in liveVids){if(liveVids[E].isFake){addFakeVid(liveVids[E])}}setTimeout(getLiveStatuses,500);showStatus("Sorting data");if(config.sortFolders){config.sortFolders(folders)}else{folders.sort(compareFolders)}folderContentChanged=true;videoContentChanged=true;frontPageContentChanged=true;var H=false;if(needToJump){needToJump=false;if(params.jump||params.search){H=jumpToLocation(params.jump,params.search)}}if(!H){selectVideo(selectedVideoPid,selectedFolderName)}showStatus("")}function getLiveStatuses(){if(deployment.liveUrl){for(i in liveUrlsToQuery){loadXMLDoc(deployment.liveUrl+escape(i)+"/livestatus.xml",handleLiveStatus,true)}}}function createVideoFromXml(A,I){var M=new Object;M.pid=I.getAttribute("pid");M.length=I.getAttribute("lengthsecs");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.title=getEltContent(I,"title");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");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.folderUrl=location.protocol+"//"+location.host+config.linkPathName+"?"+escape(M.folder);M.url=M.folderUrl+":"+M.pid;return M}function refresh(){if(!deployment.tocUrl){return }showStatus("Fetching data...");parseParams(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){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(A){currentMode=A;for(i in modes){if(!modes[i]||!modes[i].style){continue}if(i==A){modes[i].style.display="block"}else{modes[i].style.display="none"}}if(config.setUIMode){config.setUIMode(A)}D("sz_hover").style.display="none";refreshLayout();setTimeout(doResize,50)}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 substituteProperties(H,E,K){var L="";for(var F in H){var J=H[F];if(J.type=="text"){L+=J.text}else{if(J.type=="subtemplate"){if(!E[J.property]){continue}var I=J.max>0?Math.min(J.max,E[J.property].length):E[J.property].length;for(var C=0;C<I;C++){L+=substituteProperties(J.tokens,E[J.property][C],null)}}else{if(J.type=="property"){if(J.property.indexOf(".")!=-1){var A=E;var B=J.property.split(".");for(C in B){A=A[B[C]];if(!A){break}}}else{var A=E[J.property];if(!A){A=""}}if(J.property=="httplink"){A=deployment.getSlideLink(A)}if(A!=null){switch(J.format){case"jsEscape":A=A.replace(/\'/g,"\\'");A=A.replace(/\"/g,"%22");break;case"urlEscape":A=escape(A);break;case"searchHilight":A=hilightMatch(K,A,true);break;case"hideIndex":A=A.replace(/^\d+\)\s*/,"");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 G=A.toLocaleTimeString();A=G.substring(0,G.lastIndexOf(":"))}break;case"":break}L+=""+A}else{L+=J.property}}}}}return L}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])}showRecent();templates.folderTemplate.setData(folders,B);config.doBreadcrumbs()}function showRecent(){frontPageContentChanged=false;var F="";vidSortProp="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(A.isLive=="LiveNow"){C++;F+=substituteProperties(templates.featLiveVideoTemplate.tokens,A)}}for(i=0;i<allVids.length&&C<B;i++){var A=allVids[i];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(A.categories.featured){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(!A.categories.featured&&!A.isLive&&!A.categories.notFeatured){C++;F+=substituteProperties(templates.recentTemplate.tokens,A)}}templates.recentTemplate.setData(allVids,F)}function showVideos(){folderContentChanged=false;var B="";if(templates.videoTemplate.options.sortAsc){vidSortAsc=templates.videoTemplate.options.sortAsc}setSelectedSort(D("vl_sortselect"));folder=folders[selectedFolderIdx];if(D("vl_folder_name")){D("vl_folder_name").innerHTML=folder.name}if(D("vl_folder_numVids")){D("vl_folder_numVids").innerHTML=folder.videos.length}folder.videos.sort(compareVids);for(i in folder.videos){var A=folder.videos[i];if(A.isLive=="Announce"){B+=substituteProperties(templates.announcementTemplate.tokens,A)}else{if(A.isLive=="LiveNow"){B+=substituteProperties(templates.liveVideoTemplate.tokens,A)}else{B+=substituteProperties(templates.videoTemplate.tokens,A)}}}templates.videoTemplate.setData(folder.videos,B);config.doBreadcrumbs()}function doBreadcrumbs(B){var E="<a href=\"javascript:selectFolder('')\"><b>HOME</b></a>";if(B){E+='::<a onclick="">Search Results</a>'}else{var A="";if(selectedFolderIdx==-1){parts=[]}else{parts=folders[selectedFolderIdx].path.replace(/^\d+\)\s*/,"").split("/")}var C;for(C=0;C<parts.length;C++){A=parts.slice(0,C+1).join("/");E+="&nbsp;::&nbsp;<a href=\"javascript:selectFolder('"+A+"')\">"+parts[C]+"</a>"}if(selectedVideoIdx!=-1){E+='&nbsp;::&nbsp;<a href="javascript:player.stop();player.play();">'+folders[selectedFolderIdx].videos[selectedVideoIdx].title+"</a>";if(D("vl_breadcrumbs")){D("vl_vbreadcrumbs").innerHTML=E}else{if(D("vl_breadcrumbs")){D("vl_breadcrumbs").innerHTML=E}}}else{if(selectedFolderIdx!=-1){if(D("vl_breadcrumbs")){D("vl_breadcrumbs").innerHTML=E}}}}}function searchResults(A,B){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 }setMode("searchResults");setSelectedSort(D("vl_ssortselect"));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];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&&vid.chapters[j].jumpPid){matchDescription='<a href="javascript:selectVideo('+vid.chapters[j].jumpPid+", '"+escape(vid.chapters[j].jumpFolder)+"', "+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(i in searchMatches){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);config.doBreadcrumbs(true)}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(i in A.retrievedDownloads){var E=A.retrievedDownloads[i];if(E.name){var C=templates.downloadTemplate.html;C=C.replace("$icon",E.icon);C=C.replace("$url",E.url);C=C.replace("$name",E.name);B+=C}}templates.downloadTemplate.setData(A.retrievedDownloads,B)}function hilightMatch(E,C,B){E.exec("");if(!E.exec(C)){return 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,'<span class="searchMatchHilight">$1</span>');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;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(selectedFolderIdx==-1){selectedFolderName="";selectedVideoPid=-1;if(player&&player.getUrl()){player.stop()}if(frontPageContentChanged){setMode("frontpage");showFolders()}else{setMode("frontpage")}if(F!="***"&&F!=""){alert("Video Library could not find the folder associated with this item.")}}else{selectedFolderName=F;selectedVideoPid=-1;debug("selected: folder: "+F);if(player&&player.getUrl()){player.stop()}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))}}config.doBreadcrumbs();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){config.subtitlesHook()}}}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 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());parseParams(loadState());jumpToLocation(params.jump,params.search,true)}}catch(A){}}var showBackButtonCount=0;function processSlides(B){if(player.resizeStage){return }if(player.getPlayState()==mediaPlayerStates.PS_READY||player.getPlayState()==mediaPlayerStates.PS_STOPPED||player.getPlayState()==mediaPlayerStates.PS_MEDIAENDED){showBackButtonCount++;if(showBackButtonCount==40){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(selectedFolderIdx==-1||selectedVideoIdx==-1){sz.updateSlideAndCache("",null,0,true,true,0);return }vid=folders[selectedFolderIdx].videos[selectedVideoIdx];var F=window.player&&player.getCurrentPosition?player.getCurrentPosition():0;updateUsageStats(F);if(vid.isLive!="LiveNow"){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.elt=E;var F=E.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}E.innerHTML="";this.fullSize.x=beforeslides.naturalWidth||300;this.fullSize.y=beforeslides.naturalHeight||200;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.elt.currentStyle.width);windowY=parseInt(this.elt.currentStyle.height)}else{windowX=this.elt.clientWidth;windowY=this.elt.clientHeight}if(!this.isNoSlides&&window.vid&&!vid.extendedData.vpVersion&&deployment.staticMode){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"}};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 }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)}}if(A.stopPropagation){A.stopPropagation()}else{A.cancelBubble=true}if(A.preventDefault){A.preventDefault()}else{A.returnValue=false}};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;if(!A){A=window.event}if(A.stopPropagation){A.stopPropagation()}else{A.cancelBubble=true}};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.width){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"}if(B.stopPropagation){B.stopPropagation()}else{B.cancelBubble=true}if(B.preventDefault){B.preventDefault()}else{B.returnValue=false}}};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.setSlide=function(C,A,F,E){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||300;this.fullSize.y=beforeslides.naturalHeight||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||300;this.fullSize.y=noslides.naturalHeight||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){if(!this.zoomed){this.setImgSizeToElt(true)}this.img2.src=this.cache.get(A).src;new Fade(this.img2,0,1,10,setOpacity,function(){if(!this.zoomed){this.setImgSizeToElt()}this.img.src=this.img2.src;setTimeout(function(){setOpacity(this.img2,0)}.createDelegate(this),300)}.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 E=getElementsByClass(document.documentElement,"scroller");var C=(window.innerHeight||document.documentElement.clientHeight)-8;for(A=0;A<E.length;A++){E[A].style.height=Math.max(0,C-E[A].offsetTop)+"px"}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 F=B[A];if(F&&F.style){F.style.left=Math.max(0,outerContainer.offsetLeft+(F.vl_layoutLeft||0))+"px"}}}}else{refreshLayout()}}function refreshLayout(B){var F=getElementsByClass(document.documentElement,"scroller");var C=(window.innerHeight||document.documentElement.clientHeight)-8;for(i=0;i<F.length;i++){F[i].style.height=Math.max(0,C-F[i].offsetTop)+"px"}if(selectedVideoIdx==-1){return }else{var A=folders[selectedFolderIdx].videos[selectedVideoIdx];if(!A){return }if(A.isLive=="LiveNow"&&!isIE){A.slides.length=0}var G,E;if(deployment.staticMode||staticLayout){if(A.slides.length==0&&!A.isLive){E=0;if((A.categories.videoWidth||A.extendedData.videoWidth||0)>640){G=0}else{E=1;G=400}}else{G=(A.categories.slideWidth||A.extendedData.slideWidth||640)-0;E=(A.categories.slideHeight||A.extendedData.slideHeight||480)-0}}else{if(A.isLive){G=1024;E=768}else{if(A.slides.length>0){G=(A.slides[0].width||1024)-0;E=(A.slides[0].height||768)-0}}}layout(B,true,(A.categories.videoWidth||A.extendedData.videoWidth||320)-0,(A.categories.videoHeight||A.extendedData.videoHeight||240)-0,G,E,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.style.backgroundColor="gray"};splitDiv.onmouseout=function(){splitDiv.style.backgroundColor="#ccc"};splitDiv.onmousedown=function(A){if(!A){A=window.event}splitDiv.dragging=true};document.body.onmouseup=function(A){if(!A){A=window.event}if(splitDiv.dragging){splitDiv.dragging=false;refreshLayout(A.clientX-10)}};document.body.onmousemove=function(A){if(!A){A=window.event}if(splitDiv.dragging){splitDiv.style.left=(A.clientX-config.splitWidth/2)+"px"}}}}function layout(L,K,O,N,G,F,M){var I=containerDiv.offsetWidth;var J=containerDiv.offsetHeight;var T=1;var S,Q,B,U;if(!deployment.staticMode&&!staticLayout){if(!L){L=K?O:I-O-config.splitWidth}L=Math.max(config.vidMinWidth,Math.min(L,I-200))}else{document.documentElement.style.overflow="auto";L=K?Math.max(config.vidMinWidth,O):G;I=G+L+config.splitWidth;var H=Math.min(N+config.vidButtonsHeight,F);var C=Math.max(N+config.vidButtonsHeight,F);if(!G){J=C+config.infoMinHeight}else{J=(H+M+config.infoMinHeight>C)?C+config.infoMinHeight:Math.max(H+M+T+config.infoMinHeight,C)}if(outerContainer){var A=outerContainer.offsetWidth-containerDiv.offsetWidth+I;outerContainer.style.width=Math.max(0,Math.round(A))+"px"}containerDiv.style.width=Math.round(I)+"px";containerDiv.style.height=Math.round(J)+"px";window.requestedX=I+2*absoluteX(containerDiv);window.requestedY=J+absoluteY(containerDiv);if(!config.noResize&&deployment.staticMode){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(V){}},500)}catch(P){}}}if(!G){S=I;Q=Math.min(N*S/O+config.vidButtonsHeight,J-config.infoMinHeight);setBounds(vidDiv,0,0,S,Q);setBounds(homeDiv,0,0,S,Q);setBounds(slideDiv,0,0,0,0);setBounds(splitDiv,0,0,0,0);if(M>0){setBounds(infoDiv,0,Q,S/2,M?J-Q:0);setBounds(chaptersDiv,S/2,Q,S/2,J-Q)}else{setBounds(chaptersDiv,0,0,0,0);setBounds(infoDiv,0,Q,S,J-Q)}}else{S=K?L:I-config.splitWidth-L;B=K?I-config.splitWidth-L:L;if(N){Q=N*S/O+config.vidButtonsHeight}else{Q=config.vidButtonsHeight-8}U=F/G*B;vspaceV=J-Q;vspaceS=J-U;var R=K?0:L+config.splitWidth;var E=K?L+config.splitWidth:0;setBounds(splitDiv,K?S:B,0,config.splitWidth,J+10);if(vspaceV>vspaceS){if(vspaceV-M>vspaceS){Q=Math.min(Q,J-M-config.infoMinHeight);setBounds(vidDiv,R,0,S,Q);setBounds(homeDiv,R,0,S,Q);setBounds(slideDiv,E,0,B,Math.min(U,J));setBounds(chaptersDiv,R,Q+1,S,M-T);setBounds(infoDiv,R,Q+M,S,J-Q-M)}else{Q=Math.min(Q,J-M);U=Math.min(U,J-config.infoMinHeight);setBounds(vidDiv,R,0,S,Q);setBounds(homeDiv,R,0,S,Q);setBounds(slideDiv,E,0,B,U);setBounds(chaptersDiv,R,Q+1,S,M?J-Q:0);setBounds(infoDiv,E,U,B,J-U)}}else{if(vspaceS-M>vspaceV){U=Math.min(U,J-M-config.infoMinHeight);setBounds(slideDiv,E,0,B,U);setBounds(vidDiv,R,0,S,Q);setBounds(homeDiv,R,0,S,Q);setBounds(chaptersDiv,E,U,B,M-T);setBounds(infoDiv,E,U+M,B,J-U-M)}else{Q=Math.min(Q,J-config.infoMinHeight);U=Math.min(U,J-M);setBounds(vidDiv,R,0,S,Q);setBounds(homeDiv,R,0,S,Q);setBounds(slideDiv,E,0,B,U);setBounds(infoDiv,R,Q,S,J-Q);setBounds(chaptersDiv,E,U,B,M?J-U:0)}}}player.resizeTo(S,Q);D("videotabs").style.height=infoDiv.offsetHeight-D("info_tab_buttons").offsetHeight-11+"px";if(homeDiv.previewImg){homeDiv.style.backgroundImage='url("'+homeDiv.previewImg.replace("\\","\\\\")+"?x="+Math.round(S)+"&y="+Math.round(Q)+'&bars=0")';homeDiv.style.backgroundPosition="center center";homeDiv.style.backgroundRepeat="no-repeat"}sz.updateSize()}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+D("vl_layoutcontainer").offsetLeft))+"px";F.style.top=Math.max(0,Math.round(C+D("vl_layoutcontainer").offsetTop))+"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"}};window.deployment={staticMode:true,getDownloadsLink:function(A){return"../"},getMMSLink:function(A){return A}};function fixupVid(){if(vid.creationDate.getTime()<200000000000){vid.creationDate=new Date(vid.creationDate.getTime()*1000)}folders=new Array();var B=new Object();var A=vid.folder.split(/\//);B.level=A.length-1;if(B.level==0){B.topLevel="toplevel"}else{B.toplevel=""}B.name=A[A.length-1];B.path=vid.folder;B.sid=1;folders[folders.length]=B;B.videos=new Array(vid);allVids=new Array(vid);var C=location.toString().split(".files");vid.mmslink=unescape(C[0]);vid.extendedData=vid.extendedData||{};if((new String(document.location)).substr(0,7)=="http://"){vid.httplink=vid.httplink.replace(/\\/g,"/")}vid.chapters=[];vid.slides=[];for(i=0;i<vid._slides.length;i++){if(vid._slides[i].title){vid.chapters[vid.chapters.length]=vid._slides[i]}if(vid._slides[i].url){vid.slides[vid.slides.length]=vid._slides[i]}}vid._slides=null;vid.folderUrl=location.protocol+"//"+location.host+config.linkPathName+"?"+escape(vid.folder);vid.url=vid.folderUrl+":"+vid.pid};window.config={nothumbImg:{img:new Image(100,75),src:"images/nothumbnail.jpg?x=100&y=75"},setUIMode:setUIMode,allChaptersJump:true,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";D("tab_subtitles").style.display="block"}},splitWidth:4,infoMinHeight:100,chaptersMinHeight:100,vidButtonsHeight:76,noResize:true};function setUIMode(A){document.title=vid.title+" - Powered by Encoded Media"}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 selectTab(B,E){var A=getElementsByClass(D(E).parentNode.parentNode,"tab_selected");for(i=0;i<A.length;i++){A[i].className="tab_hidden"}D(E).className="tab_selected";for(i in B.parentNode.childNodes){var C=B.parentNode.childNodes[i];if(C.nodeType==1&&C.tagName==B.tagName){if(C.className.indexOf("visible_false")==-1){C.className="tab_button"}}}B.className="tab_button_selected"};