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

