var JPlayer=null;if(!window.console){console={log:function(){}}}var Player=new Class({options:null,soundManager:null,currentSound:null,currentVolume:100,currentInterface:null,currentUrl:null,id3BaseUrl:null,imagePrevUrl:null,funcOpenPopup:null,funcClosePopup:null,funcRefreshContent:null,ratingSubmitted:false,trackListing:null,trackPos:0,trackOrder:[],trackListingMode:false,defaultImage:false,scroller:null,videoPlayerShown:false,videoPlaying:false,videoPlayerRoot:false,videoPlayOnLoad:false,videoStreamPort:81,videoLastVol:0,videoCommandDelay:0,ready:false,initialize:function(A){this.options=A;this.soundManager=A.soundManager;this.soundManager.onload=this.managerLoaded.bind(this);this.soundManager.onerror=this.managerError.bind(this);this.prepareExtControls();if(window.ie6){this.applyPngFix()}this.ready=true},applyPngFix:function(){var A=$ES("#player *");A.each(function(E){var D=E.currentStyle.backgroundImage;if(D!="none"){var B=D.match(/\(.*\)/);var C=B[0];C=C.replace(/(\(|\)|\'|\")/g,"");if(C.substring(C.length-4)==".png"){E.setStyle("background-image","url("+C.substring(0,C.length-4)+".gif)")}}})},managerLoaded:function(){var A=false;if(this.options.autoLoadUrl){var C=this.options.autoLoadUrl.split(".");var B=C[C.length-1];if(B!="mp3"){A=true}}if(this.options.videoPlayerElement){this.setVideoPlayerElement(this.options.videoPlayerElement,this.options.bodyElement)}if(this.options.interfaceElement){this.setInterfaceElement(this.options.interfaceElement,this.options.bodyElement,A)}if(this.options.id3BaseUrl){this.id3BaseUrl=this.options.id3BaseUrl}if(this.options.imagePrevUrl){this.imagePrevUrl=this.options.imagePrevUrl}if(this.options.submitBaseUrl){this.submitBaseUrl=this.options.submitBaseUrl}if(this.options.errorDiv){this.currentInterface.error=this.options.errorDiv}if(this.options.autoLoadUrl){var C=this.options.autoLoadUrl.split(".");var B=C[C.length-1];if(B=="mp4"){(function(){this.playVideoUrl(this.options.autoLoadUrl,this.options.startFrames,false,this.options.autoPlay)}).delay(600,this)}else{this.playUrl(this.options.autoLoadUrl,this.options.startFrames,false,this.options.autoPlay)}}if(this.options.funcOpenPopup){this.funcOpenPopup=this.options.funcOpenPopup}if(this.options.funcClosePopup){this.funcClosePopup=this.options.funcClosePopup}if(this.options.funcRefreshContent){this.funcRefreshContent=this.options.funcRefreshContent}if(this.options.defaultImage){this.defaultImage=this.options.defaultImage}if(this.options.trackListing){this.trackListing=this.options.trackListing;this.trackPos=0;this.tracskOrder=[]}},showVideoPlayer:function(){if(!JPlayer){return }console.log(JPlayer);this.videoPlayerShown=true;if(this.currentSound){this.currentSound.stop()}var A=new Element(JPlayer.parentNode);new Fx.Style(this.currentInterface.scroller.marqueeEl,"opacity").start(0);if(this.trackListing){console.log("Force generating video tracklist.");this.makeTracklist.delay(600,this)}new Fx.Style(this.currentInterface.root,"opacity").start(0).chain(function(){JPlayer.width=352;JPlayer.height=288;JPlayer.style.width=352;JPlayer.style.height=288;$("vplyr").style.width=352;$("vplyr").style.height=288;new Fx.Style(this.videoPlayerRoot,"opacity").start(1);if(this.currentInterface.scroller){this.currentInterface.scroller.pauseMarquee()}}.bind(this))},hideVideoPlayer:function(){this.videoPlayerShown=false;if(this.sendVEvent){this.sendVEvent("STOP")}new Fx.Style(this.videoPlayerRoot,"opacity").start(0).chain(function(){JPlayer.width=1;JPlayer.height=1;JPlayer.style.width=1;JPlayer.style.height=1;new Fx.Style(this.videoPlayerRoot,"opacity").start(0.1);this.videoPlayerRoot.setStyle("display","block");this.setVolbarPosition(this.currentVolume/100,true);this.currentInterface.root.setStyle("display","block");new Fx.Style(this.currentInterface.scroller.marqueeEl,"opacity").start(1);new Fx.Style(this.currentInterface.root,"opacity").start(1);if(this.currentInterface.scroller){this.currentInterface.scroller.unpauseMarquee()}}.bind(this))},skipVideoTrack:function(B,A){if(!this.videoPlayerShown){this.showVideoPlayer()}this.sendVEvent("ITEM",B);if(A){this.sendVEvent("PLAY",true)}else{this.sendVEvent("PLAY",false)}},sendVEvent:function(C,A,B){if(B){this.videoCommandDelay=0}console.log("Sending video event "+C+"=> ",A);if(this.videoCommandDelay){console.log("Video command delay specified, delaying by %d",this.videoCommandDelay);this.sendVEvent.delay(this.videoCommandDelay,this,[C,A,true]);return }if(C=="VOLUME"&&A==this.videoLastVol){console.log("Skipping, no change")}if(!JPlayer.sendEvent){console.log("Delayed - no send event method available.",JPlayer.sendEvent);this.sendVEvent.delay(2000,this,[C,A])}else{console.log("Event %s sent.",C);if(C=="VOLUME"){this.videoLastVol=A}JPlayer.sendEvent(C,A)}},playVideoUrl:function(A,J,M,I,G,H){console.log("Playing video url %s, start: %d, autoplay: %b.",A,J,I);if(!this.videoPlayerShown){this.showVideoPlayer()}this.currentUrl=A;var C=this.urlToId(A);var E=A.split("/");if(!H){H=0}if(!JPlayer.sendEvent){H++;if(H==5){$clear(this.vUrlD)}else{this.vUrlD=this.playVideoUrl.delay(2000,this,[A,J,M,I,G,H])}return }else{$clear(this.vUrlD);this.sendVEvent("VOLUME",parseInt(this.currentVolume));var D=A;var B=A.split("-");var F=B[B.length-1].split(".");var L=this.imagePrevUrl+E[E.length-3]+"/podcasts/"+F[0]+"-large.png";if(this.videoStreamPort){console.log("Stream port set to ",this.videoStreamPort);var E=A.replace("http://","").split("/");A="http://"+E[0]+":"+this.videoStreamPort+"/"+E[3]+"/"+F[0]+".mp4";console.log("Streaming url: ",A)}var K=D.split("/");console.log(K);new Ajax("/download/register_play/"+K[6]+"/"+K[7],{method:"get"}).request();this.sendVEvent("LOAD",{type:"video",file:A,image:L});if(I){this.sendVEvent("PLAY",true)}}},loadComments:function(C){if(!this.options.commentsDiv){this.options.commentsDiv=$("comments")}if(this.options.commentsBase&&this.options.commentsDiv){this.options.commentsDiv.setStyle("display","block");C=C.split("-")[1];var B=C.replace(/[^0-9]/g,"");this.options.commentsDiv.setHTML("");var A=new Json.Remote(this.options.commentsBase+B,{onComplete:function(D){this.prepareComments(D)}.bind(this),onFailure:function(){this._addCommentLink()}.bind(this)}).send()}},_addCommentLink:function(){if(this.options.commentsBase&&this.options.commentsDiv){var A=new Element("a",{"class":"add-comment",href:"#"+this.options.commentsDiv.id});A.setHTML("Add Comment");A.addEvent("click",function(B){this.addComment(this.options.commentsDiv)}.bind(this));A.inject(this.options.commentsDiv)}},addComment:function(B){if(!this.options.addCommentDiv){this.options.addCommentDiv=$("commentsForm")}if(this.options.addCommentDiv){try{this.options.addCommentDiv.remove()}catch(A){}this.options.addCommentDiv.inject(B);this.options.addCommentDiv.setStyle("display","block");if(showCommentForm){showCommentForm()}}},prepareComments:function(C){if(C){var A=new Element("a",{"class":"comments",href:"#"});A.addEvent("click",function(D){new Event(D).stop();this.toggleComments()}.bind(this));this.commentsShown=false;this.currentComments=C;this.options.commentsDiv.empty();this._addCommentLink();var B=new Element("span");B.setHTML(" | ");B.inject(this.options.commentsDiv);A.setHTML("View Comments ("+C.num+")");A.inject(this.options.commentsDiv)}},toggleComments:function(B){var A=this.options.commentsDiv.getElement("a.comments");if(this.commentsShown){this.commentsShown=false;A.setHTML(A.innerHTML.replace("Hide","View"));this.options.commentsDiv.getElement("div.commentDetail").remove()}else{A.setHTML(A.innerHTML.replace("View","Hide"));this.commentsShown=true;var C=new Element("div",{"class":"commentDetail"});if(this.currentComments.comments){this.currentComments.comments.each(function(D){var H=new Element("div",{"class":"comment"});var F=new Element("div",{"class":"date"});F.setHTML(D.created.substring(8,10)+"/"+D.created.substring(5,7)+"/"+D.created.substring(0,4)+" "+D.created.substring(11,13)+":"+D.created.substring(14,16));var E=new Element("div",{"class":"from"});if(D.email){E.setHTML("<a href='mailto:"+D.email+"'>"+D.from+"</a><br />"+D.email)}else{E.setHTML(D.from)}var G=new Element("div",{"class":"c_message"});G.setHTML(D.message.replace("\n","<br />"));F.inject(H);E.inject(H);G.inject(H);H.inject(C)})}C.inject(this.options.commentsDiv)}},playUrl:function(A,H,I,G,F){if(this.videoPlayerShown){this.hideVideoPlayer()}this.currentUrl=A;var D=A.split("/");var B=this.urlToId(A);this.currentId3Url=D[D.length-2]+"/"+D[D.length-1];var C=this.soundManager.getSoundById(B);this.loadComments(D[D.length-1].split(".")[0]);if(!C){this.createSound(B,A)}else{this.currentSound=C}this.startCurrentSound(H,I,G?false:true);if(!F){this.trackListingMode=false;if(this.trackListing){for(var E=0;E<this.trackListing.length;E++){if(this.trackListing[E]==A){if(this.trackOrder[E]){this.trackPos=this.trackOrder[E]}break}}}}},managerError:function(){if(this.currentInterface){hideInterface()}if(this.options.errorDiv){$(this.options.errorDiv).setStyle("display","block");new Fx.Style($(this.options.errorDiv),"opacity").start(0,1)}},urlToId:function(A){var B=A.split("/");return"sound"+B[B.length-1].replace(/[^a-zA-Z0-9]/g,"")},stop:function(){this.soundManager.stopAll();this.setSeekBarHandlePosition(0);this.setPlayPauseButtonState(false)},pause:function(){if(this.currentSound){this.currentSound.resume();this._onPlayPauseClick()}},startCurrentSound:function(B,A,C){if(this.currentSound){this.ratingSubmitted=false;this.soundManager.stopAll();this.loadingDesc();if(!C){(function(){this.setVolbarPosition(this.currentVolume/100)}).delay(50,this);this.soundManager.play(this.currentSound.sID)}if(B){this.currentSound.setPosition(B)}if(!A){this.retreiveId3(this.currentUrl)}else{this.currentSound.id3=A;this._onId3()}if(!C){this.setPlayPauseButtonState(true)}}},currentStateToParams:function(){if(this.currentUrl&&this.currentSound){return"url="+this.currentId3Url.replace("/","___")+"/position="+this.currentSound.position}return"url=none"},submitRating:function(C){if(!this.submitBaseUrl){alert("Sorry, this podcast cannot be rated!");return }var D=this.currentId3Url.split("/");var B=D[D.length-1];var A=this.submitBaseUrl+B+"/"+C;new Ajax(A,{method:"get",onComplete:function(G){this.retreiveId3();var F=this.currentInterface.elements.messageEl;F.innerHTML=G;if(this.funcRefreshContent){this.funcRefreshContent()}var E=new Fx.Style(F,"opacity").start(1).chain(function(){E.start.delay(1000,this,0)})}.bind(this)}).request()},retreiveId3:function(A){if(this.id3BaseUrl&&this.currentId3Url){var B=new Json.Remote(this.id3BaseUrl+this.currentId3Url,{onComplete:function(C){this.currentSound.id3=C;this._onId3()}.bind(this),onFailure:function(C){this.currentSound.id3=null;this.resetDesc()}.bind(this)}).send()}},createSound:function(B,A){this.soundManager.createSound({autoPlay:false,id:B,url:A,onfinish:this._onSoundFinish.bind(this),onload:this._onSoundLoad.bind(this),whileloading:this._onSoundLoading.bind(this),whileplaying:this._onSoundPlaying.bind(this),onstop:this._onStop.bind(this),volume:this.currentVolume});this.currentSound=this.soundManager.getSoundById(B)},setVideoPlayer:function(A){console.log("External video player loaded: ",A);JPlayer=A.getParent().getElement("#"+A.id);console.log("Set to element: "+JPlayer)},videoCBVolume:function(A){console.log("Video callback, VOLUME ",A.percentage);this.setVolbarPosition(A.percentage/100,true)},videoCBNext:function(A){console.log("Received video callback, NEXT");this.changeTrack(1,true)},videoCBPrev:function(A){console.log("Received video callback, PREV");this.changeTrack(-1,true)},videoCBPlay:function(A){console.log("Received video callback, PLAY");this.videoPlaying=true},videoCBStop:function(A){console.log("Received video callback, STOP");this.videoPlaying=false},videoCBLoaded:function(A){},setVideoPlayerElement:function(B,A){var A=A?document.getElementById(A):document.body;if(!A){return }var C=document.getElementById(B);if(!C){return }this.ready=false;var D=new SWFObject("/data/swfs/player.swf","vplyr","1","1","9","#FFFFFF");D.addParam("allowfullscreen","true");D.addParam("allowscriptaccess","always");D.addParam("flashvars","controlbar=bottom&streamer=lighttpd&");this.videoPlayerRoot=C;C.innerHTML=D.getSWFHTML();JPlayer=C.getElementsByTagName("*")[0];console.log("Inserting video player element",JPlayer)},setInterfaceElement:function(C,B,F){var B=B?$(B):$E("body");if(!B){return }var D=B.getElement("#"+C);if(!D){return }var E=false;if(this.currentSound){if(!this.currentSound.paused){E=true;this.currentSound.pause()}this.setPlayPauseButtonState(false)}this.removeCurrentInterface();this.currentInterface={root:D,body:B,elements:this.loadInterfaceElements(D)};if(this.currentInterface.elements.descriptionEl&&Scroller){this.currentInterface.elements.descriptionEl.setStyle("white-space","nowrap");this.currentInterface.scroller=new Scroller(this.currentInterface.elements.descriptionEl,{step:1,delay:18});this.origWidth=this.currentInterface.elements.descriptionEl.getSize().size.x;setTimeout(this.updateMarqueeSize.bind(this),100)}this.currentInterface.events=this.addInterfaceEvents(this.currentInterface);this.currentInterface.slider=this.createInterfaceSliders(this.currentInterface);this.currentInterface.elements.messageEl.setOpacity(0);var A=Cookie.get("player_volume");if(A){this.setVolbarPosition(parseFloat(A))}else{this.setVolbarPosition(1)}if(this.currentSound){if(E){this.currentSound.resume();this.setPlayPauseButtonState(true)}}this.showInterface(F)},updateMarqueeSize:function(){this.currentInterface.scroller.offsetX=this.currentInterface.root.getElement(".position-status").getCoordinates().width},setTracklist:function(A){console.log("Track listing set: ",A);this.trackListing=A;this.trackPos=0;this.trackOrder=[]},makeTracklist:function(E){console.log("Making track list");this.trackOrder=[];for(var D=0;D<this.trackListing.length;D++){this.trackOrder[this.trackOrder.length]=D}if(E&&this.trackOrder.length>1){for(D=0;D<this.trackListing.length;D++){var B=Math.floor(Math.random()*this.trackListing.length);var A=Math.floor(Math.random()*this.trackListing.length);var C=this.trackOrder[B];this.trackOrder[B]=this.trackOrder[A];this.trackOrder[A]=C}}this._generateSMIL()},playTracklist:function(A){this.makeTracklist(A);if(this.trackOrder.length>0){this.trackPos=0;this.trackListingMode=A?2:1;this.playUrl(this.trackListing[this.trackOrder[0]],0,null,true,true)}},prepareExtControls:function(){var A=$E(".extControls");if(A){var E=A.getElement(".allNormal");if(E){E.addEvent("click",function(F){this.playTracklist();new Event(F).stop()}.bind(this))}var D=A.getElement(".allShuffle");if(D){D.addEvent("click",function(F){this.playTracklist(true);new Event(F).stop()}.bind(this))}var B=A.getElement(".nextTrack");if(B){B.addEvent("click",function(F){this.nextTrack();new Event(F).stop()}.bind(this))}var C=A.getElement(".prevTrack");if(C){C.addEvent("click",function(F){this.prevTrack();new Event(F).stop()}.bind(this))}}},showInterface:function(A){console.log("Showing interface, video = ",A);if(this.currentInterface.root){if(JPlayer){JPlayer.style.width=1;JPlayer.style.height=1;this.videoPlayerRoot.style.display="block";console.log("Send Event? ",JPlayer.sendEvent)}this.currentInterface.root.setOpacity(0);this.currentInterface.root.setStyle("visiblity","visible");if(A){(function(){this.showVideoPlayer()}).delay(500,this)}else{this.hideVideoPlayer();new Fx.Style(this.currentInterface.root,"opacity").start(1).chain(function(){if(this.currentInterface.scroller){this.currentInterface.scroller.start()}}.bind(this))}}},hideInterface:function(){if(this.currentInterface.root){this.hideVideoPlayer();new Fx.Style(this.currentInterface.root,"opacity").start(0).chain(function(){this.currentInterface.root.setStyle("visibility","hidden")}.bind(this))}},loadInterfaceElements:function(A){var C={};var B=["error","interface","title","position","status","description","play-pause","new-window","close-window","seekbar","seekbar-buffered","seekbar-handle","volbar-empty","volbar-full","score","message","current-score","score-width","image"];B.forEach(function(D){C[D.camelCase()+"El"]=A.getElement("."+D)});C.rootEl=A;return C},addInterfaceEvents:function(E){var C={root:{mousedown:this._onRootMouseDown},playPause:{click:this._onPlayPauseClick},newWindow:{click:this._onNewWindowClick},closeWindow:{click:this._onCloseWindowClick},volbarEmpty:{mousedown:this._onVolbarMouseDown,mouseup:this._onVolbarMouseUp},volbarFull:{mousedown:this._onVolbarMouseDown,mouseup:this._onVolbarMouseUp},score:{mousemove:this._onRatingMouseMove,mouseleave:this._onRatingMouseLeave,mousedown:this._onRatingMouseDown}};var B,A;for(var D in C){A=C[D];for(eventName in A){E.elements[D+"El"].addEvent(eventName,A[eventName].bindAsEventListener(this))}}return A},createInterfaceSliders:function(B){var A={seekbarSlider:new Slider(B.elements.seekbarEl,B.elements.seekbarHandleEl,{onComplete:this._onSeekbarSliderComplete.bind(this)})};A.draggedKnob=A.seekbarSlider.draggedKnob;A.seekbarSlider.draggedKnob=this._onSeekbarSliderDraggedKnob.bind(this);return A},removeCurrentInterface:function(){},updatePosition:function(){var A=this.positionToStr((this.currentSound.playState!=0)?this.currentSound.position:0);if(this.currentSound.loaded){A+="/"+this.positionToStr(this.currentSound.duration)}this.setPositionText(A);this.updateMarqueeSize()},positionToStr:function(A){var D=Math.floor(A/1000);var C=new String(Math.floor(D/60));var B=new String(D%60);if(B.length<2){B="0"+B}return C+":"+B},setPositionText:function(A){this.currentInterface.elements.positionEl.empty();this.currentInterface.elements.positionEl.appendChild(document.createTextNode(A))},setStatusText:function(A){this.currentInterface.elements.statusEl.empty();this.currentInterface.elements.statusEl.appendChild(document.createTextNode((A=="")?"":" "+A.toUpperCase()));this.updateMarqueeSize()},setSeekbarBufferPosition:function(A){A=Math.max(0,Math.min(1,A));this.currentInterface.elements.seekbarBufferedEl.setStyle("width",Math.floor(A*this.currentInterface.elements.seekbarEl.getCoordinates().width))},setSeekBarHandlePosition:function(A){A=Math.max(0,Math.min(1,A));this.currentInterface.slider.seekbarAutoSet=true;this.currentInterface.slider.seekbarSlider.set(A*this.currentInterface.slider.seekbarSlider.options.steps);this.currentInterface.slider.seekbarAutoSet=false;this.updatePosition()},setVolbarPosition:function(A,B){A=Math.max(0,Math.min(1,A));this.volbarPosition=A;this.currentInterface.elements.volbarFullEl.style.width=Math.floor(A*this.currentInterface.elements.volbarEmptyEl.getCoordinates().width)+"px";this.currentVolume=A*100;if(!B&&JPlayer&&this.sendVEvent){this.sendVEvent("VOLUME",parseInt(this.currentVolume))}if(this.currentSound){this.currentSound.setVolume(parseInt(this.currentVolume))}},setPlayPauseButtonState:function(A){this.currentInterface.elements.playPauseEl.removeClass(!A?"pause":"play");this.currentInterface.elements.playPauseEl.addClass(A?"pause":"play");this.setStatusText(A?"":"Paused")},setCurrentRating:function(B){var D=this.currentInterface.elements.currentScoreEl;var C=D.getCoordinates();if(!D.barSize||D.barSize!=size){var A=(B*(C.width/5)).toInt();D.getElement(".five").setStyle("width",A)}},_onId3:function(){var I="";if(this.currentSound.id3.TIT2){I=this.currentSound.id3.TIT2}else{I="Unknown Podcast"}var F="";if(this.currentSound.id3.TALB){I+="<br />"+this.currentSound.id3.TALB}if(this.currentSound.id3._SUM){F+=this.currentSound.id3._SUM+" - "}var A="";if(this.currentSound.id3.TYER){A+=this.currentSound.id3.TYER+" "}if(this.currentSound.id3.TPE1){A+=this.currentSound.id3.TPE1}if(A){F+="(c) "+A}var J=this.currentInterface.elements.imageEl.getSize();var E;if(this.currentSound.id3._IMG){E=this.currentSound.id3._IMG}else{E=this.defaultImage}if(this.currentSound.id3.DUR){}var C=new Element("img");var G=1;C.src=E;if(C.height>C.width){G=J.size.y/C.height}else{G=J.size.x/C.width}var B=G*C.width;var H=G*C.height;var D=this.currentInterface.elements.imageEl.getElement("img");new Fx.Style(D,"opacity").start(0).chain(function(){D.src=E;D.width=B.toInt();D.height=H.toInt();new Fx.Style(D,"opacity").start(1)}.bind(this));F+=" ... Powered By PrimaryPodcast.com";if(this.currentSound.id3.RATE){this.setCurrentRating(this.currentSound.id3.RATE)}if(this.currentInterface.elements.titleEl){this.currentInterface.elements.titleEl.innerHTML=I}if(this.currentInterface.elements.descriptionEl){this.currentInterface.elements.descriptionEl.innerHTML=F}var C=this.currentInterface.elements.descriptionEl.clone();size=(F.length*this.currentInterface.elements.descriptionEl.getStyle("font-size").toInt())/1.75;if(this.currentInterface.scroller){this.currentInterface.scroller.updateContentHTML(this.currentInterface.elements.descriptionEl.innerHTML,size)}},_onRootMouseDown:function(A){new Event(A).preventDefault()},_onPlayPauseClick:function(A){if(this.currentSound){if(this.currentSound.playState==0){(function(){this.setVolbarPosition(this.currentVolume/100)}).delay(50,this);this.currentSound.play()}else{if(this.currentSound.paused){this.currentSound.resume()}else{if(this.currentSound.pause){this.currentSound.pause()}}}this.setPlayPauseButtonState(!(this.currentSound.playState==0||this.currentSound.paused))}new Event(A).preventDefault()},_onNewWindowClick:function(A){if(this.funcOpenPopup){this.funcOpenPopup(this)}new Event(A).preventDefault()},_onCloseWindowClick:function(A){if(this.funcClosePopup){this.funcClosePopup(this)}new Event(A).preventDefault()},_onVolbarMouseDown:function(A){this.volbarMouseDown=true;this._onVolbarMouseMove(A);this._onVolbarMouseMoveBound=this._onVolbarMouseMove.bindAsEventListener(this);this._onVolbarMouseUpBound=this._onVolbarMouseUp.bindAsEventListener(this);this.currentInterface.body.addEvent("mousemove",this._onVolbarMouseMoveBound);this.currentInterface.body.addEvent("mouseup",this._onVolbarMouseUpBound)},_onVolbarMouseMove:function(B){if(this.volbarMouseDown){var A=this.currentInterface.elements.volbarEmptyEl.getCoordinates();this.setVolbarPosition((B.clientX-A.left)/(A.width-1));new Event(B).preventDefault()}},_onVolbarMouseUp:function(A){this._onVolbarMouseMove(A);this.volbarMouseDown=false;this.currentInterface.body.removeEvent("mousemove",this._onVolbarMouseMoveBound);this.currentInterface.body.removeEvent("mouseup",this._onVolbarMouseMoveBound);if(this.currentVolume){Cookie.set("player_volume",this.currentVolume/100,{duration:30})}},_onSeekbarSliderComplete:function(B){this.currentInterface.slider.seekbarHandleDragging=false;if(!this.currentInterface.slider.seekbarAutoSet){var A=B/this.currentInterface.slider.seekbarSlider.options.steps;this.currentSound.setPosition(A*(this.currentSound.loaded?this.currentSound.duration:this.currentSound.durationEstimate))}},_onSeekbarSliderDraggedKnob:function(){if(this.currentSound.bytesLoaded&&this.currentSound.bytesTotal){this.currentInterface.slider.seekbarHandleDragging=true;this.currentInterface.slider.draggedKnob.apply(this.currentInterface.slider.seekbarSlider,this.arguments?this.arguments:[])}},_onSoundFinish:function(){this.setSeekBarHandlePosition(0);this.setPlayPauseButtonState(false);this.nextTrack()},_generateSMIL:function(){var D=[];var A;var C;var B;if(this.trackOrder.length==0){return }this.trackOrder.each(function(F,E){A=this.trackListing[F];C=A.split("/");B=C[C.length-1].split("-");D.push(B[B.length-1])}.bind(this));D=this.id3BaseUrl+"SMIL/"+D.join("_")+".xml";console.log(D);if(JPlayer&&this.sendVEvent){this.sendVEvent("LOAD",D);this.videoCommandDelay=500}},updateTrack:function(B){if(this.tracklistTimer){$clear(this.tracklistTimer)}var A=false;if((this.currentSound&&this.currentSound.playState)||this.videoPlaying||B){A=true}console.log("Attempting to skip to track position ",this.trackPos," (play=",A,")");if(this.trackListing[this.trackOrder[this.trackPos]].substring(this.trackListing[this.trackOrder[this.trackPos]].length-4)==".mp3"){this.playUrl(this.trackListing[this.trackOrder[this.trackPos]],0,null,A,true)}else{this.skipVideoTrack(this.trackOrder[this.trackPos],A)}},changeTrack:function(A,B){if(!A){A=1}if(this.trackListing&&this.trackListing.length>1){if(this.trackOrder.length!=this.trackListing.length){this.makeTracklist()}if(this.tracklistTimer){$clear(this.tracklistTimer)}this.trackPos+=A;if(this.trackPos>(this.trackOrder.length-1)){this.trackPos=0}else{if(this.trackPos<0){this.trackPos=this.trackOrder.length-1}}this.tracklistTimer=(function(){this.updateTrack(B)}).periodical(300,this)}},nextTrack:function(){this.changeTrack(1)},prevTrack:function(){this.changeTrack(-1)},_onStop:function(){this.stop()},_onSoundLoad:function(){if(this.currentSound.readyState==2){this.loadError()}this.setSeekbarBufferPosition(1)},_onSoundLoading:function(){if(this.currentSound.bytesLoaded&&this.currentSound.bytesTotal){this.setSeekbarBufferPosition(this.currentSound.bytesLoaded/this.currentSound.bytesTotal)}else{this.setSeekbarPosition(0)}},_onSoundPlaying:function(){if(!this.currentInterface.slider.seekbarHandleDragging){this.setSeekBarHandlePosition(this.currentSound.position/(this.currentSound.loaded?this.currentSound.duration:this.currentSound.durationEstimate))}},_onRatingMouseMove:function(F){if(!this.ratingSubmitted){var G=this.currentInterface.elements.scoreEl;var D=this.currentInterface.elements.currentScoreEl.getCoordinates().width;var E=G.getCoordinates();var C=new Event(F);var H=C.page.x-E.left;var A=Math.ceil(H/(E.width/5));if(!G.barSize||G.barSize!=A){var B=(A*(D/5)).toInt();G.getElement(".five").setStyle("width",B);this.currentInterface.elements.scoreEl.setScore=A}}},_onRatingMouseLeave:function(A){if(!this.ratingSubmitted){this.currentInterface.elements.scoreEl.getElement(".five").setStyle("width",0)}},_onRatingMouseDown:function(A){if(!this.ratingSubmitted){this.ratingSubmitted=this.submitRating(this.currentInterface.elements.scoreEl.setScore)}this.ratingSubmitted=true},loadError:function(){alert("Sorry, we are unable to load this podcast.\nPlease try again, or contact a system administrator\nif the problem persists.")},resetDesc:function(){if(this.currentInterface.elements.descriptionEl&&this.defDesc){this.currentInterface.elements.descriptionEl.innerHTML=this.defDesc}if(this.currentInterface.elements.titleEl&&this.defTitle){this.currentInterface.elements.titleEl.innerHTML=this.defTitle}},loadingDesc:function(){if(this.currentInterface.elements.descriptionEl&&this.defDesc){this.currentInterface.elements.descriptionEl.innerHTML="Retreiving Podcast Details..."}if(this.currentInterface.elements.titleEl&&this.defTitle){this.currentInterface.elements.titleEl.innerHTML="Please Wait<br />Loading..."}}});
