var wgOggPlayer={detectionDone:false,msie:false,safari:false,opera:false,mozilla:false,players:["videoElement","cortado","quicktime-mozilla","quicktime-activex","vlc-mozilla","vlc-activex","totem","kmplayer","kaffeine","mplayerplug-in","oggPlugin"],clientSupports:{thumbnail:true},mimeTypes:{"quicktime-mozilla":"video/quicktime","quicktime-activex":"video/quicktime","vlc-mozilla":"application/x-vlc-plugin",oggPlugin:"application/ogg",totem:"application/ogg",kmplayer:"application/ogg",kaffeine:"application/ogg","mplayerplug-in":"application/ogg"},savedThumbs:{},qtTimers:{},defaultMsg:{"ogg-player-totem":"Totem","ogg-player-kmplayer":"KMPlayer","ogg-player-kaffeine":"Kaffeine","ogg-player-mplayerplug-in":"mplayerplug-in"},msg:{},cortadoUrl:"",extPathUrl:"",showPlayerSelect:true,controlsHeightGuess:20,init:function(e,g){elt=document.getElementById(g.id);if(!(g.id in this.savedThumbs)){var b=document.createDocumentFragment();for(d=0;d<elt.childNodes.length;d++){b.appendChild(elt.childNodes.item(d).cloneNode(true))}this.savedThumbs[g.id]=b}this.detect();if(!e){var c=this.getCookie("ogg_player");if(c&&c!="thumbnail"){e=c}}if(!this.clientSupports[e]){e=false}if(!e){for(var d=0;d<this.players.length;d++){if(this.clientSupports[this.players[d]]){e=this.players[d];break}}}elt.innerHTML="";switch(e){case"videoElement":this.embedVideoElement(elt,g);break;case"oggPlugin":case"kaffeine":case"totem":case"kmplayer":case"mplayerplug-in":this.embedOggPlugin(elt,g,e);break;case"vlc-mozilla":this.embedVlcPlugin(elt,g);break;case"vlc-activex":this.embedVlcActiveX(elt,g);break;case"cortado":this.embedCortado(elt,g);break;case"quicktime-mozilla":case"quicktime-activex":this.embedQuicktimePlugin(elt,g,e);break;case"thumbnail":default:if(g.id in this.savedThumbs){elt.appendChild(this.savedThumbs[g.id].cloneNode(true))}else{elt.appendChild(document.createTextNode("Missing saved thumbnail for "+g.id))}if(e!="thumbnail"){var h=document.createElement("div");h.className="ogg-player-options";h.style.cssText="width: "+(g.width-10)+"px;";h.innerHTML=this.msg["ogg-no-player"];elt.appendChild(h);e="none"}}if(e!="thumbnail"){var a=this.makeOptionsBox(e,g);var f=this.makeOptionsLink(g.id);var h=document.createElement("div");h.appendChild(a);h.appendChild(f);elt.appendChild(h)}},debug:function(a){},detect:function(){if(this.detectionDone){return}this.detectionDone=true;this.msie=(navigator.appName=="Microsoft Internet Explorer");this.mozilla=(navigator.appName=="Netscape");this.opera=(navigator.appName=="Opera");this.safari=(navigator.vendor&&navigator.vendor.substr(0,5)=="Apple");this.konqueror=(navigator.appName=="Konqueror");var p=navigator.javaEnabled();var a=this.opera;if(a&&p){this.clientSupports.cortado=true}if(this.konqueror){p=false}if(this.testActiveX("VideoLAN.VLCPlugin.2")){this.clientSupports["vlc-activex"]=true}if(p&&this.testActiveX("JavaWebStart.isInstalled")){this.clientSupports.cortado=true}if(this.testActiveX("QuickTimeCheckObject.QuickTimeCheck.1")){this.clientSupports["quicktime-activex"]=true}if(typeof HTMLVideoElement=="object"||typeof HTMLVideoElement=="function"){if(wgOggPlayer.safari){try{var q=document.createElement("video");if(q.canPlayType('video/ogg;codecs="theora,vorbis"')=="probably"){this.clientSupports.videoElement=true}else{}}catch(k){}}else{this.clientSupports.videoElement=true}}if(!navigator.mimeTypes||navigator.mimeTypes.length==0){return}var b={};var m={};var h={};var r;var c;for(c=0;c<navigator.mimeTypes.length;c++){var o=navigator.mimeTypes[c];var l=o.type;var g=l.indexOf(";");if(g>-1){l=l.substr(0,g)}var f=o.enabledPlugin;var j=f&&f.name?f.name:"";var n=f&&f.filename?f.filename:"";r="";if(p&&l=="application/x-java-applet"){this.clientSupports.cortado=true;r=""}else{if(n.indexOf("libtotem")>-1){r="totem"}else{if(n.indexOf("libkmplayerpart")>-1){if(j=="Windows Media Player Plugin"||j=="QuickTime Plug-in"){r="kmplayer"}}else{if(n.indexOf("kaffeineplugin")>-1){r="kaffeine"}else{if(j.indexOf("mplayerplug-in")>-1){r="mplayerplug-in"}else{if(n.indexOf("mplayerplug-in-qt")>-1){r=""}else{if(j.indexOf("QuickTime Plug-in")>-1){r="quicktime-mozilla"}else{if(j.toLowerCase()=="vlc multimedia plugin"){r="vlc-mozilla"}else{if(l=="application/ogg"){r="oggPlugin"}}}}}}}}}if(this.konqueror&&r=="vlc-mozilla"){r=""}if(!(r in b)){b[r]={}}b[r][l]=true;if(!(l in m)){m[l]={};h[l]=0}if(!(r in m[l])){m[l][r]=true;h[l]++}}for(c=0;c<this.players.length;c++){r=this.players[c];if(!(r in b)){continue}var d=this.mimeTypes[r];if(d in h&&h[d]==1&&d in b[r]){this.debug(r+" -> "+d);this.clientSupports[r]=true;continue}for(var l in b[r]){if(h[l]==1){this.mimeTypes[r]=l;this.clientSupports[r]=true;this.debug(r+" => "+l);break}}if(!(r in this.clientSupports)){if(b[r].length>0){this.debug("No unique MIME type for "+r)}else{this.debug("No types for player "+r)}}}},testActiveX:function(a){if(this.mozilla){return false}var b=true;try{var d=new ActiveXObject(""+a)}catch(c){b=false}return b},addOption:function(a,d,e,c){var b=document.createElement("option");b.value=d;b.appendChild(document.createTextNode(e));if(c){b.selected=true}a.appendChild(b)},hx:function(a){if(typeof a!="String"){a=a.toString()}return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},hq:function(a){return'"'+this.hx(a)+'"'},getMsg:function(a){if(a in this.msg){return this.msg[a]}else{if(a in this.defaultMsg){return this.defaultMsg[a]}else{return"["+a+"]"}}},makeOptionsBox:function(j,d){var b,c,k,g,n,f;b=document.createElement("div");b.style.cssText="width: "+(d.width-10)+"px; display: none;";b.className="ogg-player-options";b.id=d.id+"_options_box";b.align="center";g=document.createElement("ul");if(d.linkUrl){n=document.createElement("li");k=document.createElement("a");k.href=wgServer+d.linkUrl;k.target="_blank";k.appendChild(document.createTextNode(this.msg["ogg-desc-link"]));n.appendChild(k);g.appendChild(n)}n=document.createElement("li");k=document.createElement("a");k.href=d.videoUrl;k.appendChild(document.createTextNode(this.msg["ogg-download"]));n.appendChild(k);g.appendChild(n);b.appendChild(g);c=document.createElement("p");c.appendChild(document.createTextNode(this.msg["ogg-use-player"]));b.appendChild(c);g=document.createElement("ul");for(var e=0;e<this.players.length+1;e++){var m,h;if(e==this.players.length){m="thumbnail";if(d.isVideo){h="ogg-player-thumbnail"}else{h="ogg-player-soundthumb"}}else{m=this.players[e];if(!this.clientSupports[m]){continue}h="ogg-player-"+m}n=document.createElement("li");if(m==j){var l=document.createElement("strong");l.appendChild(document.createTextNode(this.getMsg(h)+" "+this.msg["ogg-player-selected"]));n.appendChild(l)}else{k=document.createElement("a");k.href='javascript:void("'+m+'")';k.onclick=this.makePlayerFunction(m,d);k.appendChild(document.createTextNode(this.getMsg(h)));n.appendChild(k)}g.appendChild(n)}b.appendChild(g);div2=document.createElement("div");div2.style.cssText="text-align: center;";f=document.createElement("button");f.appendChild(document.createTextNode(this.msg["ogg-dismiss"]));f.onclick=this.makeDismissFunction(d.id);div2.appendChild(f);b.appendChild(div2);return b},makeOptionsLink:function(c){var b=document.createElement("a");b.href='javascript:void("options")';b.id=c+"_options_link";b.onclick=this.makeDisplayOptionsFunction(c);b.appendChild(document.createTextNode(this.msg["ogg-more"]));return b},setCssProperty:function(a,d,c){var b=new RegExp(d+":[^;](;|$)");if(a.style.cssText.search(b)>-1){a.style.cssText=a.style.cssText.replace(b,d+":"+c+"$1")}else{if(a.style.cssText==""){a.style.cssText=d+":"+c+";"}else{if(a.style.cssText[a.style.cssText.length-1]==";"){a.style.cssText+=d+":"+c+";"}else{a.style.cssText+=";"+d+":"+c+";"}}}},makeDismissFunction:function(b){var a=this;return function(){var d=document.getElementById(b+"_options_link");var c=document.getElementById(b+"_options_box");a.setCssProperty(d,"display","inline");a.setCssProperty(c,"display","none")}},makeDisplayOptionsFunction:function(b){var a=this;return function(){var d=document.getElementById(b+"_options_link");var c=document.getElementById(b+"_options_box");a.setCssProperty(d,"display","none");a.setCssProperty(c,"display","block")}},makePlayerFunction:function(a,b){var c=this;return function(){if(a!="thumbnail"){var d=7*86400*1000;c.setCookie("ogg_player",a,d,false,false,false,false)}c.init(a,b)}},newButton:function(a,c,d){var b=document.createElement("input");b.type="image";b.src=this.extPathUrl+"/"+c;b.alt=b.value=b.title=this.msg[a];b.onclick=d;return b},newPlayButton:function(a){return this.newButton("ogg-play","play.png",function(){a.play()})},newPauseButton:function(a){return this.newButton("ogg-pause","pause.png",function(){a.pause()})},newStopButton:function(a){return this.newButton("ogg-stop","stop.png",function(){a.stop()})},embedVideoElement:function(a,b){var c=a.id+"_obj";a.innerHTML="<div><video id="+this.hq(c)+" width="+this.hq(b.width)+" height="+this.hq(b.height)+" src="+this.hq(b.videoUrl)+' autoplay="1" controls="1" /></div>'},embedOggPlugin:function(a,c,b){var d=a.id+"_obj";a.innerHTML+="<div><object id="+this.hq(d)+" type='"+this.mimeTypes[b]+"' width="+this.hq(c.width)+" height="+this.hq(c.height+this.controlsHeightGuess)+" data="+this.hq(c.videoUrl)+"></object></div>"},embedVlcPlugin:function(a,c){var e=a.id+"_obj";a.innerHTML+="<div><object id="+this.hq(e)+" type='"+this.mimeTypes["vlc-mozilla"]+"' width="+this.hq(c.width)+" height="+this.hq(c.height)+" data="+this.hq(c.videoUrl)+"></object></div>";var b=document.getElementById(e);var d=document.createElement("div");d.appendChild(this.newPlayButton(b));d.appendChild(this.newPauseButton(b));d.appendChild(this.newStopButton(b));a.appendChild(d)},embedVlcActiveX:function(a,d){var f=a.id+"_obj";var b="<div><object id="+this.hq(f)+' classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" width='+this.hq(d.width)+" height="+this.hq(d.height)+' style="width: '+this.hx(d.width)+"px; height: "+this.hx(d.height)+'px;"><param name="mrl" value='+this.hq(d.videoUrl)+"/></object></div>";a.innerHTML+=b;var c=document.getElementById(f);if(d.width&&d.height){c.width=d.width;c.height=d.height;c.style.width=d.width+"px";c.style.height=d.height+"px"}var e=document.createElement("div");e.appendChild(this.newButton("ogg-play","play.png",function(){c.playlist.play()}));e.appendChild(this.newButton("ogg-stop","stop.png",function(){c.playlist.stop()}));a.appendChild(e)},embedCortado:function(b,f){var e=18;var g=f.height+e;var c='<applet code="com.fluendo.player.Cortado.class"       width='+this.hq(f.width)+"      height="+this.hq(g)+"      archive="+this.hq(this.cortadoUrl)+'>  <param name="url"  value='+this.hq(f.videoUrl)+'/>  <param name="duration"  value='+this.hq(f.length)+'/>  <param name="seekable"  value="true"/>  <param name="autoPlay" value="true"/>  <param name="showStatus"  value="show"/>  <param name="showSpeaker" value="false"/>  <param name="statusHeight"  value="'+e+'"/></applet>';if(this.mozilla){var d=document.createElement("iframe");d.setAttribute("width",f.width);d.setAttribute("height",g);d.setAttribute("scrolling","no");d.setAttribute("frameborder",0);d.setAttribute("marginWidth",0);d.setAttribute("marginHeight",0);b.appendChild(d);var a=d.contentDocument;a.open();a.write("<html><body>"+c+"</body></html>");a.close()}else{b.innerHTML="<div>"+c+"</div>"}},embedQuicktimePlugin:function(b,e,c){var g=b.id+"_obj";var d=16;var a="";if(c=="quicktime-activex"){a='classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"'}b.innerHTML+="<div><object id="+this.hq(g)+" type='"+this.mimeTypes[c]+"' width="+this.hq(e.width)+" height="+this.hq(e.height+d)+" data="+this.hq(this.extPathUrl+"/null_file.mov")+" "+a+"><param name='SCALE' value='Aspect'/><param name='AUTOPLAY' value='True'/><param name='src' value="+this.hq(this.extPathUrl+"/null_file.mov")+"/><param name='QTSRC' value="+this.hq(e.videoUrl)+"/></object></div>";var f=this;this.qtTimers[e.id]=window.setInterval(this.makeQuickTimePollFunction(e),500)},makeQuickTimePollFunction:function(a){var b=this;return function(){var f=document.getElementById(a.id);var k=a.id+"_obj";var i=document.getElementById(k);if(f&&i){var d=false,c=false;try{d=i.GetComponentVersion("imdc","XiTh","Xiph");c=true}catch(h){}if(c){window.clearInterval(b.qtTimers[a.id]);if(!d||d=="0.0"){var j=document.createElement("div");j.className="ogg-player-options";j.style.cssText="width:"+(a.width-10)+"px;";j.innerHTML=b.getMsg("ogg-no-xiphqt");var g=document.getElementById(a.id+"_options_box");if(g){f.insertBefore(j,g.parentNode)}else{f.appendChild(j)}}b.setParam(i,"AUTOPLAY","False")}}}},addParam:function(b,a,c){var d=document.createElement("param");d.setAttribute("name",a);d.setAttribute("value",c);b.appendChild(d)},setParam:function(b,a,d){var e=b.getElementsByTagName("param");for(var c=0;c<e.length;c++){if(e[c].name.toLowerCase()==a.toLowerCase()){e[c].value=d;return}}this.addParam(b,a,d)},setCookie:function(b,e,c,g,d,f){var a=false;if(c){a=new Date();a.setTime(a.getTime()+c)}document.cookie=b+"="+escape(e)+(a?("; expires="+a.toGMTString()):"")+(g?("; path="+g):"")+(d?("; domain="+d):"")+(f?"; secure":"")},getCookie:function(b){var a=document.cookie.match(b+"=(.*?)(;|$)");return a?unescape(a[1]):false}};