function Elem(id){if(typeof(id)=="object"){return id;}else{return(document&&document.getElementById)?document.getElementById(id):(document&&document.all)?document.all[id]:false;}};String.prototype.toBoolean=function(){return(this.toLowerCase()=="false"||this.length==0||this=="0")?false:true;};Number.prototype.toBoolean=function(){return(this>0);};Boolean.prototype.toBoolean=function(){return(this==true);};var ms={basePrefWidth:0,basePrefHeight:0,hasExecScript:(typeof(execScript)!='undefined'&&(!window.opera||typeof(window.opera)!='object')&&navigator.userAgent.indexOf("Mac")==-1),plugins:{checkActivexObject:function(progid){objectSuccess=false;objectString=progid;if(ms.hasExecScript)execScript('On Error Resume Next: objectSuccess = IsObject(CreateObject(objectString))','VBScript');return objectSuccess;},checkNavigatorPlugin:function(name,field){var pluginSuccess=(field.indexOf(name)>-1)?true:false;return pluginSuccess;},checkNavigatorPluginVersions:function(name,field,versionRegexp){var highestVersion=-1,currentField,currentVersion,versionMatch;for(var i=0;i<navigator.plugins.length;i++){currentField=navigator.plugins[i][field];if(ms.plugins.checkNavigatorPlugin(name,currentField)){versionMatch=currentField.match(versionRegexp);currentVersion=(versionMatch)?versionMatch[1]:0;if(currentVersion>highestVersion)highestVersion=currentVersion;}}
return highestVersion;},checkActivexVersions:function(progid,versionCeiling){var highestVersion=-1;var objectString;for(var i=0;i<=versionCeiling;i++){objectString=(versionCeiling>0)?progid+i:progid;if(ms.plugins.checkActivexObject(objectString))highestVersion=i;if(progid=='SWCtl.SWCtl.'&&i>9){if(ms.plugins.checkActivexObject(objectString+'.1'))highestVersion=i;if(ms.plugins.checkActivexObject(objectString+'.1.1'))highestVersion=i;}}
return highestVersion;},checkPluginVersions:function(name,field,versionRegexp,progid,versionMax){if(navigator.plugins&&navigator.plugins.length){return ms.plugins.checkNavigatorPluginVersions(name,field,versionRegexp);}else return ms.plugins.checkActivexVersions(progid,versionMax);},getRealVersion:function(){var versionRegexp=null;var v=ms.plugins.checkPluginVersions("Real","description",versionRegexp,"rmocx.RealPlayer G2 Control",0);return v;},getWindowsMediaVersion:function(){var versionRegexp=/(\d)/;var progid="WMPlayer.OCX.";var v=ms.plugins.checkPluginVersions("Windows Media","name",versionRegexp,progid,15);if(v>=7&&ms.hasExecScript){objectVersion=0;objectString=progid+v;execScript('On Error Resume Next: objectVersion = CreateObject(objectString).versionInfo','VBScript');v=parseInt(objectVersion);}
return v;},real:false,windows:false,detected:false,detect:function(){if(!ms.plugins.detected){ms.plugins.detected=true;ms.plugins.real=(ms.plugins.getRealVersion()==-1)?false:true;ms.plugins.windows=(ms.plugins.getWindowsMediaVersion()==-1)?false:true;}}},addOnload:function(newFunction){var currentOnload=window.onload;if(typeof(window.onload)=="function"){window.onload=function(){if(currentOnload){currentOnload()};newFunction();}}else{window.onload=newFunction;}},XMLHttp:function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){try{return new ActiveXObject("MSXML3.XMLHTTP")}catch(e){};try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){};try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){};try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){};return false;}else{return false;}},Ajax:function(url,params){if(url){var http=ms.XMLHttp();if(http){method=(typeof(params.method)=='undefined')?'get':params.method.toLowerCase();async=(typeof(params.async)=='undefined')?true:params.async.toBoolean();postContent=(typeof(params.content)=='undefined')?false:params.content;onReady=(typeof(params.onReady)=='undefined')?false:params.onReady;onComplete=(typeof(params.onComplete)=='undefined')?false:params.onComplete;http.open(method,url,async);http.setRequestHeader('Pragma','no-cache');http.setRequestHeader('Pragma','no-store');if(method=='post'){http.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(postContent){http.setRequestHeader("Content-length",postContent.length);}};http.onreadystatechange=function(){if(http.readyState==3&&typeof(onReady)=='function'){try{onReady();}catch(e){};}
if(http.readyState==4&&http.status==200&&typeof(onComplete)=='function'){try{onComplete(http);}catch(e){};}};http.send((postContent)?postContent:null);}}else{alert("url is required");};},serialize:function(form){var theForm=Elem(form);if(theForm&&document.getElementsByTagName){var output='';function add(name,value){if(typeof(name)!="undefined"&&name.length>0&&typeof(value)!="undefined"&&value.length>0){var pair=name+"="+encodeURI(value);if(output.length<=0){output=pair;}else{output+="&"+pair;}}};var inputs=theForm.getElementsByTagName('input');for(var i=0,j=inputs.length;i<j;i++){var name=inputs[i].getAttribute('name');var value=inputs[i].getAttribute('value');if(inputs[i].type=='radio'||inputs[i].type=='checkbox'){if(inputs[i].checked){add(name,value);}}else if(inputs[i].id=='ms_javascript'){add(name,'true');}else{add(name,value);}}
var selects=theForm.getElementsByTagName('select');for(var i=0,j=selects.length;i<j;i++){var name=selects[i].getAttribute('name');var value=selects[i].options[selects[i].selectedIndex].value;add(name,value);}
var textAreas=theForm.getElementsByTagName('textarea');for(var i=0,j=textAreas.length;i<j;i++){var name=textAreas[i].getAttribute('name');var value=textAreas[i].innerHTML;add(name,value);}
theForm=null;inputs=null;selects=null;textAreas=null;return output;}},getViewportSize:function(){var w,h;if(typeof(window.innerWidth)!='undefined'){w=window.innerWidth;h=window.innerHeight;}
else if(typeof(document.documentElement)!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}
else if(document.getElementsByTagName){w=document.getElementsByTagName('body')[0].clientWidth;h=document.getElementsByTagName('body')[0].clientHeight;}
return{'width':w,'height':h};},windowChrome:{width:function(){this.calculate();return this._width;},height:function(){this.calculate();return this._height;},_width:0,_height:0,calculated:false,calculate:function(){if(!this.calculated){this.calculated=true;var initialWindowWidth=400;var initialWindowHeight=550;window.resizeTo(initialWindowWidth,initialWindowHeight);var viewport=ms.getViewportSize();this._width=initialWindowWidth-viewport.width;this._height=initialWindowHeight-viewport.height;if(navigator.appVersion&&navigator.appVersion.match(/safari/i))this._height+=3;if(this._width<0)this._width=8;if(this._height<0)this._height=0;}}},checkViewport:function(w,h,absoluteMatch){var isAbsoluteMatch=(typeof(absoluteMatch)=="undefined")?true:absoluteMatch.toBoolean();var viewport=ms.getViewportSize();function doResize(){var newWidth=w+ms.windowChrome.width();var newHeight=h+ms.windowChrome.height();window.resizeTo(newWidth,newHeight);};if(isAbsoluteMatch){if(viewport.width!=w||viewport.height!=h){doResize();}}else{if(viewport.width<=w||viewport.height<=h){doResize();}}},messages:{fullscreen:{switching:"Switching to fullscreen mode...\n\n(Press Esc to return to the desktop)",clipNotStarted:"A clip must be started before you can set it to full size."},plugin:{required:"Sorry, You don't have a plugin for that media type.",subtitlesNotSupported:"Sorry, subtitled Windows Media content requires Internet Explorer.",none:"Sorry, you don't appear to have any compatible media plugins."},connection:{broadband:'After testing your internet connection we believe you can receive high quality media... <br /><br /><a href=\"#\" onclick=\"hideTest();\">Finish Test</a>',narrowband:'After testing your internet connection we believe you can receive standard quality media... <br /><br /><a href=\"#\" onclick=\"hideTest();\">Finish Test</a>',countdown:'You will return to preferences in [time] seconds',countdown_1:'You will return to preferences in 1 second'}},toBit:function(_var){if(typeof(_var)=="string"&&_var.toLowerCase()!="true"&&_var.toLowerCase()!="false"){return _var;}else{return(_var.toBoolean())?1:0;}},checkForResize:function(iBase){var minSize=19;var viewport=ms.getViewportSize();if(iBase>minSize){var diff=(iBase-minSize);var winW=(diff*20)+ms.basePrefWidth;var winH=(diff*10)+ms.basePrefHeight;if(viewport.width<winW||viewport.height<winH){winW+=ms.windowChrome.width();winH+=ms.windowChrome.height();window.resizeTo(winW,winH);}}else{if(viewport.width<=ms.basePrefWidth||viewport.height<ms.basePrefHeight){var winW=ms.basePrefWidth+ms.windowChrome.width();var winH=ms.basePrefHeight+ms.windowChrome.height();window.resizeTo(winW,winH);}}},resizeDetector:function(){var f=document.createElement('iframe');f.style.position='absolute';f.style.left='-9999px';f.style.width='30em';f.style.height="1px";f.src='/mediaselector/3/text_resize_iframe.html';document.body.appendChild(f);f=null;},setOpacity:function(sElemId,iOpacity){var elem=Elem(sElemId);if(elem){elem.style.opacity="."+iOpacity;elem.style.filter="alpha(opacity="+iOpacity+")";}
elem=null;},updatePrefForm:function(){ms.plugins.detect();if(!ms.plugins.real&&!ms.plugins.windows){var vidIntro=Elem('video-intro');if(vidIntro)vidIntro.innerHTML=ms.messages.plugin.none;ms.setOpacity('real',25);ms.setOpacity('windows',25);vidIntro=null;}else{if(!ms.plugins.real){ms.setOpacity('real',25);ms.setOpacity('realplay',25);if(Elem('windows'))Elem('windows').checked=true;}
if(!ms.plugins.windows){ms.setOpacity('windows',25);ms.setOpacity('windowsmedia',25);if(Elem('realplay'))Elem('realplay').checked=true;}}
var testConnection=Elem('test-connection');if(testConnection)testConnection.className='display';testConnection=null;if(Elem('ms_javascript')){Elem('ms_javascript').value=true;}},prefForm:function(){ms.basePrefWidth=400;if(!!window.ActiveXObject){ms.basePrefHeight=331;}else{ms.basePrefHeight=336;}
ms.checkViewport(ms.basePrefWidth,ms.basePrefHeight,false);ms.updatePrefForm();ms.resizeDetector();},connection:{testContent:'',timers:[],hideTest:function(){for(var i=0,j=ms.connection.timers.length;i<j;i++){window.clearTimeout(ms.connection.timers[i]);}
ms.connection.timers=[];var testWrapper=Elem('speedtest');var prefForm=Elem('bar-prefs-content');var helpBar=Elem('bar-prefs-help');var vidNote=Elem('video-note');var saveBar=Elem('bar-prefs-save');if(prefForm)prefForm.style.display="";if(vidNote)vidNote.style.display="";if(saveBar)saveBar.style.display="";if(testWrapper){testWrapper.className="hideTest";testWrapper.innerHTML=ms.connection.testContent;}
testWrapper=null;prefForm=null;helpBar=null;vidNote=null;saveBar=null;},test:function(){var testWrapper=Elem('speedtest');var prefForm=Elem('bar-prefs-content');var helpBar=Elem('bar-prefs-help');var vidNote=Elem('video-note');var saveBar=Elem('bar-prefs-save');if(prefForm)prefForm.style.display="none";if(vidNote)vidNote.style.display="none";if(saveBar)saveBar.style.display="none";if(helpBar)helpBar.style.position="relative";if(testWrapper)testWrapper.className="showTest";var ran=Math.floor(Math.random()*101);ms.connection.time.start=0;ms.connection.time.end=0;ms.connection.time.startLogged=false;if(ms.XMLHttp()){new ms.Ajax('/mediaselector/3/images/500.jpg?r='+ran,{onReady:function(){if(ms.connection.time.startLogged==false){ms.connection.time.start=(new Date()).getTime();ms.connection.time.startLogged=true;}},onComplete:function(){ms.connection.time.calculate((new Date()).getTime());}});}else{var img=document.createElement('img');img.width="1";img.height="1";img.style.display="none";img.onload=function(){ms.connection.time.calculate((new Date()).getTime());}
ms.connection.time.start=(new Date()).getTime();img.src="/mediaselector/3/images/500.jpg?r="+ran;}
testWrapper=null;prefForm=null;helpBar=null;vidNote=null;saveBar=null;},time:{start:0,startLogged:false,end:0,calculate:function(endTime){if(endTime&&typeof(endTime)=="number")this.end=endTime;var downloadTime=((this.end-this.start)/1000);var dataSize=511773;var kbits=((dataSize*8)/1000);var throughput=((kbits/downloadTime)*0.93);var prefForm=Elem('pref-form');var testWrapper=Elem('speedtest');var helpBar=Elem('bar-prefs-help');var msg;if(throughput>75){if(Elem('broadband'))Elem('broadband').checked='checked';msg=ms.messages.connection.broadband;}else{if(Elem('narrowband'))Elem('narrowband').checked='checked';msg=ms.messages.connection.narrowband;}
if(Elem('throughput'))Elem('throughput').value=throughput.toFixed(2);if(testWrapper&&prefForm&&helpBar){ms.connection.testContent=testWrapper.innerHTML;msg="<p>"+msg+"</p>";if(testWrapper)testWrapper.innerHTML=msg;var countdown=document.createElement('span');countdown.id="msTestCountdown";testWrapper.appendChild(countdown);var start=5
var code="Elem('msTestCountdown').innerHTML = '";for(var i=1,j=start;i<=start;i++,j--){var countdownMessage=(i==1)?ms.messages.connection.countdown_1:ms.messages.connection.countdown;if(countdownMessage!=''){var timeMsg=code+countdownMessage.replace(/\[time\]/gi,i)+'\';';if(i==start){eval(timeMsg);}else{ms.connection.timers.push(setTimeout(timeMsg,((j-1)*1000)));}}};ms.connection.timers.push(setTimeout("ms.connection.hideTest()",5100));}
prefForm=null;testWrapper=null;helpBar=null;}}}};function MediaPlayer(settings_url,url_no_subtitles,url_subtitles,subtitlesAvailable,showSubtitles,options){if(typeof(subtitlesAvailable)!="undefined"){subtitlesAvailable=subtitlesAvailable.toBoolean();this.subtitles.available=subtitlesAvailable;}
if(typeof(showSubtitles)!="undefined"){showSubtitles=showSubtitles.toBoolean();this.subtitles.show=showSubtitles;}
this.url_no_subtitles=url_no_subtitles;this.url_subtitles=url_subtitles;this.settings_url=settings_url;this.options=(options)?options:false;this.HTML=new String();this.ActiveX=!!window.ActiveXObject;this.miniPlayer=false;this.fileCheck();this.linksChecked=false;this.autoResize=true;this.fitWindowToMedia=false;function getUnicode(_var){if(typeof(_var)=="number"){return _var;}else{_var=_var.toString().toUpperCase();if(_var.match(/[0-9]+/g)){return Number(_var);}else{return _var.charCodeAt(0);}}};this.key_play=getUnicode((options&&options.key_play)?options.key_play:this.defaultValue.key_play);this.key_subtitles=getUnicode((options&&options.key_subtitles)?options.key_subtitles:this.defaultValue.key_subtitles);this.key_fullscreen=getUnicode((options&&options.key_fullscreen)?options.key_fullscreen:this.defaultValue.key_fullscreen);this.key_standalone=getUnicode((options&&options.key_standalone)?options.key_standalone:this.defaultValue.key_standalone);this.key_preferences=getUnicode((options&&options.key_preferences)?options.key_preferences:this.defaultValue.key_preferences);this.overlay=(this.file.audio)?false:(options&&typeof(options.overlay)!="undefined")?options.overlay.toBoolean():this.defaultValue.overlay;this.overlayTitle=(options&&options.overlayTitle)?options.overlayTitle:this.defaultValue.overlayTitle;this.autoStart=(this.overlay)?false:(options&&typeof(options.autoStart)!="undefined")?options.autoStart.toBoolean():this.defaultValue.autoStart;this.createWrapper=(options&&typeof(options.createWrapper)!="undefined")?options.createWrapper.toBoolean():this.defaultValue.createWrapper;this.setDimensions();this.targetId=(options&&options.targetId)?options.targetId:this.defaultValue.targetId;this.fullWrapperId=(options&&options.fullWrapperId)?options.fullWrapperId:this.defaultValue.fullWrapperId;this.objectId=(options&&options.objectId)?options.objectId:this.defaultValue.objectId;this.embedId=(options&&options.embedId)?options.embedId:this.defaultValue.embedId;this.wrapperId=(options&&options.wrapperId)?options.wrapperId:this.defaultValue.wrapperId;this.realStatusId=(options&&options.realStatusId)?options.realStatusId:this.defaultValue.realStatusId;this.realStatusEmbedId=(options&&options.realStatusEmbedId)?options.realStatusEmbedId:this.defaultValue.realStatusEmbedId;this.realControlsId=(options&&options.realControlsId)?options.realControlsId:this.defaultValue.realControlsId;this.realControlsEmbedId=(options&&options.realControlsEmbedId)?options.realControlsEmbedId:this.defaultValue.realControlsEmbedId;this.fullscreenLinkId=(options&&options.fullscreenLinkId)?options.fullscreenLinkId:this.defaultValue.fullscreenLinkId;this.standAloneLinkId=(options&&options.standAloneLinkId)?options.standAloneLinkId:this.defaultValue.standAloneLinkId;this.consoleOverlayId=(options&&options.consoleOverlayId)?options.consoleOverlayId:this.defaultValue.consoleOverlayId;this.wrapperClass=(options&&options.wrapperClass)?options.wrapperClass:this.defaultValue.wrapperClass;this.consoleClass=(options&&options.consoleClass)?options.consoleClass:this.defaultValue.consoleClass;this.consoleOverlayClass=(options&&options.consoleOverlayClass)?options.consoleOverlayClass:this.defaultValue.consoleOverlayClass;this.realStatusClass=(options&&options.realStatusClass)?options.realStatusClass:this.defaultValue.realStatusClass;this.realControlsClass=(options&&options.realControlsClass)?options.realControlsClass:this.defaultValue.realControlsClass;if(!this.createWrapper&&(this.targetId!=null&&this.targetId!='')){this.wrapperId=this.targetId;}else{this.createWrapper=true;}
this.subtitles.checkLinks();};MediaPlayer.prototype={defaultValue:{overlay:true,autoStart:false,createWrapper:false,overlayImage:"http://www.bbc.co.uk/mediaselector/3/play_2.jpg",overlayTitle:"Click to play video",fullWrapperId:"FullMediaConsoleWrapper",objectId:"MediaConsole",embedId:"MediaConsoleEmbed",wrapperId:"MediaConsoleWrapper",targetId:"player-embed",realControlsId:"MediaConsoleRealControls",realControlsEmbedId:"MediaConsoleRealControlsEmbed",realStatusId:"MediaConsoleRealStatus",realStatusEmbedId:"MediaConsoleRealStatusEmbed",fullscreenLinkId:"MediaConsoleFullScreen",standAloneLinkId:"MediaConsoleStandalone",consoleOverlayId:"MediaConsolePlayOverlay",wrapperClass:"MediaConsoleWrapper",consoleClass:"MediaConsole",consoleOverlayClass:"MediaConsoleOverlay",realStatusClass:"MediaConsoleRealStatus",realControlsClass:"MediaConsoleRealControls",key_play:80,key_subtitles:83,key_fullscreen:13,key_standalone:84,key_preferences:79},type:{description:"generic",popup:function(){return!!(this.description.toLowerCase()=="popup");},embedded:function(){return!!(this.description.toLowerCase()=="embedded");}},subtitles:{available:false,show:false,hiddenForOverlay:false,disabled:false,displaying:false,className:{wrapperOn:'msShow',wrapperOff:'msHide',linksOn:'subtitles-available-show',linksOff:'subtitles-available-hide'},wrapperId:'subtitle-wrapper',linkWrapperId:'subtitles-available',subtitlesId:'subtitles',heightIncreased:false,height:{'ram':{'bb':{'video':80,'audio':72},'nb':{'video':72,'audio':72}},'asx':{'bb':{'video':85,'audio':85},'nb':{'video':80,'audio':80}},'links':23},hideForWindows:function(){var subWrapper=Elem(this.wrapperId);if(subWrapper&&subWrapper.className!=this.className.wrapperOff){this.displaying=false;subWrapper.className=this.className.wrapperOff;}
subWrapper=null;},checkLinks:function(){var subLinks=Elem(this.linkWrapperId);if(subLinks){subLinks.className=(this.available)?this.className.linksOn:this.className.linksOff;}
subLinks=null;}},mediaDimensions:{'4x3':{bb:{width:320,height:240},nb:{width:192,height:144}},'16x9':{bb:{width:400,height:224},nb:{width:256,height:144}},'16x9c':{bb:{width:400,height:224},nb:{width:256,height:144}},'au':{bb:{width:400,height:0},nb:{width:400,height:0}},'asx':{statusHeight:26,controlsHeight:46},'ram':{status:{width:400,height:40},controls:{width:400,height:40},miniPlayerControlsHeight:26}},mediaSettings:{'ram':{'ClassID':'CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA','Params':[['console','av'],['center',true],['nologo',true]],'Embed':[['type','audio/x-pn-realaudio-plugin']]},'asx':{'ClassID':'CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6','Params':[['captioningID','subtitles'],['ShowControls',true],['ShowDisplay',false],['ShowStatusBar',true]],'Embed':[['type','application/x-mplayer2']]}},setAutoResize:function(type){if(type){switch(type.toLowerCase()){case'off':this.autoResize=false;break;case'media':this.autoResize=true;this.fitWindowToMedia=true;this.setDimensions();break;}}},setMini:function(){this.miniPlayer=true;this.fileCheck();if(this.file.windows){this.mediaSettings['asx'].Params[3][1]=false;this.mediaSettings['asx'].Params.push(['uiMode','mini']);this.mediaSettings['asx'].Params.push(['ShowPositionControls',false]);this.mediaSettings['asx'].Params.push(['ShowTracker',false]);this.mediaSettings['asx'].Params.push(['ShowStatusBar',false]);if(!this.ActiveX)this.mediaDimensions.asx.controlsHeight=26;}},additionalLinks:{insert:false,present:false,type:null,id:{wrapper:'CustomLinksWrapper',titleWrapper:'CustomLinksTitleWrapper',image:'CustomLinksImage',title:'CustomLinksTitle',blob:'CustomLinksBlob',list:'CustomLinksList',error:'CustomLinksError'},className:{image:'CustomLinksImage',even:'dark',odd:'light'},dimensions:{width:200,height:404}},setDimensions:function(){this.width=(this.options&&this.options.width)?this.options.width:(!this.file.audio&&this.fitWindowToMedia)?this.mediaDimensions[this.file.ratio][this.file.rate]['width']:400;this.height=(this.options&&this.options.height)?this.options.height:this.mediaDimensions[this.file.ratio][this.file.rate]['height'];},getFileInfo:function(URL){if(URL){var url=URL.split('/');var file=url[url.length-1];var type=file.split('.');var m=type[type.length-1];var spec=type[0].split('_');var rate=spec[spec.length-1];var ratio=spec[spec.length-2];var subtitles=(file.indexOf("_st_")>0);var audio=(ratio=='au');var real=(m=="ram");var win=(m=="asx");var type=(audio)?'audio':'video';return{'extension':m,'rate':rate,'ratio':ratio,'subtitles':subtitles,'audio':audio,'real':real,'windows':win,'type':type};}else{return false;}},setChildElementsDisplay:function(elem,aTags,state){var elem=Elem(elem);if(elem){if(typeof(aTags)=="object"){for(var i=0,j=aTags.length;i<j;i++){loopTag(aTags[i]);}}else{loopTag(aTags);}}
function loopTag(tag){var tags=elem.getElementsByTagName(tag);for(var i=0,j=tags.length;i<j;i++){if(state=="none"){tags[i].style.position="absolute";tags[i].style.left="-9999px";}else{tags[i].style.position="relative";tags[i].style.top="0";tags[i].style.left="0";}
tags[i].style.display=state;};tags=null;};elem=null;},fileCheck:function(){this.url=this.url_no_subtitles;this.file=this.getFileInfo(this.url_no_subtitles);if(this.subtitles.available&&(this.subtitles.show||this.file.windows||(this.ActiveX&&this.file.real&&!this.miniPlayer))){this.url=this.url_subtitles;this.file=this.getFileInfo(this.url_subtitles);}
if(this.file.real){this.subtitles.displaying=!!this.file.subtitles;var realHeight=Math.round((this.subtitles.height.ram[this.file.rate][this.file.type])/2);this.mediaDimensions.ram.status.height=realHeight;this.mediaDimensions.ram.controls.height=realHeight;}},loading:function(){if(this.type.embedded()){this.loaded();var wrapper=Elem('FullMediaConsoleWrapper');if(wrapper&&document.createElement&&wrapper.insertBefore){var i=document.createElement('img');i.id="msAjaxLoading";i.src="/mediaselector/3/loader_bar.gif";i.style.position="relative";i.style.left="5px";i.style.top="2px";i.style.cssFloat="left";i.style.styleFloat="left";var settingLink=Elem(this.prefLinkId);wrapper.insertBefore(i,settingLink);i=null;settingLink=null;}
wrapper=null;}},loaded:function(){if(this.type.embedded()){var wrapper=Elem('FullMediaConsoleWrapper');var i=Elem('msAjaxLoading');if(wrapper&&i&&document.removeChild){wrapper.removeChild(i);}
wrapper=null;i=null;}},changeFile:function(URL){if(typeof(URL)=="undefined"||URL.length==0){URL=this.url;}
if(URL){this.loading();this.overlay=false;this.autoStart=true;var wrapper=Elem(this.targetId);this.subtitles.disabled=false;this.url=URL;this.file=this.getFileInfo(URL);this.subtitles.checkLinks();this.HTML="";this.setDimensions();this.createHTML();if(wrapper)wrapper.innerHTML="";this.loaded();this.insertHTML();this.checkWindow();wrapper=null;}},newVideo:function(url_noSubtitles,url_subtitles,url_full){this.url_subtitles=url_subtitles;this.url_no_subtitles=url_noSubtitles;this.subtitles.available=!(url_noSubtitles==url_subtitles);this.fileCheck();this.setStandAlone((this.subtitles.available&&this.subtitles.show)?url_subtitles:url_noSubtitles);this.changeFile();return false;},createHTML:function(){ms.plugins.detect()
if(!ms.plugins.real&&!ms.plugins.windows){this.HTML+=ms.messages.plugin.none+"<br /><br />";}
if(this.file.windows){this.height+=this.mediaDimensions[this.file.extension].controlsHeight;}
if(this.subtitles.available){if(this.file.real&&this.file.subtitles){this.height+=this.subtitles.height[this.file.extension][this.file.rate][this.file.type];this.subtitles.heightIncreased=true;}}
if(this.createWrapper){this.HTML+='<div id="'+this.wrapperId+'" class="'+this.wrapperClass+'">';}
this.HTML+='<object id="'+this.objectId+'" name="'+this.objectId+'" class="'+this.consoleClass+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+this.width+'" height="'+this.height+'"';if(this.file.windows){this.HTML+=' standby="Loading Windows Media Player components..." type="application/x-oleobject">';}else{this.HTML+='>';}
this.HTML+=createParamHTML('url',this.url);this.HTML+=createParamHTML('autostart',ms.toBit(this.autoStart));this.HTML+=createParamHTML('controls','ImageWindow');for(var i=0,j=this.mediaSettings[this.file.extension].Params.length;i<j;i++){this.HTML+=createParamHTML(this.mediaSettings[this.file.extension].Params[i][0],ms.toBit(this.mediaSettings[this.file.extension].Params[i][1]));}
this.HTML+='<embed src="'+this.url+'" controls="ImageWindow" id="'+this.embedId+'" name="'+this.embedId+'" autostart="'+ms.toBit(this.autoStart)+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+this.width+'" height="'+this.height+'"';for(i=0;i<this.mediaSettings[this.file.extension].Params.length;i++){this.HTML+=' '+this.mediaSettings[this.file.extension].Params[i][0].toLowerCase()+'="'+ms.toBit(this.mediaSettings[this.file.extension].Params[i][1])+'"';}
for(i=0;i<this.mediaSettings[this.file.extension].Embed.length;i++){this.HTML+=' '+this.mediaSettings[this.file.extension].Embed[i][0].toLowerCase()+'="'+ms.toBit(this.mediaSettings[this.file.extension].Embed[i][1])+'"';}
this.HTML+='></embed>';this.HTML+='</object>';if(this.file.real){if(this.miniPlayer){var controlHeight=26;var controlDimensions={play:{width:30,padding:{left:0,right:0}},stop:{width:20,padding:{left:0,right:0}},position:{width:'',padding:{left:0,right:0}},mute:{width:20,padding:{left:0,right:0}}};var self=this;function realButton(name,controlId){var H=[];var width;if(name=="position"){var buttonWidths=0;for(var p in controlDimensions){if(p!="position"){buttonWidths+=controlDimensions[p].width+(controlDimensions[p].padding.left)+(controlDimensions[p].padding.right);}}
width=self.width-buttonWidths;}else{width=controlDimensions[name].width;}
var objectId=name+'_'+self.realControlsId;var embedId=name+'_'+self.realControlsEmbedId;var padding='padding:0 '+controlDimensions[name].padding.right+' 0 '+controlDimensions[name].padding.left+';';H.push('<object style="'+padding+'" id="'+objectId+'" name="'+objectId+'" class="control" classid="'+self.mediaSettings.ram.ClassID+'" width="'+width+'" height="'+controlHeight+'">');function addParams(type){var params=[['controls',controlId],['console','av'],['autostart',self.autoStart],['src',self.url]];for(var i=0,j=params.length;i<j;i++){switch(type.toLowerCase()){case'object':H.push(createParamHTML(params[i][0],params[i][1]));break;case'embed':H.push(" "+params[i][0].toLowerCase()+" = "+params[i][1]);break;}}}
addParams('object');H.push('<embed style="'+padding+'" id="'+embedId+'" name="'+embedId+'" classid="'+self.mediaSettings.ram.ClassID+'" width="'+width+'" height="'+controlHeight+'" class="control" controls="'+controlId+'"');addParams('embed');for(i=0;i<self.mediaSettings.ram.Embed.length;i++){H.push(' '+self.mediaSettings.ram.Embed[i][0].toLowerCase()+'="'+ms.toBit(self.mediaSettings.ram.Embed[i][1])+'"');}
H.push('></embed>');H.push('</object>');return H.join("");};this.HTML+=realButton('play','PlayButton');this.HTML+=realButton('stop','StopButton');this.HTML+=realButton('position','StatusBar');this.HTML+=realButton('mute','MuteCtrl');}else{var realWidth=this.width;this.HTML+='<object id="'+this.realStatusId+'" name="'+this.realStatusId+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+realWidth+'" height="'+this.mediaDimensions[this.file.extension].status.height+'" src="'+this.url+'" class="'+this.realStatusClass+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'">';this.HTML+=createParamHTML('src',this.url);this.HTML+=createParamHTML('console','av');this.HTML+=createParamHTML('autostart',ms.toBit(this.autoStart));this.HTML+=createParamHTML('controls','StatusBar');this.HTML+='<embed id="'+this.realStatusEmbedId+'" name="'+this.realStatusEmbedId+'" class="'+this.realStatusClass+'" src="'+this.url+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+realWidth+'" height="'+this.mediaDimensions[this.file.extension].status.height+'" autostart="'+ms.toBit(this.autoStart)+'" controls="StatusBar" console="av" type="audio/x-pn-realaudio-plugin"></embed>';this.HTML+='</object>';this.HTML+='<object id="'+this.realControlsId+'" name="'+this.realControlsId+'" class="'+this.realControlsClass+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+realWidth+'" height="'+this.mediaDimensions[this.file.extension].controls.height+'">';this.HTML+=createParamHTML('src',this.url);this.HTML+=createParamHTML('console','av');this.HTML+=createParamHTML('autostart',ms.toBit(this.autoStart));this.HTML+=createParamHTML('controls','ControlPanel');this.HTML+='<embed id="'+this.realControlsEmbedId+'" name="'+this.realControlsEmbedId+'" class="'+this.realControlsClass+'" src="'+this.url+'" classid="'+this.mediaSettings[this.file.extension].ClassID+'" width="'+realWidth+'" height="'+this.mediaDimensions[this.file.extension].controls.height+'" autostart="'+ms.toBit(this.autoStart)+'" controls="ControlPanel" console="av" type="audio/x-pn-realaudio-plugin"></embed>';this.HTML+='</object>';}}
if(this.overlay){var width=400;var height=(this.file.real)?(this.height+this.mediaDimensions.ram.status.height+this.mediaDimensions.ram.controls.height):this.height;var image=(this.options&&this.options.overlayImage&&this.options.overlayImage!='')?'background-image:url('+this.options.overlayImage+');':'';var title=(this.overlayTitle&&this.overlayTitle.length>0)?' title="'+this.overlayTitle+'"':'';this.HTML+='<div'+title+' tabindex="0" id="'+this.consoleOverlayId+'" class="'+this.consoleOverlayClass+'" style="width:'+width+'px;height:'+height+'px;'+image+'"></div>';}
if(this.createWrapper){this.HTML+='</div>';}
if(this.type.popup()&&this.additionalLinks.present)this.createAdditionalLinks();function createParamHTML(name,value){return'<param name="'+name+'" value="'+value+'" />';};},getHTML:function(){if(this.HTML=="")this.createHTML();return this.HTML;},insertHTML:function(){var HTML=this.getHTML();if(this.targetId!=null&&Elem(this.targetId)){try{Elem(this.targetId).innerHTML=HTML;}catch(e){document.body.innerHTML+=HTML;}}else{document.body.innerHTML+=HTML;}
this.doChecks();},doChecks:function(){if(this.file.real){this.subtitles.hideForWindows();if(!this.ActiveX&&this.file.audio&&!this.file.subtitles){if(Elem(this.objectId))Elem(this.objectId).style.display="none";if(Elem(this.embedId))Elem(this.embedId).style.display="none";}}
if(this.ActiveX){var elem=Elem(this.fullscreenLinkId);if(elem)elem.className='msShow';elem=null;}
if(this.type.popup()){var target=Elem(this.targetId);var wrapper=Elem(this.fullWrapperId);if(target)target.style.width=this.width+'px';if(wrapper)wrapper.style.width=this.width+'px';target=wrapper=null;this.makeWindowFit();}else if(this.type.embedded()){this.searchForMediaLinks();}
if(this.overlay){var overlayElem=Elem(this.consoleOverlayId);if(overlayElem){this.subtitles.hideForWindows();this.subtitles.disabled=true;this.setChildElementsDisplay(this.wrapperId,['object','embed'],'none');var self=this;function overlayHide(e){if(!e)var e=window.event;var doPlay=doPrefs=false;if(e.type&&e.type=="keydown"){var code=(e.keyCode)?e.keyCode:e.which;if(e.shiftKey&&code==self.key_play){doPlay=true;}else if(e.shiftKey&&code==self.key_preferences){doPrefs=true;}}else{doPlay=true;}
if(doPlay){self.hideOverlay();self.play();}else if(doPrefs){self.hideOverlay();self.clickPrefLink();}
if(doPlay||doPrefs){if(document.removeEventListener){document.removeEventListener("keydown",overlayHide,false);}else if(document.detachEvent){document.detachEvent("onkeydown",overlayHide);}else{document.onkeypress=null;}}};if(document.addEventListener){overlayElem.addEventListener('click',overlayHide,false);overlayElem.addEventListener('keypress',overlayHide,false);document.addEventListener("keydown",overlayHide,false);}else if(document.attachEvent){overlayElem.attachEvent("onclick",overlayHide);overlayElem.attachEvent("onkeypress",overlayHide);document.attachEvent("onkeydown",overlayHide);}else{overlayElem.onclick=overlayHide;overlayElem.onkeypress=overlayHide;document.onkeydown=overlayHide;}}}else{this.registerEventHandlers();}
overlayElem=null;this.showSubtitlesCheck();},clickPrefLink:function(){if(this.type.embedded()){var prefLink=Elem(this.prefLinkId);if(prefLink){var clickFunction=prefLink.onclick;if(typeof(clickFunction)=="function")clickFunction();clickFunction=null;}
prefLink=null;}else if(this.type.popup()){var prefLinkContainer=Elem('ConsoleSettings');if(prefLinkContainer&&document.getElementsByTagName){var a=prefLinkContainer.getElementsByTagName('a');if(a&&a[0]){var aHref=a[0].href;if(aHref.length>0){window.location.href=aHref;}}}
prefLinkContainer=null;}},hideOverlay:function(showingVideo){var hiddenToShowVideo=(typeof(showingVideo)=="boolean")?showingVideo:true;var overlay=Elem(this.consoleOverlayId);if(overlay&&overlay.style.display.toLowerCase()!='none'){overlay.style.display='none';this.setChildElementsDisplay(overlay.parentNode,['object','embed'],'inline');overlay.parentNode.removeChild(overlay);if(hiddenToShowVideo){this.subtitles.disabled=false;this.showSubtitlesCheck();this.registerEventHandlers();}}
overlay=null;},showSubtitlesCheck:function(){if(this.file.windows&&this.subtitles.show){this.switchSubtitles('on');}else if(this.file.real&&this.ActiveX&&!this.subtitles.show){this.switchSubtitles('off');}},registerEventHandlers:function(){var self=this;function checkEvent(e){if(!e)var e=window.event;if(e.type&&e.type=="keydown"&&e.shiftKey){var code=(e.keyCode)?e.keyCode:e.which;switch(code){case self.key_fullscreen:if(self.ActiveX)self.fullscreen();break;case self.key_subtitles:self.toggleSubtitles();break;case self.key_standalone:window.location.href=self.url;break;case self.key_preferences:self.clickPrefLink();break;}}};document.onkeydown=checkEvent;},fullscreen:function(){var playerObject=(Elem(this.objectId))?Elem(this.objectId):Elem(this.embedId);if(playerObject&&this.ActiveX){if(this.file.windows){if(playerObject.playState==3){alert(ms.messages.fullscreen.switching);playerObject.fullScreen='true';}else{alert(ms.messages.fullscreen.clipNotStarted);this.hideOverlay();this.play();}}
else if(this.file.real){var playState=playerObject.GetPlayState();if(playState=='0'||playState=='1'){alert(ms.messages.fullscreen.clipNotStarted);this.hideOverlay();this.play();}else{alert(ms.messages.fullscreen.switching);playerObject.SetFullScreen();}}}
playerObject=null;},play:function(){if(this.ActiveX){var Player=(Elem(this.objectId))?Elem(this.objectId):Elem(this.embedId);if(this.file.windows){Player.controls.play();}else if(this.file.real){Player.DoPlay();}
Player=null;}else{function changeAutoStart(objectId,embedId){var elem=Elem(objectId);if(elem){var params=elem.getElementsByTagName('param');for(var i=0,j=params.length;i<j;i++){var name=params[i].getAttribute('name');var value=params[i].getAttribute('value');if(name&&value&&name.toLowerCase()=="autostart"&&value.toLowerCase()!="1"){params[i].setAttribute("value","1");}}
params=null;}
elem=Elem(embedId);if(elem){elem.setAttribute("autostart","1");}
elem=null;};changeAutoStart(this.objectId,this.embedId);if(this.file.real){changeAutoStart(this.realStatusId,this.realStatusEmbedId);changeAutoStart(this.realControlsId,this.realControlsEmbedId);}}},setStandAlone:function(url){var target=Elem(this.standAloneLinkId);if(target)target.href=url;target=null;},toggleSubtitles:function(){this.switchSubtitles();},switchSubtitles:function(state){var player=this;if(this.subtitles.disabled){return false;}else{if(!state||typeof(state)=="undefined"){state=(this.subtitles.displaying)?'off':'on';}
if(this.file.windows){var subtitles=Elem(this.subtitles.wrapperId);if(subtitles){if(state.toLowerCase()=="on"){if(!this.subtitles.displaying){if(!this.ActiveX){subtitles.innerHTML=ms.messages.plugin.subtitlesNotSupported;}
subtitles.className=this.subtitles.className.wrapperOn;this.subtitles.displaying=true;}}else if(this.subtitles.displaying){subtitles.className=this.subtitles.className.wrapperOff;this.subtitles.displaying=false;}
this.checkWindow();subtitles=null;return false;}else{subtitles=null;return true;}}else if(this.file.real){if(this.ActiveX){if(this.miniPlayer){changeFileByState(state);this.checkWindow();return false;}else{var realControls=(Elem(this.realControlsId))?Elem(this.realControlsId):Elem(this.realControlsEmbedId);var realStatus=(Elem(this.realStatusId))?Elem(this.realStatusId):Elem(this.realStatusEmbedId);if(realControls&&realStatus){var wrapper=Elem(this.fullWrapperId);var linksWrapper=Elem(this.subtitles.linkWrapperId);if(state.toLowerCase()=="on"){if(this.file.subtitles){if(!this.subtitles.displaying){var value="0";setTop(realControls,value);setTop(realStatus,value);if(this.type.popup()&&linksWrapper)setTop(linksWrapper,value);this.subtitles.displaying=true;if(wrapper){wrapper.style.height="auto";wrapper.style.overflow="";}
this.checkWindow();return false;}}}else if(this.subtitles.displaying){var subHeight=this.subtitles.height[this.file.extension][this.file.rate][this.file.type]
var value="-"+subHeight;setTop(realControls,value);setTop(realStatus,value);if(this.type.popup()&&linksWrapper)setTop(linksWrapper,value);this.subtitles.displaying=false;if(wrapper){wrapper.style.height=(wrapper.offsetHeight-subHeight);wrapper.style.overflow="hidden";}
this.checkWindow();return false;}else{return false;}}else{return true;}}}else{changeFileByState(state);return false;}}else{return true;}}
function setTop(elem,num){if(num=="0"){elem.style.position="static";}else{elem.style.position="relative";}
elem.style.top=num+'px';};function changeFileByState(_state){_state=_state.toLowerCase();if(_state=="on"&&!player.subtitles.displaying){player.subtitles.show=true;player.subtitles.displaying=true;player.changeFile(player.url_subtitles);}else if(_state=="off"&&player.subtitles.displaying){player.subtitles.show=false;player.subtitles.displaying=false;player.changeFile(player.url_no_subtitles);}};},checkWindow:function(){if(this.type.popup())this.makeWindowFit();},makeWindowFit:function(){if(this.autoResize){var width=this.width;var height=this.height;if(this.miniPlayer)height-=33;if(this.subtitles.available){height+=this.subtitles.height.links;}
if(this.file.real){height+=(this.miniPlayer)?this.mediaDimensions.ram.miniPlayerControlsHeight:this.mediaDimensions.ram.status.height+this.mediaDimensions.ram.controls.height;if(this.file.subtitles&&!this.subtitles.displaying){height-=this.subtitles.height[this.file.extension][this.file.rate][this.file.type];}}else if(this.subtitles.displaying){height+=this.subtitles.height[this.file.extension][this.file.rate][this.file.type];}
if(this.additionalLinks.present){width+=this.additionalLinks.dimensions.width+55;if(height<this.additionalLinks.dimensions.height)height=this.additionalLinks.dimensions.height;}
height+=67;function doResize(){var windowWidth=ms.windowChrome.width()+width;var windowHeight=ms.windowChrome.height()+height;window.resizeTo(windowWidth,windowHeight);};var viewport=ms.getViewportSize();if(this.additionalLinks.present){if(viewport.width<width||viewport.height<height){doResize();}}else{if(viewport.width!=width||viewport.height!=height){doResize();}}}}};function PopupPlayer(settings_url,url_no_subtitles,url_subtitles,subtitlesAvailable,showSubtitles,customLinks,options){this.defaultValue.overlay=false;this.defaultValue.autoStart=true;this.type.description="popup";this.base=MediaPlayer;this.base(settings_url,url_no_subtitles,url_subtitles,subtitlesAvailable,showSubtitles,options);this.base=null;if(customLinks&&(typeof(customLinks)=="object")||typeof(customLinks)=="string"){this.additionalLinks.insert=true;this.additionalLinks.present=true;this.additionalLinks.type=typeof(customLinks);this.customLinks=customLinks;}else{this.additionalLinks.insert=false;}};PopupPlayer.prototype=MediaPlayer.prototype;function hideTest(){ms.connection.hideTest();};

