/*
 *  Developed by Code Rebel Base, Inc.  http://coderebelbase.com
 */

(function()
{
var d=!1;window.CrbUI_A_CONF={};CrbUI_A_CONF.COLOR="#B9E5FA";CrbUI_A_CONF.LINE_WIDTH=10;CrbUI_A_CONF.SIZE=40;CrbUI_A_CONF.PATH="";CrbUI_A_CONF.JQUERY=jQuery;CrbUI_A_CONF.JQUERY(document).ready(function(){window.CrbUI_AP||(window.CrbUI_AP=new e)});function e(){this.init();this.render()}
e.prototype.init=function(){this.g=CrbUI_A_CONF.OVERLAY;this.d=Modernizr.canvas;this.k=this.c=Modernizr.audio;d==this.k&&f(this);if(this.g&&(this.m=null!=CrbUI_A_CONF.OVERLAY_DELAY?CrbUI_A_CONF.OVERLAY_DELAY:5E3,d==Modernizr.audio.mp3)){var a=CrbUI_A_CONF.JQUERY("<div />");CrbUI_A_CONF.JQUERY(a).css("position","absolute");CrbUI_A_CONF.JQUERY(a).css("left","0px");CrbUI_A_CONF.JQUERY(a).css("top","0px");var b=CrbUI_A_CONF.PATH+"CrbUI/audio/button/swf/CrbUI_AP_Overlay.swf";CrbUI_A_CONF.JQUERY(a).html('<object id="CrbUI_AP_Overlay" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1"><param name="movie" value="'+
	b+'" /><param name="wmode" value="transparent" /><\!--[if !IE]>--\><object type="application/x-shockwave-flash" data="'+b+'" width="1" height="1"><\!--<![endif]--\><p><a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a> Is Required</p><\!--[if !IE]>--\></object><\!--<![endif]--\></object>');CrbUI_A_CONF.JQUERY(document.body).append(a);swfobject.registerObject("CrbUI_AP_Overlay","9.0.115",CrbUI_A_CONF.PATH+"CrbUI/audio/button/swf/expressInstall.swf");this.r=swfobject.getObjectById("CrbUI_AP_Overlay")}};
e.prototype.render=function(a){CrbUI_A_CONF.JQUERY(".CrbUI_AudioButton",a).each(function(a,c){new CrbUI_AudioButton(CrbUI_A_CONF.JQUERY(c).get())})};
function f(a){var b=CrbUI_A_CONF.JQUERY("<div />");CrbUI_A_CONF.JQUERY(b).css("position","absolute");CrbUI_A_CONF.JQUERY(b).css("left","0px");CrbUI_A_CONF.JQUERY(b).css("top","0px");var c=CrbUI_A_CONF.PATH+"CrbUI/audio/button/swf/CrbUI_AP.swf";CrbUI_A_CONF.JQUERY(b).html('<object id="CrbUI_AP_Flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><\!--[if !IE]>--\><object type="application/x-shockwave-flash" data="'+
	c+'" width="1" height="1"><\!--<![endif]--\><p><a href="http://get.adobe.com/flashplayer/">Adobe Flash Player</a> Is Required</p><\!--[if !IE]>--\></object><\!--<![endif]--\></object>');CrbUI_A_CONF.JQUERY(document.body).append(b);swfobject.registerObject("CrbUI_AP_Flash","9.0.115",CrbUI_A_CONF.PATH+"CrbUI/audio/button/swf/expressInstall.swf");a.e=swfobject.getObjectById("CrbUI_AP_Flash")}e.prototype.swfReady=function(){this.b&&g(this)};
e.prototype.play=function(a){if(this.b==a)if(this.c)this.a.play();else try{this.e._resume()}catch(b){console.log("CrbUI_AudioButton error resumeFlash")}else{this.stop();this.b=a;if(this.k){this.c=!0;this.a=new Audio;CrbUI_A_CONF.JQUERY(this.a).attr("preload","auto");a=CrbUI_A_CONF.JQUERY(this.b.element).attr("id");-1==a.search(".mp3")&&(a+=".mp3");var c=CrbUI_A_CONF.JQUERY(this.b.element).attr("id");-1==c.search(".ogg")&&(c+=".ogg");this.a.src=Modernizr.audio.mp3?a:c;CrbUI_A_CONF.JQUERY(this.a).bind("error",
	CrbUI_A_CONF.JQUERY.proxy(this.n,this));CrbUI_A_CONF.JQUERY(document.body).append(this.a);CrbUI_A_CONF.JQUERY(this.a).bind("ended",CrbUI_A_CONF.JQUERY.proxy(this.onEnded,this));CrbUI_A_CONF.JQUERY(this.a).bind("timeupdate",CrbUI_A_CONF.JQUERY.proxy(this.onPosition,this));this.g&&CrbUI_A_CONF.JQUERY(this.a).bind("play",CrbUI_A_CONF.JQUERY.proxy(this.p,this));this.a.play()}else g(this);this.d&&(a=this.b.canvas.getContext("2d"),a.translate(0.5*this.b.size,0.5*this.b.size),a.rotate(-90*(Math.PI/180)))}this.b.j(!0)};
e.prototype.n=function(){this.c=d;CrbUI_A_CONF.JQUERY(this.a).unbind();CrbUI_A_CONF.JQUERY(this.a).remove();this.e?g(this):f(this)};e.prototype.p=function(){h(this)};function h(a){a.h=setTimeout(CrbUI_A_CONF.JQUERY.proxy(a.q,a),500*Math.random()+a.m)}e.prototype.q=function(){if(Modernizr.audio.mp3){var a=new Audio;CrbUI_A_CONF.JQUERY(a).attr("src",this.g);a.play()}else this.r._play(this.g);h(this)};
function g(a){a.c=d;var b=CrbUI_A_CONF.JQUERY(a.b.element).attr("id");-1==b.search(".mp3")&&(b+=".mp3");a.e._play(b)}e.prototype.stop=function(a){this.h&&clearTimeout(this.h);this.b&&(this.b==a?(this.c?this.a.pause():this.e._pause(),this.b.j(d)):this.reset())};e.prototype.reset=function(){this.c?i(this):this.e._stop();j(this)};function i(a){CrbUI_A_CONF.JQUERY(a.a).unbind();a.a.pause();a.a.src="";CrbUI_A_CONF.JQUERY(a.a).remove();a.a=null}
function j(a){a.b.j(d);if(a.d){var b=a.b.canvas.getContext("2d");b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.b.canvas.width,a.b.canvas.height)}a.b=null}e.prototype.onEnded=function(){this.h&&clearTimeout(this.h);this.c?i(this):this.e._stop();this.b.i(1);j(this)};e.prototype.onPosition=function(a){this.c?this.a.duration&&this.a.currentTime&&this.b.i(this.a.currentTime/this.a.duration):this.b.i(a)};(function(){function a(a){a?(this.element=a,CrbUI_A_CONF.JQUERY(this.element).css("position","relative")):this.element=CrbUI_A_CONF.JQUERY('<div style="position:relative;"/>');this.size=void 0!==CrbUI_A_CONF.JQUERY(this.element).attr("width")?CrbUI_A_CONF.JQUERY(this.element).attr("width"):CrbUI_A_CONF.SIZE;this.lineWidth=0.5*this.size-0.5*CrbUI_A_CONF.LINE_WIDTH-1;CrbUI_A_CONF.JQUERY(this.element).css("width",this.size);CrbUI_A_CONF.JQUERY(this.element).css("height",this.size);if(this.d=Modernizr.canvas)this.canvas=
	document.createElement("canvas"),this.canvas.setAttribute("width",this.size),this.canvas.setAttribute("height",this.size),CrbUI_A_CONF.JQUERY(this.canvas).css("position","absolute"),CrbUI_A_CONF.JQUERY(this.canvas).css("top","0px"),CrbUI_A_CONF.JQUERY(this.canvas).css("left","0px");this.f=CrbUI_A_CONF.JQUERY('<img src="'+CrbUI_A_CONF.PATH+'CrbUI/audio/button/img/Play.png" width="'+this.size+'" height="'+this.size+'" style="position:absolute; top:0px; left:0px;" />');this.l=2*Math.PI;CrbUI_A_CONF.JQUERY(this.f).click(CrbUI_A_CONF.JQUERY.proxy(this.o,
	this));this.d&&CrbUI_A_CONF.JQUERY(this.element).append(this.canvas);CrbUI_A_CONF.JQUERY(this.element).append(this.f)}window.CrbUI_AudioButton=a;a.prototype.i=function(a){if(this.d){var c=this.canvas.getContext("2d");c.clearRect(0,0,this.canvas.width,this.canvas.height);c.beginPath();c.arc(0,0,this.lineWidth,0,a*this.l,d);c.strokeStyle=CrbUI_A_CONF.COLOR;c.lineWidth=CrbUI_A_CONF.LINE_WIDTH;c.stroke()}};a.prototype.j=function(a){a?CrbUI_A_CONF.JQUERY(this.f).attr("src",CrbUI_A_CONF.PATH+"CrbUI/audio/button/img/Pause.png"):
	CrbUI_A_CONF.JQUERY(this.f).attr("src",CrbUI_A_CONF.PATH+"CrbUI/audio/button/img/Play.png")};a.prototype.o=function(){CrbUI_A_CONF.JQUERY(this.f).attr("src")==CrbUI_A_CONF.PATH+"CrbUI/audio/button/img/Play.png"?window.CrbUI_AP.play(this):window.CrbUI_AP.stop(this)}})();
})()
