/*!
 * projekktor zwei
 * http://www.projekktor.com
 *
 * Copyright 2010, Sascha Kluger, Spinning Airwhale Media, http://www.spinningairwhale.com
 * under GNU General Public License
 * http://www.projekktor.com/license/
 *
 * You can use, modify and distribute the software, but do so in the spirit of Open Source.
 * You need to leave the copyright notices intact.
 * You need to be able to share any modifications you make to the Projekktor source (not the software Projekktor is integrated to).
 * Give credit where credit is due, spread the word, link to us if you can.
 * 
 * Includes jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 * 
 * ,------------------------------------------,       .    _  .
 * |  Naaah, love shines through !!1!         |       |\_|/__/|
 * |------------------------------------------|     / / \/ \  \
 *                                           \     /__|O||O|__ \
 *                                             \  |/_ \_/\_/ _\ |
 *                                                | | (____) | ||
 *                                                \/\___/\__/  //
 *                                                (_/         ||
 *                                                 |          ||
 *                                                 |          ||\
 *                                                  \        //_/
 *                                                   \______//
 *                                                 __ || __||
 *                                                (____(____)
 */var playerObjectFLASH=function(){};playerObjectFLASH.prototype={createMediaElement:function(){var c=$("#"+this.environment.publicName+"_media");c.attr("style","width: 100%; height:100%; background-color: #000;");c.html("");this.elementReady=false;var b=this;var d;var e={id:this.environment.publicName+"_media_flash",name:this.environment.publicName+"_media_flash",src:"playerMP4.swf",width:"100%",height:"100%",AllowScriptAccess:"always",wmode:"opaque",flashvars:{src:this.media.file,autoplay:false,controlbar:false}};if(e.flashvars){e.flashvars=this.toFlashvarsString(e.flashvars)}if($.browser.msie){var a='<object id="'+e.id+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';a+='<param name="movie" value="'+e.src+"?"+e.flashvars+'"></param>';a+='<param name="AllowScriptAccess" value="'+e.allowscriptaccess+'"></param>';a+='<param name="wmode" value="'+e.wmode+'"></param>';a+="</object>"}else{var a="<embed "+this.toAttributeString(e)+"/>"}c[0].innerHTML=a;this.waitforPlayer()},waitforPlayer:function(){if(this.elementReady==true){return}var b=this;var a=$("#"+this.environment.publicName+"_media_flash");try{if(a[0]==undefined){setTimeout(function(){b.waitforPlayer()},500);return}if(a[0].api_get==undefined){setTimeout(function(){b.waitforPlayer()},500);return}if(a[0]["api_get"]("isReady")!=true){setTimeout(function(){b.waitforPlayer()},500);return}}catch(c){setTimeout(function(){b.waitforPlayer()},500);return}this.mediaElement=a[0];this.elementReady=true},addListeners:function(){this.mediaElement.api_attribute("onprogress","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.progressListener");this.mediaElement.api_attribute("ontimeupdate","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.timeListener");this.mediaElement.api_attribute("onended","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.endedListener");this.mediaElement.api_attribute("onpause","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.pauseListener");this.mediaElement.api_attribute("onplaying","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.playingListener");this.mediaElement.api_attribute("onplay","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.startListener");this.mediaElement.api_attribute("onvolumechange","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.volumeListener");this.mediaElement.api_attribute("onwaiting","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.waitingListener");this.mediaElement.api_attribute("oncanplaythrough","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.canplayListener");this.mediaElement.api_attribute("oncanplay","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.canplayListener");this.mediaElement.api_attribute("onerror","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.errorListener")},removeListeners:function(){try{this.mediaElement.api_attribute("ontimeupdate",false);this.mediaElement.api_attribute("onprogress",false);this.mediaElement.api_attribute("onended",false);this.mediaElement.api_attribute("onpause",false);this.mediaElement.api_attribute("onplaying",false);this.mediaElement.api_attribute("onplay",false);this.mediaElement.api_attribute("onvolumechange",false);this.mediaElement.api_attribute("onwaiting",false);this.mediaElement.api_attribute("oncanplaythrough",false);this.mediaElement.api_attribute("oncanplay",false);this.mediaElement.api_attribute("onerror",false)}catch(a){$C.log(a)}},reInit:function(){this.elementReady=false;this.removeListeners();this._reInitWait(false)},_reInitWait:function(a){var b=this;this.mediaElement=$("#"+this.environment.publicName+"_media_flash")[0];if(this.mediaElement.api_attribute==undefined&&a==true){setTimeout(function(){b._reInitWait(false)},500);return}else{if(this.mediaElement.api_attribute!=undefined&&a!=true){setTimeout(function(){b._reInitWait(true)},500);return}else{if(this.mediaElement.api_attribute==undefined){setTimeout(function(){b._reInitWait(true)},500);return}}}this.addListeners();if(this._isPlaying){this.setPlay()}},setSeek:function(b){try{this.mediaElement.api_seek(b)}catch(a){}},setVolume:function(a){try{this.mediaElement.api_volume(a)}catch(b){}},setPause:function(a){this._isPlaying=false;try{this.mediaElement.api_pause()}catch(b){}},setPlay:function(a){this._isPlaying=true;try{this.mediaElement.api_play()}catch(b){}},getVolume:function(){try{return this.mediaElement.api_get("volume")}catch(a){}},errorListener:function(a){this.setTestcard(4)},toAttributeString:function(b){var c="";for(var a in b){if(typeof b[a]!="function"){c+=a+'="'+b[a]+'" '}}return c},toFlashvarsString:function(b){var c="";for(var a in b){if(typeof b[a]!="function"){c+=a+"="+encodeURIComponent(b[a])+"&"}}return c.replace(/&$/,"")}};var playerObjectIMAGE=function(){};playerObjectIMAGE.prototype={maxLoops:7,createMediaElement:function(){var b=this;var a=$("#"+this.environment.publicName+"_media");a.attr("style","width: 100%; height:100%; background-color: #000; overflow: hidden;");a.html("");this.mediaElement=$(document.createElement("img")).appendTo(a).attr({id:this.environment.publicName+"_media_image",src:this.media.file});this.scaleImage();this.elementReady=true},scaleImage:function(){var c=this;if(this.maxLoops<1){return}this.maxLoops--;try{if(this.mediaElement==undefined){setTimeout(function(){c.scaleImage()},500);return}if(this.mediaElement.width()==0){setTimeout(function(){c.scaleImage()},500);return}}catch(b){setTimeout(function(){c.scaleImage()},500);return}var a=$("#"+this.environment.publicName+"_media");this.stretch(this.mediaElement,a.width(),a.height())},setPlay:function(){this._caller.elementUpdateListener("start");this._caller.elementUpdateListener("ended")}};var playerObjectNA=function(){};playerObjectNA.prototype={createMediaElement:function(){this.setTestcard(5,this.media.message);this.elementReady=true}};var playerObjectVIDEO=function(){};playerObjectVIDEO.prototype={createMediaElement:function(){var a=$("#"+this.environment.publicName+"_media");a.attr("style","width: 100%; height:100%; background-color: #000;");a.html("");this.mediaElement=$(document.createElement("video")).appendTo(a).attr({id:this.environment.publicName+"_media_html",src:this.media.file,controls:false,autoplay:false,autobuffer:false,loop:false}).css({width:"100%",height:"100%"});this.mediaElement=$("#"+this.environment.publicName+"_media_html");this.elementReady=true},addListeners:function(){this.mediaElement.attr("onpause","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.pauseListener(event)");this.mediaElement.attr("onplaying","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.playingListener(this)");this.mediaElement.attr("onplay","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.startListener(this)");this.mediaElement.attr("onvolumechange","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.volumeListener(this)");this.mediaElement.attr("onprogress","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.progressListener(event)");this.mediaElement.attr("ontimeupdate","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.timeListener(this)");this.mediaElement.attr("onended","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.endedListener(event)");this.mediaElement.attr("onwaiting","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.waitingListener(event)");this.mediaElement.attr("oncanplaythrough","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.canplayListener(event)");this.mediaElement.attr("oncanplay","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.canplayListener(event)");this.mediaElement.attr("onerror","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.errorListener(event)");this.mediaElement.attr("onsuspend","PROJEKKTOR["+this.environment.publicIndex+"].playerObject.suspendListener(event)")},removeListeners:function(){this.mediaElement.attr("onpause","");this.mediaElement.attr("onplaying","");this.mediaElement.attr("onplay","");this.mediaElement.attr("onvolumechange","");this.mediaElement.attr("onprogress","");this.mediaElement.attr("ontimeupdate","");this.mediaElement.attr("onended","");this.mediaElement.attr("onwaiting","");this.mediaElement.attr("oncanplay","");this.mediaElement.attr("oncanplaythrough","");this.mediaElement.attr("onerror","");this.mediaElement.attr("onsuspend","")},detachMedia:function(){try{$(this.mediaElement[0]).attr("src","");this.mediaElement[0].load()}catch(a){}},setPlay:function(){try{this.mediaElement[0].play()}catch(a){}},setPause:function(){try{this.mediaElement[0].pause()}catch(a){}},setVolume:function(a){this.mediaElement.attr("volume",a)},setSeek:function(a){this.mediaElement.attr("currentTime",a)}};var playerObject=function(){};playerObject.prototype={_caller:{},_hideTimer:null,_controlsFading:false,_nohide:false,_isPlaying:false,_hasEnded:false,isAutoslide:false,elementReady:false,mediaElement:null,environment:{publicIndex:0,publicName:null},media:{duration:0,position:0,startOffset:0,file:false,poster:"",ended:false,message:"",error:null},init:function(b){var a=this;this._caller=b.caller;$.extend(this.environment,b.caller.environment);this.media=b.video;this.createMediaElement();this.waitForPlayerElement()},createMediaElement:function(){},waitForPlayerElement:function(){var a=this;if(this.elementReady!==true){setTimeout(function(){a.waitForPlayerElement()},500);return}try{this.addListeners();this._caller.playerObjectReady()}catch(b){$C.log(b)}},addListeners:function(){},removeListeners:function(){},detachMedia:function(){},destroy:function(){this.setPause();this.removeListeners();this.detachMedia();$(this.mediaElement).remove()},reInit:function(){},applyCommand:function(b,a){switch(b){case"play":this.setPlay();break;case"pause":this.setPause();break;case"volume":this.setVolume(a);break;case"seek":this.setSeek(a);break;case"fullscreen":this.setFullscreen(a);break}},setPrev:function(){},setNext:function(){},setSeek:function(a){},setPlay:function(){},setPause:function(){},setVolume:function(a){},setFullscreen:function(a){this.environment.inFullscreen=a;this._caller.elementUpdateListener("fullscreen");this.reInit()},getVolume:function(){var a=this.mediaElement.attr("muted");return(a==true)?0:this.mediaElement.attr("volume")},getLoadProgress:function(){return this.media.loadProgress},getLoadPlaybackProgress:function(){return this.media.playProgress},getPosition:function(){return this.media.position},getDuration:function(){return this.media.duration},getInFullscreen:function(){return this.environment.inFullscreen},getIsAutoslide:function(){return this.isAutoslide},timeListener:function(d){if(d==undefined){return}var c=(d.position!=undefined)?d.position:d.currentTime;var b=d.duration;var a=(c>0&&b>0)?c*100/b:0;this._isPlaying=(b>0&&c>0)?true:false;this.media.duration=b;this.media.position=c;this.media.playProgress=a;this._caller.elementUpdateListener("time")},progressListener:function(d){if(d==undefined){return}if(d.loaded==undefined){return}var c=d.loaded;var b=d.total;var a=(c>0&&b>0)?c*100/b:0;this.media.loadProgress=(this.media.loadProgress<100)?a:100;this._caller.elementUpdateListener("progress")},canplayListener:function(a){this._caller.elementUpdateListener("canplay")},canplaythroughListener:function(a){this._caller.elementUpdateListener("canplaythrough")},suspendListener:function(a){this._caller.elementUpdateListener("suspend")},playingListener:function(a){this._caller.elementUpdateListener("play")},startListener:function(a){this._caller.elementUpdateListener("start")},pauseListener:function(a){this._caller.elementUpdateListener("pause")},volumeListener:function(a){this._caller.elementUpdateListener("volume")},endedListener:function(a){this._hasEnded=true;this._caller.elementUpdateListener("ended")},suspendListener:function(a){this.media.loadProgress=100;this._caller.elementUpdateListener("suspend")},waitingListener:function(a){this._caller.elementUpdateListener("waiting")},errorListener:function(a){switch(a.target.error.code){case a.target.error.MEDIA_ERR_ABORTED:this.setTestcard(1);break;case a.target.error.MEDIA_ERR_NETWORK:this.setTestcard(2);break;case a.target.error.MEDIA_ERR_DECODE:this.setTestcard(3);break;case a.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:this.setTestcard(4);break;default:this.setTestcard(5);break}},setTestcard:function(f,a){var e=this;var d={0:"An unknown error occurred. ",1:"You aborted the video playback. ",2:"A network error caused the video download to fail part-way. ",3:"The video playback was aborted due to a corruption problem. ",4:"The video could not be loaded, either because the server or network failed or because the format is not supported. ",5:"Sorry, your browser does not support the media format of the requested clip. ",99:"Hit NEXT to proceed. "};var c=(d[f]!=undefined)?d[f]:d[0];c=(a!=undefined&&a!="")?a:c;var b=$("#"+this.environment.publicName+"_media");if(this._caller.getItemCount()>1){c+=d[99]}this.destroy();b.attr("style","width: 100%; height:100%; background-color: #000;");b.html("");this.mediaElement=$(document.createElement("div")).attr({"class":"pptestcard"}).appendTo(b);$(document.createElement("p")).appendTo(this.mediaElement).html(c);this._caller.elementUpdateListener("testcard")},stretch:function(e,d,g){var b=d/e.width();var f=g/e.height();var a=e.width();var c=e.height();if(b>f){e.width(Math.round(a*b));e.height(Math.round(c*b))}else{e.width(Math.round(a*f));e.height(Math.round(c*f))}e.css({"margin-left":Math.round(d/2-e.width()/2)+"px","margin-top":Math.round(g/2-e.height()/2)+"px"})}};var PROJEKKTOR=[];$(document).ready(function(){PLOADER=new ploader().init()});var ploader=function(){};ploader.prototype={init:function(){var b=jQuery.extend({},document.getElementsByTagName("video"));for(var a=0;a<b.length;a++){PROJEKKTOR[a]=new projekktor();PROJEKKTOR[a].initialize(b[a],a)}}};function projekktor(){this.config={version:"0.6.1",cssClassPrefix:"pp",autoplay:false,controls:false,volume:0.5,poster:false,loop:false,playheadDomId:"playhead",timeleftDomId:"tleft",loadedDomId:"loaded",scrubberDomId:"scrubber",playDomId:"play",pauseDomId:"pause",prevDomId:"prev",nextDomId:"next",fsexitDomId:"fsexit",fsenterDomId:"fsenter",vsliderDomId:"vslider",vknobDomId:"vknob",muteDomId:"mute",vmaxDomId:"vmax",bufferingDomId:"buffering",startDomId:"start",controlsDomId:"controls",titleDomId:"title"};this.environment={publicIndex:0,publicName:null,playerStyle:null,scrollTop:null,scrollLeft:null,bodyOverflow:null,inFullscreen:false,playerDOM:{}};this.properties={itemsOffset:false,itemsLimit:10,itemsTotal:false,currentItem:0,playerType:null};this.priorities={video:10,flash:1,image:10};this.fileTypes={".ogv":{type:"video/ogg",model:"video"},".ogg":{type:"video/ogg",model:"video"},".anx":{type:"video/ogg",model:"video"},".jpg":{type:"image/jpeg",model:"image"},".gif":{type:"image/gif",model:"image"},".png":{type:"image/png",model:"image"},".flv":{type:"video/x-flv",model:"flash"},".flv":{type:"video/flv",model:"flash"},".mp4":{type:"video/mp4",model:"flash"}};this.media=[];this.plugins=[];this.mediaGrid={};this.playerObject=null;this._caller={};this._bufferDelayTimer=null;this._controlHideTimer=null;this._controlsFading=false;this._noControlHide=false;this._volumeSliderActive=false;this._isReady=false;this._isStarted=false;this._isPaused=false;this._isWaiting=false;this._isAutoslide=false;this._hasPlaylist=false;this.initialize=function(destDOM,myIndex){var ref=this;var sources=this._getSourcesFromContainer($(destDOM));this.config.autoplay=($(destDOM).attr("autoplay")!==undefined&&$(destDOM).attr("autoplay")!==false);this.config.controls=($(destDOM).attr("controls")!==undefined&&$(destDOM).attr("controls")!==false);this.config.loop=($(destDOM).attr("loop")!==undefined&&$(destDOM).attr("loop")!==false);this.config.poster=($(destDOM).attr("poster")!==undefined&&$(destDOM).attr("poster")!==false)?$(destDOM).attr("poster"):false;this.environment.publicName=this._randomId(8);this.environment.publicIndex=myIndex;this.environment.playerDom=this.drawPlayer(destDOM);this.mediaGrid=this._testMediaSupport();for(var i in sources){if(sources[i].type=="text/json"){$.get(sources[i].src,{},function(json){ref.reelUpdate(json)});return}}this.reelUpdate({0:{file:sources}})};this.reelUpdate=function(data){if(typeof data=="string"){try{data=$.parseJSON(data)}catch(e){data=[{src:"none",type:"NA",message:"Invalid Server Data"}]}}try{for(var props in data.config){this.config["dynamic_"+props]=data.config[props]}delete (data.config)}catch(e){}var itemCount=0;var posters=0;if(this.config.poster!=false&&this.config.autoplay!=true){this.media[itemCount]={file:this.config.poster};itemCount++;posters=1}for(var items in data){this.media[itemCount]=data[items];itemCount++}this._hasPlaylist=((this.media.length-posters)>1);if(!this._hasPlaylist){$("#"+this.environment.publicName+"_"+this.config.prevDomId).hide();$("#"+this.environment.publicName+"_"+this.config.nextDomId).hide()}else{$("#"+this.environment.publicName+"_"+this.config.prevDomId).show();$("#"+this.environment.publicName+"_"+this.config.nextDomId).show()}this.playItem(this.properties.currentItem)};this.playItem=function(idx){var mediaFile="";var mediaModel="playerObjectNA";var ref=this;var extension="";var lastLevel=0;this._isReady=false;if(typeof this.media[idx].file=="string"){this.media[idx].file=[{src:this.media[idx].file}]}var sourceObj={};for(var index in this.media[idx].file){sourceObj=this.media[idx].file[index];if(typeof sourceObj=="string"){sourceObj={src:sourceObj}}if(sourceObj.type==undefined){extension=sourceObj.src.substr(0,((sourceObj.src.indexOf("?")!=-1)?sourceObj.src.indexOf("?"):sourceObj.src.length));extension=extension.substr(extension.lastIndexOf("."),4).toLowerCase();sourceObj.type=(this.fileTypes[extension]==undefined)?"NA":this.fileTypes[extension]["type"];sourceObj.ext=extension}else{for(var extensions in this.fileTypes){if(this.fileTypes[extensions]["type"]!=sourceObj.type){continue}sourceObj.ext=extensions}}try{if(lastLevel<this.priorities[this.fileTypes[sourceObj.ext]["model"]]&&this.mediaGrid[this.fileTypes[sourceObj.ext]["type"]]!="NA"){lastLevel=this.priorities[this.fileTypes[sourceObj.ext]["model"]];mediaModel="playerObject"+(this.mediaGrid[this.fileTypes[sourceObj.ext]["type"]].toUpperCase());mediaFile=sourceObj.src}}catch(e){}}if(typeof eval(mediaModel)!=="function"){mediaModel="playerObjectNA"}this.playerObject=new playerObject();this.playerObject=$.extend(this.playerObject,eval(mediaModel).prototype);if(sourceObj.title!=undefined){this.media[idx].title=sourceObj.title}this.media[idx].file=mediaFile;this.properties.currentItem=idx;this.drawTitle(this.media[idx].title);this.playerObject.init({video:this.media[idx],caller:ref});this._bubbleEvent("setitem",this.playerObject,this.media[idx])};this.playerObjectReady=function(){var ref=this;this._isReady=true;this._isAutoslide=this.playerObject.getIsAutoslide();this.addGUIListeners();if(this.environment.inFullscreen==true){this.drawExitFullscreenButton()}else{this.drawEnterFullscreenButton()}this.drawUpdateVolumeDisplay();if(this.config.autoplay==true||this._isStarted==true){this.showBufferIcon();this.playerObject.applyCommand("play")}else{this.hideControlbar(true);this.showStartIcon()}if(this._isAutoslide==true){this.hideControlbar(true)}};this.setControlsAutohide=function(){if(this.config.controls==false){this.hideControlbar(true)}else{var ref=this;this.showControlbar();clearTimeout(this._controlHideTimer);this._controlHideTimer=setTimeout(function(){ref.hideControlbar()},3500)}};this.addGUIListeners=function(){var ref=this;$("#"+this.environment.publicName+"_media").mousemove(function(event){ref.playerMouseMoveListener(event)});$("#"+this.environment.publicName+"_"+this.config.controlsDomId).mouseenter(function(event){ref.controlsMouseEnterListener(event)});$("#"+this.environment.publicName+"_"+this.config.controlsDomId).mouseleave(function(event){ref.controlsMouseLeaveListener(event)});$("#"+this.environment.publicName+"_"+this.config.controlsDomId).click(function(event){ref.controlsClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.playDomId).click(function(event){ref.playClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.pauseDomId).click(function(event){ref.pauseClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.vmaxDomId).click(function(event){ref.unmuteClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.muteDomId).click(function(event){ref.muteClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.vknobDomId).mousedown(function(event){ref.vknobStartDragListener(event,this)});$("#"+this.environment.publicName+"_"+this.config.scrubberDomId).click(function(event){ref.scrubberClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.fsexitDomId).click(function(event){ref.exitFullscreenClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.fsenterDomId).click(function(event){ref.enterFullscreenClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.prevDomId).click(function(event){ref.prevClickListener(event)});$("#"+this.environment.publicName+"_"+this.config.nextDomId).click(function(event){ref.nextClickListener(event)});$("#"+this.environment.publicName).click(function(event){ref.displayClickListener(event)});$("#"+this.environment.publicName).dblclick(function(event){ref.displayDblClickListener(event)})};this.removeGUIListeners=function(){$("#"+this.environment.publicName).unbind();$("#"+this.environment.publicName+"_media").unbind();for(var configItem in this.config){if(configItem.indexOf("DomId")==-1){continue}$("#"+this.environment.publicName+"_"+this.config[configItem]).unbind()}};this.registerPlugin=function(pluginObj){this.plugins.push(pluginObj)};this.unbindPlugins=function(){for(var j=0;j<this.plugins.length;j++){$(this.plugins[j]).unbind()}};this._bubbleEvent=function(eventType,obj,data){if(this.plugins.length==0){return}$(this.plugins).trigger(eventType,[obj,data])};this.playPreviousItem=function(obj,data){if(this._isReady==false){return}this.detachPlayerObject();var result=this.properties.currentItem-1;if(this.media[result]===undefined){result=this.media.length-1}this.playItem(result)};this.playNextItem=function(obj,data){if(this._isReady==false){return}this.detachPlayerObject();var result=this.properties.currentItem+1;if(this.media[result]===undefined){result=0;if(this.config.loop===false){this._isStarted=false}}this.playItem(result)};this.elementUpdateListener=function(type){switch(type){case"pause":this.drawPlayButton();break;case"start":case"play":this._isStarted=true;this.hideStartIcon();this.setControlsAutohide();this.hideBufferIcon();this.playerObject.applyCommand("volume",this.config.volume);this.drawPauseButton();break;case"testcard":this._isWaiting=false;this.hideBufferIcon();break;case"volume":this.config.volume=this.playerObject.getVolume();this.drawUpdateVolumeDisplay();break;case"suspend":case"progress":this.drawUpdateProgressDisplay();break;case"time":this.drawUpdateTimeDisplay();break;case"fullscreen":this.environment.inFullscreen=this.playerObject.getInFullscreen();this.drawFullscreen();break;case"ended":this.playNextItem();this.hideBufferIcon();break;case"waiting":this._isWaiting=true;this.showBufferIcon();break;case"canplay":this._isWaiting=false;this.hideBufferIcon();break}};this.detachPlayerObject=function(){$(this).unbind();this.unbindPlugins();this._noControlHide=false;this.playerObject.destroy();this.removeGUIListeners();this.playerObject=null;this.drawUpdateProgressDisplay();this.drawUpdateTimeDisplay()};this.displayClickListener=function(evt){var ref=this;if(!this._isStarted){this.playerObject.applyCommand("play",false)}evt.stopPropagation()};this.displayDblClickListener=function(evt){var ref=this;if(!this._isStarted){return}else{if(this.environment.inFullscreen){this.playerObject.applyCommand("fullscreen",false)}else{this.playerObject.applyCommand("fullscreen",true)}}evt.stopPropagation()};this.playClickListener=function(evt){this.playerObject.applyCommand("play",0);evt.stopPropagation()};this.pauseClickListener=function(evt){this.playerObject.applyCommand("pause",0);evt.stopPropagation()};this.controlsMouseEnterListener=function(evt){this._noControlHide=true};this.controlsMouseLeaveListener=function(evt){this._noControlHide=false};this.controlsClickListener=function(evt){evt.stopPropagation()};this.playerMouseMoveListener=function(evt){this.showControlbar()};this.prevClickListener=function(evt){this.playPreviousItem();evt.stopPropagation()};this.nextClickListener=function(evt){this.playNextItem();evt.stopPropagation()};this.muteClickListener=function(evt){this.playerObject.applyCommand("volume",0);evt.stopPropagation()};this.unmuteClickListener=function(evt){this.playerObject.applyCommand("volume",1);evt.stopPropagation()};this.enterFullscreenClickListener=function(evt){this.playerObject.applyCommand("fullscreen",true);evt.stopPropagation()};this.exitFullscreenClickListener=function(evt){this.playerObject.applyCommand("fullscreen",false);evt.stopPropagation()};this.startClickListener=function(evt){this.playerObject.applyCommand("play",false);evt.stopPropagation()};this.scrubberClickListener=function(evt){var result=0;if(evt==undefined){return}var totalWidth=$("#"+this.environment.publicName+"_"+this.config.scrubberDomId).width();var loadedWidth=$("#"+this.environment.publicName+"_"+this.config.loadedDomId).width();var requested=evt.pageX-$("#"+this.environment.publicName+"_"+this.config.scrubberDomId).offset().left;if(requested<0||requested=="NaN"||requested==undefined){result=0}else{if(loadedWidth!=undefined){if(requested>loadedWidth){requested=loadedWidth-1}result=Math.ceil((requested*100/totalWidth)*this.playerObject.getDuration()/100)*1}}this.playerObject.applyCommand("seek",result);evt.stopPropagation()};this.vknobStartDragListener=function(e,domObj){var ref=this;var knob=$(domObj);var dx=Math.abs(parseInt(knob.css("left"))-e.clientX);this._volumeSliderActive=true;if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}$("#"+this.environment.publicName+"_"+this.config.vsliderDomId).mouseup(function(event){$("#"+ref.environment.publicName+"_"+ref.config.vsliderDomId).unbind("mousemove");$("#"+ref.environment.publicName+"_"+ref.config.vsliderDomId).unbind("mouseup");ref._volumeSliderActive=false;return false});$("#"+this.environment.publicName+"_"+this.config.vsliderDomId).mousemove(function(dragevent){clearTimeout(ref._controlHideTimer);var newXPos=(dragevent.clientX-dx);newXPos=(newXPos>$(this).width()-knob.width())?$(this).width()-(knob.width()/2):newXPos;newXPos=(newXPos<0)?0:newXPos;knob.css("left",newXPos+"px");ref.playerObject.applyCommand("volume",Math.abs(newXPos/($(this).width()-(knob.width()/2))));if(dragevent.stopPropagation){dragevent.stopPropagation()}else{dragevent.cancelBubble=true}return false})},this.hideControlbar=function(instant){clearTimeout(this._controlHideTimer);if(this._noControlHide==true&&this.config.controls==true){return}var target=$("#"+this.environment.publicName+"_"+this.config.controlsDomId);if(!target.is(":visible")){return}target.stop(true,true);if(this.config.controls==false){target.hide()}else{if(instant==true){target.hide()}else{target.fadeOut("slow")}}};this.showControlbar=function(){var ref=this;clearTimeout(this._controlHideTimer);if(this.config.controls==false||this._isStarted==false||this._isAutoslide==true){return}var target=$("#"+this.environment.publicName+"_"+this.config.controlsDomId);if(target.is(":visible")||this._controlsFading==true){ref._controlHideTimer=setTimeout(function(){ref.hideControlbar()},2500);return}this._controlsFading=true;target.stop(true,true);target.fadeIn("fast",function(){ref.drawUpdateVolumeDisplay();ref._controlsFading=false})};this.hideBufferIcon=function(){var ref=this;if(this._isStarted!=true&&this._isWaiting!=true){return}clearTimeout(this._bufferDelayTimer);var target=$("#"+this.environment.publicName+"_"+this.config.bufferingDomId);target.stop(true,true);target.fadeOut("fast")};this.showBufferIcon=function(delay){var ref=this;clearTimeout(this._bufferDelayTimer);if(this._isWaiting==false){return}if(delay!=true){ref._bufferDelayTimer=setTimeout(function(){ref.showBufferIcon(true)},1500);return}var target=$("#"+this.environment.publicName+"_"+this.config.bufferingDomId);target.stop(true,true);target.fadeIn("fast")};this.hideStartIcon=function(){var target=$("#"+this.environment.publicName+"_"+this.config.startDomId);target.hide()};this.showStartIcon=function(delay){if(this._isStarted==true){return}var target=$("#"+this.environment.publicName+"_"+this.config.startDomId);target.show()};this.drawUpdateTimeDisplay=function(){try{var percent=this.playerObject.getLoadPlaybackProgress();var duration=this.playerObject.getDuration();var position=this.playerObject.getPosition()}catch(e){var percent=0;var duration=0;var position=0}try{$("#"+this.environment.publicName+"_"+this.config.playheadDomId).css("width",percent+"%");$("#"+this.environment.publicName+"_"+this.config.timeleftDomId).html(this._clockDigits(position)+" / "+this._clockDigits(duration))}catch(e){}};this.drawUpdateProgressDisplay=function(){try{var percent=this.playerObject.getLoadProgress()}catch(e){var percent=0}try{$("#"+this.environment.publicName+"_"+this.config.loadedDomId).css("width",percent+"%")}catch(e){}};this.drawUpdateVolumeDisplay=function(){if(this._volumeSliderActive==true){return}var knob=$("#"+this.environment.publicName+"_"+this.config.vknobDomId);var slider=$("#"+this.environment.publicName+"_"+this.config.vsliderDomId);switch(this.config.volume){case 0:$("#"+this.environment.publicName+"_"+this.config.vknobDomId).css("left",0);break;case 1:$("#"+this.environment.publicName+"_"+this.config.vknobDomId).css("left",(slider.width()-(knob.width()/2)));break;default:$("#"+this.environment.publicName+"_"+this.config.vknobDomId).css("left",this.config.volume*(slider.width()-(knob.width()/2)));break}};this.drawTitle=function(title){$("#"+this.environment.publicName+"_title").html(title)};this.drawPauseButton=function(event){$("#"+this.environment.publicName+"_"+this.config.pauseDomId).css("display","block");$("#"+this.environment.publicName+"_"+this.config.playDomId).css("display","none")};this.drawPlayButton=function(event){$("#"+this.environment.publicName+"_"+this.config.pauseDomId).css("display","none");$("#"+this.environment.publicName+"_"+this.config.playDomId).css("display","block")};this.drawEnterFullscreenButton=function(event){$("#"+this.environment.publicName+"_"+this.config.fsexitDomId).css("display","none");$("#"+this.environment.publicName+"_"+this.config.fsenterDomId).css("display","block")};this.drawExitFullscreenButton=function(event){$("#"+this.environment.publicName+"_"+this.config.fsenterDomId).css("display","none");$("#"+this.environment.publicName+"_"+this.config.fsexitDomId).css("display","block")};this.drawPlayer=function(destDOM){var result=$(document.createElement("div")).attr({id:this.environment.publicName,style:$(destDOM).attr("style"),"class":"projekktor"}).css("overflow","hidden").css("width",$(destDOM).attr("width")+"px").css("height",$(destDOM).attr("height")+"px");$(destDOM).replaceWith(result);var daPlayer=$(document.createElement("div")).appendTo(result).attr({id:this.environment.publicName+"_media",style:"width:100%; height:100%;"});try{$("#projekktorver").html("V"+this.config.version)}catch(e){}$(document.createElement("div")).appendTo(result).attr({id:this.environment.publicName+"_"+this.config.bufferingDomId,"class":this.config.cssClassPrefix+"buffering"});$(document.createElement("div")).appendTo(result).attr({id:this.environment.publicName+"_"+this.config.startDomId,"class":this.config.cssClassPrefix+"start"});var controls=$(document.createElement("div")).appendTo(result).attr({id:this.environment.publicName+"_"+this.config.controlsDomId,"class":this.config.cssClassPrefix+"controls"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.fsexitDomId,"class":this.config.cssClassPrefix+"fsexit"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.fsenterDomId,"class":this.config.cssClassPrefix+"fsenter"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.playDomId,"class":this.config.cssClassPrefix+"play"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.pauseDomId,"class":this.config.cssClassPrefix+"pause"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.prevDomId,"class":this.config.cssClassPrefix+"prev"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.nextDomId,"class":this.config.cssClassPrefix+"next"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.titleDomId,"class":this.config.cssClassPrefix+"title"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.timeleftDomId,"class":this.config.cssClassPrefix+"tleft"});var scrubber=$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.scrubberDomId,"class":this.config.cssClassPrefix+"scrubber"});$(document.createElement("div")).appendTo(scrubber).attr({id:this.environment.publicName+"_"+this.config.playheadDomId,"class":this.config.cssClassPrefix+"playhead"});$(document.createElement("div")).appendTo(scrubber).attr({id:this.environment.publicName+"_"+this.config.loadedDomId,"class":this.config.cssClassPrefix+"loaded"});var volumeControl=$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.vsliderDomId,"class":this.config.cssClassPrefix+"vslider"});$(document.createElement("div")).appendTo(volumeControl).attr({id:this.environment.publicName+"_"+this.config.vknobDomId,"class":this.config.cssClassPrefix+"vknob"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.muteDomId,"class":this.config.cssClassPrefix+"mute"});$(document.createElement("div")).appendTo(controls).attr({id:this.environment.publicName+"_"+this.config.vmaxDomId,"class":this.config.cssClassPrefix+"vmax"});controls.hide();$(document.createElement("div")).insertAfter(this.environment.playerDOM).attr({id:this.environment.publicName+"_canvas","class":this.config.cssClassPrefix+"canvas"});return result};this.drawFullscreen=function(){var playerDom=$("#"+this.environment.publicName);if(this.environment.inFullscreen==true){this.environment.playerStyle=playerDom.attr("style");this.environment.bodyOverflow=$("body").css("overflow");this.environment.scrollTop=$(window).scrollTop();this.environment.scrollLeft=$(window).scrollLeft();$(window).scrollTop(0);$(window).scrollLeft(0);$("body").css("overflow","hidden");playerDom.attr("style","position: absolute; top:0; left:0; width:100%; height:100%; z-index:9000;");this.drawExitFullscreenButton()}else{$(window).scrollTop(this.environment.scrollTop);$(window).scrollLeft(this.environment.scrollLef);$("body").css("overflow",this.environment.bodyOverflow);playerDom.attr("style",this.environment.playerStyle);this.drawEnterFullscreenButton()}};this.setPluginCanvas=function(target){var x=this.environment.playerDOM.offset().left;var y=this.environment.playerDOM.offset().top;var width=this.environment.playerDOM.width();var height=this.environment.playerDOM.height();var canvas=$("#"+this.environment.publicName+"_canvas");$("#"+this.environment.publicName+"_canvas").css({overflow:"hidden",position:"absolute",top:y,left:x,border:"1px solid red",width:width+"px",height:height+"px"})};this.getItemCount=function(){return(this._hasPlaylist)?this.media.length:1};this._clockDigits=function(num){if(num<0||isNaN(num)||num==undefined){return"00:00"}var min=Math.floor(num/60);var sec=Math.floor(num%60);return((min<10)?"0"+min:min)+":"+((sec<10)?"0"+sec:sec)};this._testMediaSupport=function(){var result=[];var hasNativeAudio=false;var flashVerison=this._flashVersion().match(/\d+/g);var hasFlash=(flashVerison[0]>0);var nativeElementType="";for(i in this.fileTypes){result[this.fileTypes[i]["type"]]="NA";if(this.fileTypes[i]["model"]=="image"){result[this.fileTypes[i]["type"]]="image";continue}if(hasFlash==true&&this.fileTypes[i]["model"]=="flash"){result[this.fileTypes[i]["type"]]=this.fileTypes[i]["model"]}if((this.fileTypes[i]["type"].indexOf("video")>-1||this.fileTypes[i]["type"].indexOf("audio")>-1)){try{if(this.fileTypes[i]["type"].indexOf("video")>-1){nativeElementType="video"}var nativeElementType=(this.fileTypes[i]["type"].indexOf("video")>-1)?"video":"audio";var testObject=document.createElement(nativeElementType);if(testObject.canPlayType!=false){if(("no"!=testObject.canPlayType(this.fileTypes[i]["type"]))&&(""!=testObject.canPlayType(this.fileTypes[i]["type"]))){result[this.fileTypes[i]["type"]]=nativeElementType}}}catch(e){}}}return result};this._getSourcesFromContainer=function(target){if(target==undefined){return""}var result={};var i=0;var poster=false;var title="";if(target.attr("poster")){poster=target.attr("poster")}if(target.attr("title")){title=target.attr("title")}if(target.attr("src")){result[i]={src:target.attr("src"),type:target.attr("type"),poster:poster,title:title};i++}$(target).children().each(function(){if($(this).attr("src")){result[i]={src:$(this).attr("src"),type:$(this).attr("type"),poster:poster,title:title};i++}});return result};this._randomId=function(length){var chars="abcdefghiklmnopqrstuvwxyz";var result="";for(var i=0;i<length;i++){var rnum=Math.floor(Math.random()*chars.length);result+=chars.substring(rnum,rnum+1)}return result};this._flashVersion=function(){try{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{axo.AllowScriptAccess="always"}catch(e){return"6,0,0"}}catch(e){}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(e){}}return"0,0,0"}}var $C={debug:true,quietDismiss:false,method:"log",_hasConsole:function(a){var a=a||"log";return typeof(console)=="object"&&typeof(console[a])!="undefined"},_consoleMethod:function(){if(!this.debug){return false}if(this._hasConsole(this.method)){try{console[this.method].apply(this,arguments)}catch(d){for(var c=0,b=arguments.length;c<b;c++){console[this.method](arguments[c])}}}else{if(!this.quietDismiss&&arguments.length){var a="";for(var c=0,b=arguments.length;c<b;c++){a+=arguments[c]+" ("+typeof arguments[c]+") "}alert(a)}}},log:function(){this.method="log";this._consoleMethod.apply(this,arguments)},info:function(){this.method="info";this._consoleMethod.apply(this,arguments)},clear:function(){this.method="clear";this._consoleMethod.apply(this)},count:function(){this.method="count";this._consoleMethod.apply(this,arguments)},debug:function(){this.method="debug";this._consoleMethod.apply(this)}};var channelLogo=function(){};channelLogo.prototype={initialize:function(){ref=this;$(ref).bind("setitem",function(b,c,a){ref.setitemListener(c,a)})},setitemListener:function(b,a){}};
