(function(b){function a(f,c){function g(d){d=b[f][d]||[];return typeof d=="string"?d.split(/,?\s+/):d}var h=g("getter");return b.inArray(c,h)!=-1}b.fn.jPlayer=function(f){var c=typeof f=="string",g=Array.prototype.slice.call(arguments,1);if(c&&f.substring(0,1)=="_"){return this}if(c&&a("jPlayer",f,g)){var h=b.data(this[0],"jPlayer");return h?h[f].apply(h,g):undefined}return this.each(function(){var d=b.data(this,"jPlayer");!d&&!c&&b.data(this,"jPlayer",new b.jPlayer(this,f))._init();d&&c&&b.isFunction(d[f])&&d[f].apply(d,g)})};b.jPlayer=function(d,c){this.options=b.extend({},c);this.element=b(d)};b.jPlayer.getter="jPlayerOnProgressChange jPlayerOnSoundComplete jPlayerVolume jPlayerReady getData jPlayerController";b.jPlayer.defaults={cssPrefix:"jqjp",swfPath:"js",volume:80,oggSupport:false,nativeSupport:true,customCssIds:false,graphicsFix:true,errorAlerts:false,warningAlerts:false,position:"absolute",width:"0",height:"0",top:"0",left:"0",quality:"high",bgcolor:"#ffffff"};b.jPlayer._config={version:"1.1.1",swfVersionRequired:"1.1.0",swfVersion:"unknown",jPlayerControllerId:undefined,delayedCommandId:undefined,isWaitingForPlay:false,isFileSet:false};b.jPlayer._diag={isPlaying:false,src:"",loadPercent:0,playedPercentRelative:0,playedPercentAbsolute:0,playedTime:0,totalTime:0};b.jPlayer._cssId={play:"jplayer_play",pause:"jplayer_pause",stop:"jplayer_stop",loadBar:"jplayer_load_bar",playBar:"jplayer_play_bar",volumeMin:"jplayer_volume_min",volumeMax:"jplayer_volume_max",volumeBar:"jplayer_volume_bar",volumeBarValue:"jplayer_volume_bar_value"};b.jPlayer.count=0;b.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};b.jPlayer.convertTime=function(d){var c=new Date(d),f=c.getUTCHours();d=c.getUTCMinutes();c=c.getUTCSeconds();f=b.jPlayer.timeFormat.padHour&&f<10?"0"+f:f;d=b.jPlayer.timeFormat.padMin&&d<10?"0"+d:d;c=b.jPlayer.timeFormat.padSec&&c<10?"0"+c:c;return(b.jPlayer.timeFormat.showHour?f+b.jPlayer.timeFormat.sepHour:"")+(b.jPlayer.timeFormat.showMin?d+b.jPlayer.timeFormat.sepMin:"")+(b.jPlayer.timeFormat.showSec?c+b.jPlayer.timeFormat.sepSec:"")};b.jPlayer.prototype={_init:function(){var g=this,c=this.element;this.config=b.extend({},b.jPlayer.defaults,this.options,b.jPlayer._config);this.config.diag=b.extend({},b.jPlayer._diag);this.config.cssId={};this.config.cssSelector={};this.config.cssDisplay={};this.config.clickHandler={};this.element.data("jPlayer.config",this.config);b.extend(this.config,{id:this.element.attr("id"),swf:this.config.swfPath+(this.config.swfPath!=""&&this.config.swfPath.slice(-1)!="/"?"/":"")+"Jplayer.swf",fid:this.config.cssPrefix+"_flash_"+b.jPlayer.count,aid:this.config.cssPrefix+"_audio_"+b.jPlayer.count,hid:this.config.cssPrefix+"_force_"+b.jPlayer.count,i:b.jPlayer.count,volume:this._limitValue(this.config.volume,0,100)});b.jPlayer.count++;if(this.config.ready!=undefined){if(b.isFunction(this.config.ready)){this.jPlayerReadyCustom=this.config.ready}else{this._warning("Constructor's ready option is not a function.")}}try{this.config.audio=new Audio;this.config.audio.id=this.config.aid;this.element.append(this.config.audio)}catch(m){this.config.audio={}}b.extend(this.config,{canPlayMP3:!!(this.config.audio.canPlayType?""!=this.config.audio.canPlayType("audio/mpeg")&&"no"!=this.config.audio.canPlayType("audio/mpeg"):false),canPlayOGG:!!(this.config.audio.canPlayType?""!=this.config.audio.canPlayType("audio/ogg")&&"no"!=this.config.audio.canPlayType("audio/ogg"):false),aSel:b("#"+this.config.aid)});b.extend(this.config,{html5:!!(this.config.oggSupport?this.config.canPlayOGG?true:this.config.canPlayMP3:this.config.canPlayMP3)});b.extend(this.config,{usingFlash:!(this.config.html5&&this.config.nativeSupport),usingMP3:!(this.config.oggSupport&&this.config.canPlayOGG&&this.config.nativeSupport)});var n={setButtons:function(d,e){g.config.diag.isPlaying=e;if(g.config.cssId.play!=undefined&&g.config.cssId.pause!=undefined){if(e){g.config.cssSelector.play.css("display","none");g.config.cssSelector.pause.css("display",g.config.cssDisplay.pause)}else{g.config.cssSelector.play.css("display",g.config.cssDisplay.play);g.config.cssSelector.pause.css("display","none")}}if(e){g.config.isWaitingForPlay=false}}},l={setFile:function(e,f){try{g._getMovie().fl_setFile_mp3(f);g.config.diag.src=f;g.config.isFileSet=true;c.trigger("jPlayer.setButtons",false)}catch(d){g._flashError(d)}},clearFile:function(){try{c.trigger("jPlayer.setButtons",false);g._getMovie().fl_clearFile_mp3();g.config.diag.src="";g.config.isFileSet=false}catch(d){g._flashError(d)}},play:function(){try{g._getMovie().fl_play_mp3()&&c.trigger("jPlayer.setButtons",true)}catch(d){g._flashError(d)}},pause:function(){try{g._getMovie().fl_pause_mp3()&&c.trigger("jPlayer.setButtons",false)}catch(d){g._flashError(d)}},stop:function(){try{g._getMovie().fl_stop_mp3()&&c.trigger("jPlayer.setButtons",false)}catch(d){g._flashError(d)}},playHead:function(e,f){try{g._getMovie().fl_play_head_mp3(f)&&c.trigger("jPlayer.setButtons",true)}catch(d){g._flashError(d)}},playHeadTime:function(e,f){try{g._getMovie().fl_play_head_time_mp3(f)&&c.trigger("jPlayer.setButtons",true)}catch(d){g._flashError(d)}},volume:function(e,f){g.config.volume=f;try{g._getMovie().fl_volume_mp3(f)}catch(d){g._flashError(d)}}},h={setFile:function(e,f,d){g.config.audio=new Audio;g.config.audio.id=g.config.aid;g.config.aSel.replaceWith(g.config.audio);g.config.aSel=b("#"+g.config.aid);g.config.diag.src=g.config.usingMP3?f:d;g.config.isWaitingForPlay=true;g.config.isFileSet=true;c.trigger("jPlayer.setButtons",false);g.jPlayerOnProgressChange(0,0,0,0,0);clearInterval(g.config.jPlayerControllerId);g.config.audio.addEventListener("canplay",function(){g.config.audio.volume=g.config.volume/100},false)},clearFile:function(){g.setFile("","");g.config.isWaitingForPlay=false;g.config.isFileSet=false},play:function(){if(g.config.isFileSet){if(g.config.isWaitingForPlay){g.config.audio.src=g.config.diag.src}g.config.audio.play();c.trigger("jPlayer.setButtons",true);clearInterval(g.config.jPlayerControllerId);g.config.jPlayerControllerId=window.setInterval(function(){g.jPlayerController(false)},100);clearInterval(g.config.delayedCommandId)}},pause:function(){if(g.config.isFileSet){g.config.audio.pause();c.trigger("jPlayer.setButtons",false)}},stop:function(){if(g.config.isFileSet){try{g.config.audio.currentTime=0;c.trigger("jPlayer.pause");clearInterval(g.config.jPlayerControllerId);g.config.jPlayerControllerId=window.setInterval(function(){g.jPlayerController(true)},100)}catch(d){clearInterval(g.config.delayedCommandId);g.config.delayedCommandId=window.setTimeout(function(){g.stop()},100)}}},playHead:function(e,f){if(g.config.isFileSet){try{g.config.audio.currentTime=typeof g.config.audio.buffered=="object"&&g.config.audio.buffered.length>0?f*g.config.audio.buffered.end(g.config.audio.buffered.length-1)/100:f*g.config.audio.duration/100;c.trigger("jPlayer.play")}catch(d){clearInterval(g.config.delayedCommandId);g.config.delayedCommandId=window.setTimeout(function(){g.playHead(f)},100)}}},playHeadTime:function(e,f){if(g.config.isFileSet){try{g.config.audio.currentTime=f/1000;c.trigger("jPlayer.play")}catch(d){clearInterval(g.config.delayedCommandId);g.config.delayedCommandId=window.setTimeout(function(){g.playHeadTime(f)},100)}}},volume:function(d,e){g.config.volume=e;g.config.audio.volume=e/100;g.jPlayerVolume(e)}};this.config.usingFlash?b.extend(n,l):b.extend(n,h);for(var j in n){l="jPlayer."+j;this.element.unbind(l);this.element.bind(l,n[j])}if(this.config.usingFlash){if(this._checkForFlash(8)){if(b.browser.msie){j='<object id="'+this.config.fid+'"';j+=' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';j+=' codebase="'+document.URL.substring(0,document.URL.indexOf(":"))+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';j+=' type="application/x-shockwave-flash"';j+=' width="'+this.config.width+'" height="'+this.config.height+'">';j+="</object>";n=[];n[0]='<param name="movie" value="'+this.config.swf+'" />';n[1]='<param name="quality" value="high" />';n[2]='<param name="FlashVars" value="id='+escape(this.config.id)+"&fid="+escape(this.config.fid)+"&vol="+this.config.volume+'" />';n[3]='<param name="allowScriptAccess" value="always" />';n[4]='<param name="bgcolor" value="'+this.config.bgcolor+'" />';j=document.createElement(j);for(l=0;l<n.length;l++){j.appendChild(document.createElement(n[l]))}this.element.html(j)}else{n='<embed name="'+this.config.fid+'" id="'+this.config.fid+'" src="'+this.config.swf+'"';n+=' width="'+this.config.width+'" height="'+this.config.height+'" bgcolor="'+this.config.bgcolor+'"';n+=' quality="high" FlashVars="id='+escape(this.config.id)+"&fid="+escape(this.config.fid)+"&vol="+this.config.volume+'"';n+=' allowScriptAccess="always"';n+=' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';this.element.html(n)}}else{this.element.html("<p>Flash 8 or above is not installed. <a href='http://get.adobe.com/flashplayer'>Get Flash!</a></p>")}}this.element.css({position:this.config.position,top:this.config.top,left:this.config.left});if(this.config.graphicsFix){this.element.append('<div id="'+this.config.hid+'"></div>');b.extend(this.config,{hSel:b("#"+this.config.hid)});this.config.hSel.css({"text-indent":"-9999px"})}this.config.customCssIds||b.each(b.jPlayer._cssId,function(d,e){g.cssId(d,e)});if(!this.config.usingFlash){this.element.css({left:"-9999px"});window.setTimeout(function(){g.volume(g.config.volume);g.jPlayerReady()},100)}},jPlayerReady:function(c){if(this.config.usingFlash){this.config.swfVersion=c;this.config.swfVersionRequired!=this.config.swfVersion&&this._error("jPlayer's JavaScript / SWF version mismatch!\n\nJavaScript requires SWF : "+this.config.swfVersionRequired+"\nThe Jplayer.swf used is : "+this.config.swfVersion)}else{this.config.swfVersion="n/a"}this.jPlayerReadyCustom()},jPlayerReadyCustom:function(){},setFile:function(d,c){this.element.trigger("jPlayer.setFile",[d,c])},clearFile:function(){this.element.trigger("jPlayer.clearFile")},play:function(){this.element.trigger("jPlayer.play")},pause:function(){this.element.trigger("jPlayer.pause")},stop:function(){this.element.trigger("jPlayer.stop")},playHead:function(c){this.element.trigger("jPlayer.playHead",[c])},playHeadTime:function(c){this.element.trigger("jPlayer.playHeadTime",[c])},volume:function(c){c=this._limitValue(c,0,100);this.element.trigger("jPlayer.volume",[c])},cssId:function(d,c){var f=this;if(typeof c=="string"){if(b.jPlayer._cssId[d]){this.config.cssId[d]!=undefined&&this.config.cssSelector[d].unbind("click",this.config.clickHandler[d]);this.config.cssId[d]=c;this.config.cssSelector[d]=b("#"+c);this.config.clickHandler[d]=function(e){f[d](e);b(this).blur();return false};this.config.cssSelector[d].click(this.config.clickHandler[d]);this.config.cssDisplay[d]=this.config.cssSelector[d].css("display");d=="pause"&&this.config.cssSelector[d].css("display","none")}else{this._warning("Unknown/Illegal function in cssId\n\njPlayer('cssId', '"+d+"', '"+c+"')")}}else{this._warning("cssId CSS Id must be a string\n\njPlayer('cssId', '"+d+"', "+c+")")}},loadBar:function(d){if(this.config.cssId.loadBar!=undefined){var c=this.config.cssSelector.loadBar.offset();d=d.pageX-c.left;c=this.config.cssSelector.loadBar.width();this.playHead(100*d/c)}},playBar:function(c){this.loadBar(c)},onProgressChange:function(c){if(b.isFunction(c)){this.onProgressChangeCustom=c}else{this._warning("onProgressChange parameter is not a function.")}},onProgressChangeCustom:function(){},jPlayerOnProgressChange:function(g,c,i,j,h){this.config.diag.loadPercent=g;this.config.diag.playedPercentRelative=c;this.config.diag.playedPercentAbsolute=i;this.config.diag.playedTime=j;this.config.diag.totalTime=h;this.config.cssId.loadBar!=undefined&&this.config.cssSelector.loadBar.width(g+"%");this.config.cssId.playBar!=undefined&&this.config.cssSelector.playBar.width(c+"%");this.onProgressChangeCustom(g,c,i,j,h);this._forceUpdate()},jPlayerController:function(g){var c=0,j=0,l=0,i=0,h=0;if(this.config.audio.readyState>=1){c=this.config.audio.currentTime*1000;j=this.config.audio.duration*1000;j=isNaN(j)?0:j;l=j>0?100*c/j:0;if(typeof this.config.audio.buffered=="object"&&this.config.audio.buffered.length>0){i=100*this.config.audio.buffered.end(this.config.audio.buffered.length-1)/this.config.audio.duration;h=100*this.config.audio.currentTime/this.config.audio.buffered.end(this.config.audio.buffered.length-1)}else{i=100;h=l}}if(this.config.audio.ended){clearInterval(this.config.jPlayerControllerId);this.jPlayerOnSoundComplete()}else{!this.config.diag.isPlaying&&i>=100&&clearInterval(this.config.jPlayerControllerId)}g?this.jPlayerOnProgressChange(i,0,0,0,j):this.jPlayerOnProgressChange(i,h,l,c,j)},volumeMin:function(){this.volume(0)},volumeMax:function(){this.volume(100)},volumeBar:function(d){if(this.config.cssId.volumeBar!=undefined){var c=this.config.cssSelector.volumeBar.offset();d=d.pageX-c.left;c=this.config.cssSelector.volumeBar.width();this.volume(100*d/c)}},volumeBarValue:function(c){this.volumeBar(c)},jPlayerVolume:function(c){if(this.config.cssId.volumeBarValue!=null){this.config.cssSelector.volumeBarValue.width(c+"%");this._forceUpdate()}},onSoundComplete:function(c){if(b.isFunction(c)){this.onSoundCompleteCustom=c}else{this._warning("onSoundComplete parameter is not a function.")}},onSoundCompleteCustom:function(){},jPlayerOnSoundComplete:function(){this.element.trigger("jPlayer.setButtons",false);this.onSoundCompleteCustom()},getData:function(f){for(var c=f.split("."),g=this.config,h=0;h<c.length;h++){if(g[c[h]]!=undefined){g=g[c[h]]}else{this._warning("Undefined data requested.\n\njPlayer('getData', '"+f+"')");return}}return g},_getMovie:function(){return document[this.config.fid]},_checkForFlash:function(f){var c=false,g;if(window.ActiveXObject){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+f);c=true}catch(h){}}else{if(navigator.plugins&&navigator.mimeTypes.length>0){if(g=navigator.plugins["Shockwave Flash"]){if(navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=f){c=true}}}}return c},_forceUpdate:function(){this.config.graphicsFix&&this.config.hSel.text(""+Math.random())},_limitValue:function(d,c,f){return d<c?c:d>f?f:d},_flashError:function(c){this._error("Problem with Flash component.\n\nCheck the swfPath points at the Jplayer.swf path.\n\nswfPath = "+this.config.swfPath+"\nurl: "+this.config.swf+"\n\nError: "+c.message)},_error:function(c){this.config.errorAlerts&&this._alert("Error!\n\n"+c)},_warning:function(c){this.config.warningAlerts&&this._alert("Warning!\n\n"+c)},_alert:function(c){alert("jPlayer "+this.config.version+" : id='"+this.config.id+"' : "+c)}}})(jQuery);

