/**
-
The Nomensa accessible media player is a flexible multimedia solution for websites and intranets.
-
The core player consists of JavaScript wrapper responsible for generating an accessible HTML toolbar
-
for interacting with a media player of your choice. We currently provide support for YouTube (default),
-
Vimeo and JWPlayer although it should be possible to integrate the player with almost any media player on
-
the web (provided a JavaScript api for the player in question is available).
*
-
Copyright (C) 2013 Nomensa Ltd
*
-
Version 2.1.2
*
-
This program is free software: you can redistribute it and/or modify
-
it under the terms of the GNU General Public License as published by
-
the Free Software Foundation, either version 3 of the License, or
-
(at your option) any later version.
*
-
This program is distributed in the hope that it will be useful,
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
GNU General Public License for more details.
*
-
You should have received a copy of the GNU General Public License
-
along with this program. If not, see <www.gnu.org/licenses/>.
**/ var swfobject=function(){var aq=“undefined”,aD=“object”,ab=“Shockwave Flash”,X=“ShockwaveFlash.ShockwaveFlash”,aE=“application/x-shockwave-flash”,ac=“SWFObjectExprInst”,ax=“onreadystatechange”,af=window,aL=document,aB=navigator,aa=false,Z=,aG=[],ag=,al=[],aJ,ad,ap,at,ak=false,aU=false,aH,an,aI=true,ah=function(){var a=typeof aL.getElementById!=aq&&typeof aL.getElementsByTagName!=aq&&typeof aL.createElement!=aq,e=aB.userAgent.toLowerCase(),c=aB.platform.toLowerCase(),h=c?/win/.test©:/win/.test(e),j=c?/mac/.test©:/mac/.test(e),g=/webkit/.test(e)?parseFloat(e.replace(/^.*webkit/(d+(.d+)?).*$/,“$1”)):false,d=!+“v1”,f=,k=null;if(typeof aB.plugins!=aq&&typeof aB.plugins==aD){k=aB.plugins.description;if(k&&!(typeof aB.mimeTypes!=aq&&aB.mimeTypes&&!aB.mimeTypes.enabledPlugin)){aa=true;d=false;k=k.replace(/^.*s+(S+s+S+$)/,“$1”);f=parseInt(k.replace(/^(.*)..*$/,“$1”),10);f=parseInt(k.replace(/^.*.(.*)s.*$/,“$1”),10);f=/[a-zA-Z]/.test(k)?parseInt(k.replace(/^.*+(.*)$/,“$1”),10):0;}}else{if(typeof af.ActiveXObject!=aq){try{var i=new ActiveXObject(X);if(i){k=i.GetVariable(“$version”);if(k){d=true;k=k.split(“ ”)[1].split(“,”);f=[parseInt(k,10),parseInt(k,10),parseInt(k,10)];}}}catch(b){}}}return{w3:a,pv:f,wk:g,ie:d,win:h,mac:j};}(),aK=function(){if(!ah.w3){return;}if((typeof aL.readyState!=aq&&aL.readyState==“complete”)||(typeof aL.readyState==aq&&(aL.getElementsByTagName(“body”)||aL.body))){aP();}if(!ak){if(typeof aL.addEventListener!=aq){aL.addEventListener(“DOMContentLoaded”,aP,false);}if(ah.ie&&ah.win){aL.attachEvent(ax,function(){if(aL.readyState==“complete”){aL.detachEvent(ax,arguments.callee);aP();}});if(af==top){(function(){if(ak){return;}try{aL.documentElement.doScroll(“left”);}catch(a){setTimeout(arguments.callee,0);return;}aP();})();}}if(ah.wk){(function(){if(ak){return;}if(!/loaded|complete/.test(aL.readyState)){setTimeout(arguments.callee,0);return;}aP();})();}aC(aP);}}();function aP(){if(ak){return;}try{var b=aL.getElementsByTagName(“body”).appendChild(ar(“span”));b.parentNode.removeChild(b);}catch(a){return;}ak=true;var d=Z.length;for(var c=0;c<d;c++){Z();}}function aj(a){if(ak){a();}else{Z=a;}}function aC(a){if(typeof af.addEventListener!=aq){af.addEventListener(“load”,a,false);}else{if(typeof aL.addEventListener!=aq){aL.addEventListener(“load”,a,false);}else{if(typeof af.attachEvent!=aq){aM(af,“onload”,a);}else{if(typeof af.onload==“function”){var b=af.onload;af.onload=function(){b();a();};}else{af.onload=a;}}}}}function aN(){if(aa){Y();}else{am();}}function Y(){var d=aL.getElementsByTagName(“body”);var b=ar(aD);b.setAttribute(“type”,aE);var a=d.appendChild(b);if(a){var c=0;(function(){if(typeof a.GetVariable!=aq){var e=a.GetVariable(“$version”);if(e){e=e.split(“ ”)[1].split(“,”);ah.pv=[parseInt(e,10),parseInt(e,10),parseInt(e,10)];}}else{if(c<10){c++;setTimeout(arguments.callee,10);return;}}d.removeChild(b);a=null;am();})();}else{am();}}function am(){var g=aG.length;if(g>0){for(var h=0;h<g;h++){var c=aG.id;var l=aG.callbackFn;var a={success:false,id:c};if(ah.pv>0){var i=aS©;if(i){if(ao(aG.swfVersion)&&!(ah.wk&&ah.wk<312)){ay(c,true);if(l){a.success=true;a.ref=av©;l(a);}}else{if(aG.expressInstall&&au()){var e={};e.data=aG.expressInstall;e.width=i.getAttribute(“width”)||“0”;e.height=i.getAttribute(“height”)||“0”;if(i.getAttribute(“class”)){e.styleclass=i.getAttribute(“class”);}if(i.getAttribute(“align”)){e.align=i.getAttribute(“align”);}var f={};var d=i.getElementsByTagName(“param”);var k=d.length;for(var j=0;j<k;j++){if(d.getAttribute(“name”).toLowerCase()!=“movie”){f[d.getAttribute(“name”)]=d.getAttribute(“value”);}}ae(e,f,c,l);}else{aF(i);if(l){l(a);}}}}}else{ay(c,true);if(l){var b=av©;if(b&&typeof b.SetVariable!=aq){a.success=true;a.ref=b;}l(a);}}}}}function av(b){var d=null;var c=aS(b);if(c&&c.nodeName==“OBJECT”){if(typeof c.SetVariable!=aq){d=c;}else{var a=c.getElementsByTagName(aD);if(a){d=a;}}}return d;}function au(){return !aU&&ao(“6.0.65”)&&(ah.win||ah.mac)&&!(ah.wk&&ah.wk<312);}function ae(f,d,h,e){aU=true;ap=e||null;at={success:false,id:h};var a=aS(h);if(a){if(a.nodeName==“OBJECT”){aJ=aO(a);ad=null;}else{aJ=a;ad=h;}f.id=ac;if(typeof f.width==aq||(!/%$/.test(f.width)&&parseInt(f.width,10)<310)){f.width=“310”;}if(typeof f.height==aq||(!/%$/.test(f.height)&&parseInt(f.height,10)<137)){f.height=“137”;}aL.title=aL.title.slice(0,47)+“ - Flash Player Installation”;var b=ah.ie&&ah.win?“ActiveX”:“PlugIn”,c=“MMredirectURL=”+af.location.toString().replace(/&/g,“%26”)+“&MMplayerType=”b
“&MMdoctitle=”+aL.title;if(typeof d.flashvars!=aq){d.flashvars+=“&”+c;}else{d.flashvars=c;}if(ah.ie&&ah.win&&a.readyState!=4){var g=ar(“div”);h+=“SWFObjectNew”;g.setAttribute(“id”,h);a.parentNode.insertBefore(g,a);a.style.display=“none”;(function(){if(a.readyState==4){a.parentNode.removeChild(a);}else{setTimeout(arguments.callee,10);}})();}aA(f,d,h);}}function aF(a){if(ah.ie&&ah.win&&a.readyState!=4){var b=ar(“div”);a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(aO(a),b);a.style.display=“none”;(function(){if(a.readyState==4){a.parentNode.removeChild(a);}else{setTimeout(arguments.callee,10);}})();}else{a.parentNode.replaceChild(aO(a),a);}}function aO(b){var d=ar(“div”);if(ah.win&&ah.ie){d.innerHTML=b.innerHTML;}else{var e=b.getElementsByTagName(aD);if(e){var a=e.childNodes;if(a){var f=a.length;for(var c=0;c<f;c++){if(!(a.nodeType==1&&a.nodeName==“PARAM”)&&!(a.nodeType==8)){d.appendChild(a.cloneNode(true));}}}}}return d;}function aA(e,g,c){var d,a=aS©;if(ah.wk&&ah.wk<312){return d;}if(a){if(typeof e.id==aq){e.id=c;}if(ah.ie&&ah.win){var f=“”;for(var i in e){if(e!=Object.prototype){if(i.toLowerCase()==“data”){g.movie=e;}else{if(i.toLowerCase()==“styleclass”){f+=' class=“‘e[i]
'”';}else{if(i.toLowerCase()!=“classid”){f+=“ ”i
’=“‘e[i]
'”';}}}}}var h=“”;for(var j in g){if(g!=Object.prototype){h+='<param name=“'j
'” value=“’g[j]
'” />';}}a.outerHTML='<object classid=“clsid:D27CDB6E-AE6D-11cf-96B8-444553540000”‘f
“>”h
“”;ag=e.id;d=aS(e.id);}else{var b=ar(aD);b.setAttribute(“type”,aE);for(var k in e){if(e!=Object.prototype){if(k.toLowerCase()==“styleclass”){b.setAttribute(“class”,e);}else{if(k.toLowerCase()!=“classid”){b.setAttribute(k,e);}}}}for(var l in g){if(g!=Object.prototype&&l.toLowerCase()!=“movie”){aQ(b,l,g);}}a.parentNode.replaceChild(b,a);d=b;}}return d;}function aQ(b,d,c){var a=ar(“param”);a.setAttribute(“name”,d);a.setAttribute(“value”,c);b.appendChild(a);}function aw(a){var b=aS(a);if(b&&b.nodeName==“OBJECT”){if(ah.ie&&ah.win){b.style.display=“none”;(function(){if(b.readyState==4){aT(a);}else{setTimeout(arguments.callee,10);}})();}else{b.parentNode.removeChild(b);}}}function aT(a){var b=aS(a);if(b){for(var c in b){if(typeof b==“function”){b=null;}}b.parentNode.removeChild(b);}}function aS(a){var c=null;try{c=aL.getElementById(a);}catch(b){}return c;}function ar(a){return aL.createElement(a);}function aM(a,c,b){a.attachEvent(c,b);al=[a,c,b];}function ao(a){var b=ah.pv,c=a.split(“.”);c=parseInt(c,10);c=parseInt(c,10)||0;c=parseInt(c,10)||0;return(b>c||(b==c&&b>c)||(b==c&&b==c&&b>=c))?true:false;}function az(b,f,a,c){if(ah.ie&&ah.mac){return;}var e=aL.getElementsByTagName(“head”);if(!e){return;}var g=(a&&typeof a==“string”)?a:“screen”;if©{aH=null;an=null;}if(!aH||an!=g){var d=ar(“style”);d.setAttribute(“type”,“text/css”);d.setAttribute(“media”,g);aH=e.appendChild(d);if(ah.ie&&ah.win&&typeof aL.styleSheets!=aq&&aL.styleSheets.length>0){aH=aL.styleSheets;}an=g;}if(ah.ie&&ah.win){if(aH&&typeof aH.addRule==aD){aH.addRule(b,f);}}else{if(aH&&typeof aL.createTextNode!=aq){aH.appendChild(aL.createTextNode(b+“ {”f
“}”));}}}function ay(a,c){if(!aI){return;}var b=c?“visible”:“hidden”;if(ak&&aS(a)){aS(a).style.visibility=b;}else{az(“#”+a,“visibility:”+b);}}function ai(b){var .;“>a=//;var c=a.exec(b)!=null;return c&&typeof encodeURIComponent!=aq?encodeURIComponent(b):b;}var aR=function(){if(ah.ie&&ah.win){window.attachEvent(”onunload“,function(){var a=al.length;for(var b=0;b<a;b++){al[0].detachEvent(al[1],al[2]);}var d=ag.length;for(var c=0;c<d;c++){aw(ag);}for(var e in ah){ah=null;}ah=null;for(var f in swfobject){swfobject=null;}swfobject=null;});}}();return{registerObject:function(a,e,c,b){if(ah.w3&&a&&e){var d={};d.id=a;d.swfVersion=e;d.expressInstall=c;d.callbackFn=b;aG=d;ay(a,false);}else{if(b){b({success:false,id:a});}}},getObjectById:function(a){if(ah.w3){return av(a);}},embedSWF:function(k,e,h,f,c,a,b,i,g,j){var d={success:false,id:e};if(ah.w3&&!(ah.wk&&ah.wk<312)&&k&&e&&h&&f&&c){ay(e,false);aj(function(){h+=”“;f+=”“;var q={};if(g&&typeof g===aD){for(var o in g){q=g;}}q.data=k;q.width=h;q.height=f;var n={};if(i&&typeof i===aD){for(var p in i){n=i;}}if(b&&typeof b===aD){for(var l in b){if(typeof n.flashvars!=aq){n.flashvars+=”&“l
”=“+b;}else{n.flashvars=l+”=“+b;}}}if(ao©){var m=aA(q,n,e);if(q.id==e){ay(e,true);}d.success=true;d.ref=m;}else{if(a&&au()){q.data=a;ae(q,n,e,j);return;}else{ay(e,true);}}if(j){j(d);}});}else{if(j){j(d);}}},switchOffAutoHideShow:function(){aI=false;},ua:ah,getFlashPlayerVersion:function(){return{major:ah.pv,minor:ah.pv,release:ah.pv};},hasFlashPlayerVersion:ao,createSWF:function(a,b,c){if(ah.w3){return aA(a,b,c);}else{return undefined;}},showExpressInstall:function(b,a,d,c){if(ah.w3&&au()){ae(b,a,d,c);}},removeSWF:function(a){if(ah.w3){aw(a);}},createCSS:function(b,a,c,d){if(ah.w3){az(b,a,c,d);}},addDomLoadEvent:aj,addLoadEvent:aC,getQueryParamValue:function(b){var a=aL.location.search||aL.location.hash;if(a){if(/?/.test(a)){a=a.split(”?“);}if(b==null){return ai(a);}var c=a.split(”&“);for(var d=0;d<c.length;d++){if(c.substring(0,c.indexOf(”=“))==b){return ai(c.substring((c.indexOf(”=“)+1)));}}}return”“;},expressInstallCallback:function(){if(aU){var a=aS(ac);if(a&&aJ){a.parentNode.replaceChild(aJ,a);if(ad){ay(ad,true);if(ah.ie&&ah.win){aJ.style.display=”block“;}}if(ap){ap(at);}}aU=false;}}};}();(function(d){d.NOMENSA=d.NOMENSA||{};var a,c,b;d.NOMENSA.uaMatch=function(f){f=f.toLowerCase();var e=/(webkit)[ /]([w.]+)/.exec(f)||/(opera)(?:.*version|)[ /]([w.]+)/.exec(f)||/(msie) ([w.]+)/.exec(f)||f.indexOf(”compatible“)<0&&/(mozilla)(?:.*? rv:(+)|)/.exec(f)||[];return{browser:e[1]||”“,version:e||”0“};};a=d.NOMENSA.uaMatch(d.navigator.userAgent);c={};if(a.browser){c=true;c.version=a.version;}d.NOMENSA.browser=c;})(window);window.NOMENSA=window.NOMENSA||{};window.NOMENSA.player=window.NOMENSA.player||{};window.NOMENSA.player.YoutubePlayer=function(a){this.config=a;this.config.playerVars={controls:0,showinfo:0,origin:window.location.protocol+”//“+window.location.hostname,rel:0};};window.NOMENSA.player.YoutubePlayer.apiLoaded=false;window.NOMENSA.player.YoutubePlayer.prototype={getYTOptions:function(){var b=this,a={height:this.config.flashHeight,width:this.config.flashWidth,videoId:this.config.media,events:{onReady:function©{b.$html.find(”iframe“).attr({id:b.config.id,role:”presentation“});b.onPlayerReady©;},onStateChange:function©{b.onPlayerStateChange(c.data);}}};a.playerVars=this.config.playerVars;if(this.config.repeat){a.playerVars.playlist=this.config.media;}return a;},init:function(){if(typeof window.postMessage!==”undefined“){return function(d){var a=document.createElement(”script“),b=document.getElementsByTagName(”script“),c=this;this.$html=this.assembleHTML();if(this.config.captions){this.getCaptions();}d.html(this.$html);window.NOMENSA.player.PlayerDaemon.addPlayer(this);if(!window.NOMENSA.player.YoutubePlayer.apiLoaded){if(typeof window.onYouTubeIframeAPIReady===”undefined“){window.onYouTubeIframeAPIReady=function(){window.NOMENSA.player.PlayerDaemon.map(function(e){if(typeof e.getYTOptions!==”undefined“){e.player=new YT.Player(”player-“+e.config.id,e.getYTOptions());}});window.NOMENSA.player.YoutubePlayer.apiLoaded=true;};a.src=”//www.youtube.com/iframe_api“;b.parentNode.insertBefore(a,b);}}else{this.player=YT.Player(”player-“+player.config.id,getOptions(player));}};}else{return function(b){var a=this;this.$html=this.assembleHTML();if(this.config.captions){this.getCaptions();}b.html(this.$html);window.NOMENSA.player.PlayerDaemon.addPlayer(this);window.NOMENSA.player.stateHandlers=function(d){var c=window.NOMENSA.player.PlayerDaemon.getPlayer(a.config.id);c.onPlayerStateChange(d);};window.onYouTubePlayerReady=function©{var d=window.NOMENSA.player.PlayerDaemon.getPlayer©;var e=document.getElementById(d.config.id);d.player=e;d.cue();d.getPlayer().addEventListener(”onStateChange“,”window.NOMENSA.player.stateHandlers.“+a.config.id);d.onPlayerReady();};};}}(),state:{ended:0,playing:1,paused:2,unstarted:-1},onPlayerReady:(function(){var b=[],a;return function(d){var c=b.length;if(typeof d===”function“){b.push(d);}else{if(c===0){return false;}for(a=0;a<c;a++){b.apply(this,arguments);}}};}()),onPlayerStateChange:function(a){if(a==1){this.play();if(this.config.buttons.toggle){this.$html.find(”.play“).removeClass(”play“).addClass(”pause“).text(”Pause“);}}else{if(this.config.repeat&&(a==0)){this.play();}}},getFlashVars:function(){var a={controlbar:”none“,file:this.config.media};if(this.config.image!=”“){a.image=this.config.image;}if(this.config.repeat){a.repeat=this.config.repeat;}return a;},getFlashParams:function(){return{allowScriptAccess:”always“,wmode:”transparent“};},generateFlashPlayer:function©{var g=this;var a=this.getFlashVars();var f=this.getFlashParams();var h={id:this.config.id,name:this.config.id};var e=$(”<“this.config.flashContainer
” />“).attr(”id“,”player-“+this.config.id).addClass(”flashReplace“).html('This content requires Macromedia Flash Player. You can <a href=”install“>get.adobe.com/flashplayer/”>install or upgrade the Adobe Flash Player here</a>.');var d=$(“<span />”).addClass(“video”);var b=this.getURL();setTimeout(function(){swfobject.embedSWF(b,e.attr(“id”),g.config.flashWidth,g.config.flashHeight,“9.0.115”,null,a,f,h,g.config.swfCallback);if(window.NOMENSA.browser.mozilla&&(parseInt(window.NOMENSA.browser.version,10)>=2)){g.$html.find(“object”).attr(“tabindex”,“-1”);}},0);c.append(d.append(e));return c;},generateVideoPlayer:function(b){if(typeof window.postMessage===“undefined”){return this.generateFlashPlayer(b);}else{var a=$(“<”this.config.flashContainer
“ />”).attr(“id”,“player-”+this.config.id);var c=$(“<span />”).addClass(“video”);b.append(c.append(a));return b;}},getPlayer:function(){return this.player;},is_html5:false,play:function(){this.player.playVideo();this.setSliderTimeout();if(this.config.captionsOn&&this.captions){this.setCaptionTimeout();}},pause:function(){this.player.pauseVideo();this.clearSliderTimeout();if(this.config.captionsOn&&this.captions){this.clearCaptionTimeout();}},ffwd:function(){var b=this.getCurrentTime()+this.config.playerSkip,a=this.getDuration();if(b>a){b=a;}this.seek(b);},rewd:function(){var a=this.getCurrentTime()-this.config.playerSkip;if(a<0){a=0;}this.seek(a);},mute:function(){var a=this.$html.find(“button.mute”);if(this.player.isMuted()){this.player.unMute();if(a.hasClass(“muted”)){a.removeClass(“muted”);}}else{this.player.mute();a.addClass(“muted”);}},volup:function(){var a=this.player.getVolume();if(a>=100){a=100;}else{a=a+this.config.volumeStep;}this.player.setVolume(a);this.updateVolume(a);},voldwn:function(){var a=this.player.getVolume();if(a<=0){a=0;}else{a=a-this.config.volumeStep;}this.player.setVolume(a);this.updateVolume(a);},getDuration:function(){return this.player.getDuration();},getCurrentTime:function(){return this.player.getCurrentTime();},getBytesLoaded:function(){return this.player.getVideoBytesLoaded();},getBytesTotal:function(){return this.player.getVideoBytesTotal();},seek:function(a){this.player.seekTo(a,true);if(this.config.captionsOn&&this.captions){this.$html.find(“.caption”).remove();this.clearCaptionTimeout();this.setCaptionTimeout();this.getPreviousCaption();}},cue:function(){this.player.cueVideoById(this.config.media);},toggleCaptions:function(){var a=this;var b=this.$html.find(“.captions”);if(b.hasClass(“captions-off”)){b.removeClass(“captions-off”).addClass(“captions-on”);a.getPreviousCaption();a.setCaptionTimeout();a.config.captionsOn=true;}else{b.removeClass(“captions-on”).addClass(“captions-off”);a.clearCaptionTimeout();a.$html.find(“.caption”).remove();a.config.captionsOn=false;}}};window.NOMENSA=window.NOMENSA||{};window.NOMENSA.player=window.NOMENSA.player||{};window.NOMENSA.player.MediaplayerDecorator=function(a){var b=a;this.config=b.config;this.player=b.player;this.state=b.state;for(var c in b){if(typeof b===“function”){this=(function(d){return function(){return b.apply(this,arguments);};}©);}}};window.NOMENSA.player.MediaplayerDecorator.prototype.generatePlayerContainer=function(){var a=$(“<”this.config.playerContainer
“ />”).css(this.config.playerStyles).addClass(“player-container”);if(window.NOMENSA.browser.msie){a.addClass(“player-container-ie player-container-ie-”+window.NOMENSA.browser.version.substring(0,1));}return a;};window.NOMENSA.player.MediaplayerDecorator.prototype.assembleHTML=function(){var a=this.generatePlayerContainer();var c=this.generateVideoPlayer(a);var b=c.append(this.getControls());return b;};window.NOMENSA.player.MediaplayerDecorator.prototype.getURL=function(){return.join(“”);};window.NOMENSA.player.MediaplayerDecorator.prototype.createButton=function(d,b){var a=0;var e=.join(“-”);var c=$(“<button />”).append(b).addClass(d).attr({title:d,id:e}).addClass(“ui-corner-all ui-state-default”).hover(function(){$(this).addClass(“ui-state-hover”);},function(){$(this).removeClass(“ui-state-hover”);}).focus(function(){$(this).addClass(“ui-state-focus”);}).blur(function(){$(this).removeClass(“ui-state-focus”);}).click(function(f){f.preventDefault();});return c;};window.NOMENSA.player.MediaplayerDecorator.prototype.getFuncControls=function(){var l=this;var j=$(“b
’”]');if(a.length==1){this.insertCaption(a);}}};window.NOMENSA.player.MediaplayerDecorator.prototype.insertCaption=function(a){if(this.$html.find(“.caption”).length==1){this.$html.find(“.caption”).text(a.text());}else{var b=$(“b
‘”]');while((a.length!=1)&&(c>0)){c–;b=this.formatTime(parseInt(c,10));a=this.captions.filter(’[begin=“‘b
’”]');}if(a.length==1){this.insertCaption(a);}}};window.NOMENSA.player.MediaplayerDecorator.prototype.destroyPlayerInstance=function(){return false;};window.NOMENSA.player.MediaplayerDecorator.prototype.destroy=function(){this.clearSliderTimeout();this.clearCaptionTimeout();this.destroyPlayerInstance();this.$html.remove();};window.NOMENSA.player.MediaplayerDecorator.prototype.setCaptionTimeout=function(){var a=this;if(a.captionInterval==undefined){a.captionInterval=setInterval(function(){a.syncCaptions();},500);}};window.NOMENSA.player.MediaplayerDecorator.prototype.clearCaptionTimeout=function(){if(this.captionInterval!=undefined){this.captionInterval=clearInterval(this.captionInterval);}};window.NOMENSA=window.NOMENSA||{};window.NOMENSA.player=window.NOMENSA.player||{};jQuery(function(a){a(window).resize(function(){a(“.player-container”).each(function(){if(a(this).width()>580){a(this).addClass(“player-wide”);}else{a(this).removeClass(“player-wide”);}});});});if(typeof window.postMessage===“undefined”){window.NOMENSA.player.stateHandlers={};}window.NOMENSA.player.PlayerManager=function(){var a={};this.getPlayer=function(b){if(a!=undefined){return a;}return null;};this.addPlayer=function(b){a=b;return true;};this.removePlayer=function(b){if(a!=undefined){a.destroy();delete a;}};this.map=function©{var b;for(b in a){c(a);}};};window.NOMENSA.player.PlayerDaemon=new window.NOMENSA.player.PlayerManager();var html5_methods={play:function(){this.player.play();this.setSliderTimeout();if(this.config.captionsOn&&this.captions){this.setCaptionTimeout();}},pause:function(){this.player.pause();this.clearSliderTimeout();if(this.config.captionsOn&&this.captions){this.clearCaptionTimeout();}},ffwd:function(){var a=this.getCurrentTime()+this.config.playerSkip;this.seek(a);},rewd:function(){var a=this.getCurrentTime()-this.config.playerSkip;if(a<0){a=0;}this.seek(a);},mute:function(){var a=this.$html.find(“button.mute”);if(this.player.muted){this.player.muted=false;if(a.hasClass(“muted”)){a.removeClass(“muted”);}}else{this.player.muted=true;a.addClass(“muted”);}},volup:function(){var a=this.player.volume*100;if(a<(100-this.config.volumeStep)){a+=this.config.volumeStep;}else{a=100;}this.player.volume=(a/100);this.updateVolume(Math.round(a));},voldwn:function(){var a=this.player.volume*100;if(a>this.config.volumeStep){a-=this.config.volumeStep;}else{a=0;}this.player.volume=(a/100);this.updateVolume(Math.round(a));},getDuration:function(){return this.player.duration;},getCurrentTime:function(){return this.player.currentTime;},getBytesLoaded:function(){return this.player.buffered.end(0);},getBytesTotal:function(){return this.player.duration;},seek:function(a){this.player.currentTime=a;},cue:function(){return;}};(function(a){a.fn.player=function(k,f){var e={id:“media_player”,url:window.location.protocol+“//www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=”,media:“8LiQ-bLJaM4”,repeat:false,captions:null,captionsOn:true,flashWidth:“100%”,flashHeight:“300px”,playerStyles:{height:“100%”,width:“100%”},sliderTimeout:350,flashContainer:“span”,playerContainer:“span”,image:“”,playerSkip:10,volumeStep:10,buttons:{forward:true,rewind:true,toggle:true},logoURL:“http://www.nomensa.com?ref=logo”,useHtml5:true,swfCallback:null};var c=a.extend(true,{},e,k);var i=function(p){var s=p.config.media,r,o,q,n,m,l;n=function(t){r=document.createElement(t.container);if(r.canPlayType!=undefined){q=r.canPlayType(t.mimetype);if((q.toLowerCase()==“maybe”)||(q.toLowerCase()==“probably”)){return true;}}};if(typeof s===“string”){o=g(s);if(n(o)){o.src=s;return o;}}if((s instanceof Array)&&(typeof s.push!==“undefined”)){for(m=0,l=s.length;m<l;m++){o=g(s);if(n(o)){o.src=s;return o;}}}return false;};var h=function(n){var m=“”;var l=“video”;switch(n){case“mp4”:m='video/mp4; codecs=“avc1.42E01E, mp4a.40.2”';break;case“m4v”:m='video/mp4; codecs=“avc1.42E01E, mp4a.40.2”';break;case“ogg”:m='video/ogg; codecs=“theora, vorbis”';break;case“ogv”:m='video/ogg; codecs=“theora, vorbis”';break;case“webm”:m='video/webm; codecs=“vp8, vorbis”';break;case“mp3”:m=“audio/mpeg”;l=“audio”;break;}return{mimetype:m,container:l};};var g=function(o){var m=o.lastIndexOf(“.”);if(m!=-1){var l=o.substring(m+1);var n=h(l);return n;}return null;};var b=function(){if(window.NOMENSA.browser.mozilla){return(parseInt(window.NOMENSA.browser.version,10)>=2)?true:false;}return false;};var d={generatePlayerContainer:function(){var l=a(“<”this.config.playerContainer
“ />”).css(this.config.playerStyles).addClass(“player-container”);if(window.NOMENSA.browser.msie){l.addClass(“player-container-ie player-container-ie-”+window.NOMENSA.browser.version.substring(0,1));}return l;},getFlashVars:function(){var l={controlbar:“none”,file:this.config.media};if(this.config.image!=“”){l.image=this.config.image;}if(this.config.repeat){l.repeat=this.config.repeat;}return l;},getFlashParams:function(){return{allowScriptAccess:“always”,wmode:“transparent”};},getURL:function(){return.join(“”);},generateFlashPlayer:function(n){var r=this;var l=this.getFlashVars();var q=this.getFlashParams();var s={id:this.config.id,name:this.config.id};var p=a(“<”this.config.flashContainer
“ />”).attr(“id”,“player-”+this.config.id).addClass(“flashReplace”).html('This content requires Macromedia Flash Player. You can <a href=“install”>get.adobe.com/flashplayer/“>install or upgrade the Adobe Flash Player here</a>.');var o=a(”<span />“).addClass(”video“);var m=this.getURL();setTimeout(function(){swfobject.embedSWF(m,p.attr(”id“),r.config.flashWidth,r.config.flashHeight,”9.0.115“,null,l,q,s,r.config.swfCallback);if(b()){r.$html.find(”object“).attr(”tabindex“,”-1“);}},0);n.append(o.append(p));return n;},generateHTML5Player:function(m,p,o){var n=a(”<span />“);n.className=”video“;var l=a(”<“p
” />“).attr({id:this.config.id,src:this.config.media,type:o}).css({width:”100%“,height:”50%“});if(a.trim(this.config.image)!=”“){l.attr({poster:a.trim(this.config.image)});}return m.append(n.append(l));},createButton:function(o,m){var l=0;var p=.join(”-“);var n=a(”<button />“).append(m).addClass(o).attr({title:o,id:p}).addClass(”ui-corner-all ui-state-default“).hover(function(){a(this).addClass(”ui-state-hover“);},function(){a(this).removeClass(”ui-state-hover“);}).focus(function(){a(this).addClass(”ui-state-focus“);}).blur(function(){a(this).removeClass(”ui-state-focus“);}).click(function(q){q.preventDefault();});return n;},getFuncControls:function(){var v=this;var t=a(”m
‘“]');if(l.length==1){this.insertCaption(l);}}},insertCaption:function(l){if(this.$html.find(”.caption“).length==1){this.$html.find(”.caption“).text(l.text());}else{var m=a(”m
’“]');while((l.length!=1)&&(n>0)){n–;m=this.formatTime(parseInt(n,10));l=this.captions.filter(‘[begin=”’m
‘“]');}if(l.length==1){this.insertCaption(l);}}},destroyPlayerInstance:function(){return false;},destroy:function(){this.clearSliderTimeout();this.clearCaptionTimeout();this.destroyPlayerInstance();this.$html.remove();},setCaptionTimeout:function(){var l=this;if(l.captionInterval==undefined){l.captionInterval=setInterval(function(){l.syncCaptions();},500);}},clearCaptionTimeout:function(){if(this.captionInterval!=undefined){this.captionInterval=clearInterval(this.captionInterval);}},play:function(){this.player.playVideo();this.setSliderTimeout();if(this.config.captionsOn&&this.captions){this.setCaptionTimeout();}},pause:function(){this.player.pauseVideo();this.clearSliderTimeout();if(this.config.captionsOn&&this.captions){this.clearCaptionTimeout();}},ffwd:function(){var l=this.getCurrentTime()+this.config.playerSkip;this.seek(l);},rewd:function(){var l=this.getCurrentTime()-this.config.playerSkip;if(l<0){l=0;}this.seek(l);},mute:function(){var l=this.$html.find(”button.mute“);if(this.player.isMuted()){this.player.unMute();if(l.hasClass(”muted“)){l.removeClass(”muted“);}}else{this.player.mute();l.addClass(”muted“);}},volup:function(){var l=this.player.getVolume();if(l<(100-this.config.volumeStep)){l+=this.config.volumeStep;}else{l=100;}this.player.setVolume(l);this.updateVolume(l);},voldwn:function(){var l=this.player.getVolume();if(l>this.config.volumeStep){l-=this.config.volumeStep;}else{l=0;}this.player.setVolume(l);this.updateVolume(l);},getDuration:function(){return this.player.getDuration();},getCurrentTime:function(){return this.player.getCurrentTime();},getBytesLoaded:function(){return this.player.getVideoBytesLoaded();},getBytesTotal:function(){return this.player.getVideoBytesTotal();},seek:function(l){this.player.seekTo(l);if(this.config.captionsOn&&this.captions){this.$html.find(”.caption“).remove();this.clearCaptionTimeout();this.setCaptionTimeout();this.getPreviousCaption();}},cue:function(){this.player.cueVideoById(this.config.media);},toggleCaptions:function(){var l=this;var m=this.$html.find(”.captions“);if(m.hasClass(”captions-off“)){m.removeClass(”captions-off“).addClass(”captions-on“);l.getPreviousCaption();l.setCaptionTimeout();l.config.captionsOn=true;}else{m.removeClass(”captions-on“).addClass(”captions-off“);l.clearCaptionTimeout();l.$html.find(”.caption“).remove();l.config.captionsOn=false;}}};function j(l){this.config=c;a.extend(true,this,d,f);this.is_html5=false;var m=i(this);if(m&&this.config.useHtml5){this.config.media=m.src;this.is_html5=true;this.$html=this.assembleHTML5(m.container,m.mimetype);a.extend(this,html5_methods);}else{if((this.config.media instanceof Array)&&(typeof this.config.media.push!==”undefined“)){this.config.media=this.config.media;}this.$html=this.assembleHTML();}if(this.config.captions){this.getCaptions();}}return this.each(function(n){var p=a(this),o,m,l=function(q){if(q.$html.width()>580){q.$html.addClass(”player-wide“);}if(q.is_html5){q.player=document.getElementById(q.config.id);}};if(c.url.match(/^(http|https)://www.youtube.com/)){o=new window.NOMENSA.player.YoutubePlayer©;m=new window.NOMENSA.player.MediaplayerDecorator(o);m.onPlayerReady(function(){l(m);this.getPlayer().setLoop(true);});m.init(p);}else{m=new j(n);p.html(m.$html);l(m);window.NOMENSA.player.PlayerDaemon.addPlayer(m);}});};}(jQuery));