/* LiveQuery */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))
return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)
$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)
this.elements.unbind(this.type,this.fn);else if(this.fn2)
this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
$.event.remove(el,query.type,query.fn);});}
else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)
$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);}
else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)
$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)
r.context=a.context,r.selector=a.selector;if(typeof a=='string')
r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);

/* jQuery Address Plugin v1.1 */
(function(a){a.address=(function(){var c=function(i){a(this).trigger(a.extend(a.Event(i),(function(){var ah={value:this.value(),path:this.path(),pathNames:this.pathNames(),parameterNames:this.parameterNames(),parameters:{},queryString:this.queryString()};for(var ag=0,p=ah.parameterNames.length;ag<p;ag++){ah.parameters[ah.parameterNames[ag]]=this.parameter(ah.parameterNames[ag])}return ah}).call(this)))};var V=function(){c.call(a.address,"init")};var o=function(){c.call(a.address,"change")};var P=function(){var i=U.href.indexOf("#");return i!=-1?ae(q(U.href.substr(i+1))):""};var h=function(){try{return top.document!=undefined?top:window}catch(i){return window}};var F=function(p,i){if(C.strict){p=i?(p.substr(0,1)!="/"?"/"+p:p):(p==""?"/":p)}return p};var r=function(i,p){return(j&&U.protocol=="file:")?(p?Q.replace(/\?/,"%3F"):Q.replace(/%253F/,"?")):i};var af=function(ai){for(var ag=0,p=ai.childNodes.length,ah;ag<p;ag++){if(ai.childNodes[ag].src){l=String(ai.childNodes[ag].src)}if(ah=af(ai.childNodes[ag])){return ah}}};var X=function(){if(!t){var p=P();var i=!(Q==p);if(u&&s<523){if(E!=Y.length){E=Y.length;if(typeof z[E-1]!=G){Q=z[E-1]}T(false)}}else{if(j&&s<7&&i){U.reload()}else{if(i){Q=p;T(false)}}}}};var T=function(i){o();if(i){c.call(a.address,"internalChange")}else{c.call(a.address,"externalChange")}n(w,10)};var w=function(){var p=(U.pathname+(/\/$/.test(U.pathname)?"":"/")+D.value()).replace(/\/\//,"/").replace(/^\/$/,"");var i=window[C.tracker];if(typeof i==g){i(p)}else{if(typeof pageTracker!=G&&typeof pageTracker._trackPageview==g){pageTracker._trackPageview(p)}else{if(typeof urchinTracker==g){urchinTracker(p)}}}};var e=function(){var i=f.contentWindow.document;i.open();i.write("<html><head><title>"+ac.title+"</title><script>var "+x+' = "'+P()+'";<\/script></head></html>');i.close()};var N=function(){if(!S){S=B;if(j&&s<8){var i=ac.getElementsByTagName("frameset")[0];f=ac.createElement((i?"":"i")+"frame");if(i){i.insertAdjacentElement("beforeEnd",f);i[i.cols?"cols":"rows"]+=",0";f.src="javascript:false";f.noResize=true;f.frameBorder=f.frameSpacing=0}else{f.src="javascript:false";f.style.display="none";ac.body.insertAdjacentElement("afterBegin",f)}n(function(){a(f).bind("load",function(){var p=f.contentWindow;var ag=p.location.href;Q=(typeof p[x]!=G?p[x]:"");if(Q!=P()){T(false);U.hash=r(Q,B)}});if(typeof f.contentWindow[x]==G){e()}},50)}else{if(u){if(s<418){a(ac.body).append('<form id="'+x+'" style="position:absolute;top:-9999px;" method="get"></form>');J=ac.getElementById(x)}if(typeof U[x]==G){U[x]={}}if(typeof U[x][U.pathname]!=G){z=U[x][U.pathname].split(",")}}}n(function(){V();T(false)},1);if(j&&s>=8){ac.body.onhashchange=X}else{v(X,50)}a("a[rel*=address:]").address()}};var D={baseURL:function(){var i=U.href;if(i.indexOf("#")!=-1){i=i.substr(0,i.indexOf("#"))}if(i.substr(i.length-1)=="/"){i=i.substr(0,i.length-1)}return i},strict:function(){return C.strict},history:function(){return C.history},tracker:function(){return C.tracker},title:function(){return ac.title},value:function(){if(!ab){return null}return q(F(r(Q,Z),Z))},path:function(){var i=this.value();return(i.indexOf("?")!=-1)?i.split("?")[0]:i},pathNames:function(){var p=this.path();var i=p.split("/");if(p.substr(0,1)=="/"||p.length==0){i.splice(0,1)}if(p.substr(p.length-1,1)=="/"){i.splice(i.length-1,1)}return i},queryString:function(){var p=this.value();var i=p.indexOf("?");if(i!=-1&&i<p.length){return p.substr(i+1)}},parameter:function(am){var aj=this.value();var ag=aj.indexOf("?");if(ag!=-1){aj=aj.substr(ag+1);var al=aj.split("&");var ak,ah=al.length,ai=[];while(ah--){ak=al[ah].split("=");if(ak[0]==am){ai.push(ak[1])}}if(ai.length!=0){return ai.length!=1?ai:ai[0]}}},parameterNames:function(){var ah=this.value();var p=ah.indexOf("?");var ai=[];if(p!=-1){ah=ah.substr(p+1);if(ah!=""&&ah.indexOf("=")!=-1){var aj=ah.split("&");var ag=0;while(ag<aj.length){ai.push(aj[ag].split("=")[0]);ag++}}}return ai}};var H={strict:function(i){C.strict=i},history:function(i){C.history=i},tracker:function(i){C.tracker=i},title:function(i){i=q(i);n(function(){I=ac.title=i;if(K&&f&&f.contentWindow&&f.contentWindow.document){f.contentWindow.document.title=i;K=Z}if(!M&&aa){U.replace(U.href.indexOf("#")!=-1?U.href:U.href+"#")}M=Z},50)},value:function(ag){ag=ae(q(F(ag,B)));if(ag=="/"){ag=""}if(Q==ag){return}M=B;Q=ag;t=B;T(true);z[Y.length]=Q;if(u){if(C.history){U[x][U.pathname]=z.toString();E=Y.length+1;if(s<418){if(U.search==""){J.action="#"+Q;J.submit()}}else{if(s<523||Q==""){var i=ac.createEvent("MouseEvents");i.initEvent("click",B,B);var p=ac.createElement("a");p.href="#"+Q;p.dispatchEvent(i)}else{U.hash="#"+Q}}}else{U.replace("#"+Q)}}else{if(Q!=P()){if(C.history){U.hash="#"+r(Q,B)}else{U.replace("#"+Q)}}}if((j&&s<8)&&C.history){n(e,50)}if(u){n(function(){t=Z},1)}else{t=Z}}};var x="jQueryAddress",g="function",G="undefined",B=true,Z=false,A=a.browser,s=parseFloat(a.browser.version),aa=A.mozilla,j=A.msie,L=A.opera,u=A.safari,ab=Z,O=h(),ac=O.document,Y=O.history,U=O.location,v=setInterval,n=setTimeout,q=decodeURI,ae=encodeURI,ad=navigator.userAgent,f,J,l,I=ac.title,E=Y.length,t=Z,S=Z,M=B,K=B,z=[],y={},Q=P(),k={},C={history:B,strict:B};if(j){s=parseFloat(ad.substr(ad.indexOf("MSIE")+4));if(ac.documentMode&&ac.documentMode!=s){s=ac.documentMode!=8?7:8}}ab=(aa&&s>=1)||(j&&s>=6)||(L&&s>=9.5)||(u&&s>=312);if(ab){for(var W=1;W<E;W++){z.push("")}z.push(P());if(j&&U.hash!=P()){U.hash="#"+r(P(),B)}if(L){history.navigationMode="compatible"}af(document);var b=l.indexOf("?");if(l&&b>-1){var m,d=l.substr(b+1).split("&");for(var W=0,R;R=d[W];W++){m=R.split("=");if(/^(history|strict)$/.test(m[0])){C[m[0]]=(isNaN(m[1])?/^(true|yes)$/i.test(m[1]):(parseInt(m[1])!=0))}if(/^tracker$/.test(m[0])){C[m[0]]=m[1]}}}a(N)}else{if((!ab&&U.href.indexOf("#")!=-1)||(u&&s<418&&U.href.indexOf("#")!=-1&&U.search!="")){ac.open();ac.write('<html><head><meta http-equiv="refresh" content="0;url='+U.href.substr(0,U.href.indexOf("#"))+'" /></head></html>');ac.close()}else{w()}}a.each(("init,change,internalChange,externalChange").split(","),function(ag,p){k[p]=function(ah,i){a(a.address).bind(p,i||ah,i&&ah);return this}});a.each(("strict,history,tracker,title,value").split(","),function(ag,p){k[p]=function(i){if(typeof i!="undefined"){if(ab){H[p](i)}return a.address}else{return D[p]()}}});a.each(("baseURL,path,pathNames,queryString,parameter,parameterNames").split(","),function(ag,p){k[p]=function(i){return D[p](i)}});return k})();a.fn.address=function(b){a(this).click(function(){var c=b?b.call(this):/address:/.test(a(this).attr("rel"))?a(this).attr("rel").split("address:")[1].split(" ")[0]:a(this).attr("href").replace(/^#/,"");a.address.value(c);return false})}}(jQuery));

/* jPlayer Plugin for jQuery JavaScript Library. http://www.happyworm.com/jquery/jplayer */
(function(c){function k(a,b){function d(g){g=c[a][g]||[];return typeof g=="string"?g.split(/,?\s+/):g}var e=d("getter");return c.inArray(b,e)!=-1}c.fn.jPlayer=function(a){var b=typeof a=="string",d=Array.prototype.slice.call(arguments,1);if(b&&a.substring(0,1)=="_")return this;if(b&&k("jPlayer",a,d)){var e=c.data(this[0],"jPlayer");return e?e[a].apply(e,d):undefined}return this.each(function(){var g=c.data(this,"jPlayer");!g&&!b&&c.data(this,"jPlayer",new c.jPlayer(this,a))._init();g&&b&&c.isFunction(g[a])&&
g[a].apply(g,d)})};c.jPlayer=function(a,b){this.options=c.extend({},b);this.element=c(a)};c.jPlayer.getter="jPlayerOnProgressChange jPlayerOnSoundComplete jPlayerVolume jPlayerReady getData jPlayerController";c.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"};c.jPlayer._config={jPlayerControllerId:undefined,
isWaitingForPlay:false};c.jPlayer._diag={isPlaying:false,src:"",loadPercent:0,playedPercentRelative:0,playedPercentAbsolute:0,playedTime:0,totalTime:0};c.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"};c.jPlayer.count=0;c.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,
padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};c.jPlayer.convertTime=function(a){var b=new Date(a),d=b.getUTCHours();a=b.getUTCMinutes();b=b.getUTCSeconds();d=c.jPlayer.timeFormat.padHour&&d<10?"0"+d:d;a=c.jPlayer.timeFormat.padMin&&a<10?"0"+a:a;b=c.jPlayer.timeFormat.padSec&&b<10?"0"+b:b;return(c.jPlayer.timeFormat.showHour?d+c.jPlayer.timeFormat.sepHour:"")+(c.jPlayer.timeFormat.showMin?a+c.jPlayer.timeFormat.sepMin:"")+(c.jPlayer.timeFormat.showSec?b+c.jPlayer.timeFormat.sepSec:
"")};c.jPlayer.prototype={_init:function(){var a=this,b=this.element;this.config=c.extend({},c.jPlayer.defaults,this.options,c.jPlayer._config);this.config.diag=c.extend({},c.jPlayer._diag);this.config.cssId={};this.config.cssSelector={};this.config.cssDisplay={};this.config.clickHandler={};this.element.data("jPlayer.config",this.config);c.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_"+c.jPlayer.count,aid:this.config.cssPrefix+"_audio_"+c.jPlayer.count,hid:this.config.cssPrefix+"_force_"+c.jPlayer.count,i:c.jPlayer.count});c.jPlayer.count++;if(this.config.ready!=undefined)if(c.isFunction(this.config.ready))this.jPlayerReady=this.config.ready;else this._warning("Constructor's ready option is not a function.");this.element.prepend('<audio id="'+this.config.aid+'"></audio>');c.extend(this.config,{aSel:c("#"+this.config.aid)});var d=this.config.aSel.get();c.extend(this.config,
{canPlayMP3:!!(d[0].canPlayType?""!=d[0].canPlayType("audio/mpeg")&&"no"!=d[0].canPlayType("audio/mpeg"):false),canPlayOGG:!!(d[0].canPlayType?""!=d[0].canPlayType("audio/ogg")&&"no"!=d[0].canPlayType("audio/ogg"):false),audio:d[0]});c.extend(this.config,{html5:!!(this.config.oggSupport?this.config.canPlayOGG?true:this.config.canPlayMP3:this.config.canPlayMP3)});c.extend(this.config,{usingFlash:!(this.config.html5&&this.config.nativeSupport),usingMP3:!(this.config.oggSupport&&this.config.canPlayOGG&&
this.config.nativeSupport)});d={setButtons:function(h,f){a.config.diag.isPlaying=f;if(a.config.cssId.play!=undefined&&a.config.cssId.pause!=undefined)if(f){a.config.cssSelector.play.css("display","none");a.config.cssSelector.pause.css("display",a.config.cssDisplay.pause)}else{a.config.cssSelector.play.css("display",a.config.cssDisplay.play);a.config.cssSelector.pause.css("display","none")}if(f)a.config.isWaitingForPlay=false}};var e={setFile:function(h,f){try{a._getMovie().fl_setFile_mp3(f);a.config.diag.src=
f;a.config.isWaitingForPlay=true;b.trigger("jPlayer.setButtons",false)}catch(j){a._flashError(j)}},play:function(){try{a._getMovie().fl_play_mp3()&&b.trigger("jPlayer.setButtons",true)}catch(h){a._flashError(h)}},pause:function(){try{a._getMovie().fl_pause_mp3()&&b.trigger("jPlayer.setButtons",false)}catch(h){a._flashError(h)}},stop:function(){try{a._getMovie().fl_stop_mp3()&&b.trigger("jPlayer.setButtons",false)}catch(h){a._flashError(h)}},playHead:function(h,f){try{a._getMovie().fl_play_head_mp3(f)&&
b.trigger("jPlayer.setButtons",true)}catch(j){a._flashError(j)}},playHeadTime:function(h,f){try{a._getMovie().fl_play_head_time_mp3(f)&&b.trigger("jPlayer.setButtons",true)}catch(j){a._flashError(j)}},volume:function(h,f){a.config.volume=f;try{a._getMovie().fl_volume_mp3(f)}catch(j){a._flashError(j)}}},g={setFile:function(h,f,j){a.config.aSel.remove();b.prepend('<audio id="'+a.config.aid+'"></audio>');a.config.aSel=c("#"+a.config.aid);h=a.config.aSel.get();a.config.audio=h[0];a.config.audio.volume=
a.config.volume/100;a.config.diag.src=a.config.usingMP3?f:j;a.config.isWaitingForPlay=true;b.trigger("jPlayer.setButtons",false);a.jPlayerOnProgressChange(0,0,0,0,0)},play:function(){if(a.config.isWaitingForPlay)a.config.audio.src=a.config.diag.src;a.config.audio.play();b.trigger("jPlayer.setButtons",true);clearInterval(a.config.jPlayerControllerId);a.config.jPlayerControllerId=window.setInterval(function(){a.jPlayerController(false)},100)},pause:function(){a.config.audio.pause();b.trigger("jPlayer.setButtons",
false)},stop:function(){try{a.config.audio.currentTime=0;b.trigger("jPlayer.pause");clearInterval(a.config.jPlayerControllerId);a.config.jPlayerControllerId=window.setInterval(function(){a.jPlayerController(true)},100)}catch(h){window.setTimeout(function(){a.stop()},100)}},playHead:function(h,f){try{a.config.audio.currentTime=a.config.audio.buffered?f*a.config.audio.buffered.end()/100:f*a.config.audio.duration/100;b.trigger("jPlayer.play")}catch(j){window.setTimeout(function(){a.playHead(f)},100)}},
playHeadTime:function(h,f){try{a.config.audio.currentTime=f/1E3;b.trigger("jPlayer.play")}catch(j){window.setTimeout(function(){a.playHeadTime(f)},100)}},volume:function(h,f){a.config.volume=f;a.config.audio.volume=f/100;a.jPlayerVolume(f)}};this.config.usingFlash?c.extend(d,e):c.extend(d,g);for(var i in d){e="jPlayer."+i;this.element.unbind(e);this.element.bind(e,d[i])}if(this.config.usingFlash)if(this._checkForFlash(8))if(c.browser.msie){d='<object id="'+this.config.fid+'"';d+=' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
d+=' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';d+=' type="application/x-shockwave-flash"';d+=' width="'+this.config.width+'" height="'+this.config.height+'">';d+="</object>";i=[];i[0]='<param name="movie" value="'+this.config.swf+'" />';i[1]='<param name="quality" value="high" />';i[2]='<param name="FlashVars" value="id='+escape(this.config.id)+"&fid="+escape(this.config.fid)+"&vol="+this.config.volume+'" />';i[3]='<param name="allowScriptAccess" value="always" />';
i[4]='<param name="bgcolor" value="'+this.config.bgcolor+'" />';d=document.createElement(d);for(e=0;e<i.length;e++)d.appendChild(document.createElement(i[e]));this.element.html(d)}else{i='<embed name="'+this.config.fid+'" id="'+this.config.fid+'" src="'+this.config.swf+'"';i+=' width="'+this.config.width+'" height="'+this.config.height+'" bgcolor="'+this.config.bgcolor+'"';i+=' quality="high" FlashVars="id='+escape(this.config.id)+"&fid="+escape(this.config.fid)+"&vol="+this.config.volume+'"';i+=
' allowScriptAccess="always"';i+=' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';this.element.html(i)}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>');c.extend(this.config,{hSel:c("#"+this.config.hid)});
this.config.hSel.css({"text-indent":"-9999px"})}this.config.customCssIds||c.each(c.jPlayer._cssId,function(h,f){a.cssId(h,f)});if(!this.config.usingFlash){this.element.css({left:"-9999px"});window.setTimeout(function(){a.volume(a.config.volume);a.jPlayerReady()},100)}},jPlayerReady:function(){},setFile:function(a,b){this.element.trigger("jPlayer.setFile",[a,b])},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){this.element.trigger("jPlayer.volume",[a])},cssId:function(a,b){var d=this;if(typeof b=="string")if(c.jPlayer._cssId[a]){this.config.cssId[a]!=undefined&&this.config.cssSelector[a].unbind("click",this.config.clickHandler[a]);this.config.cssId[a]=b;this.config.cssSelector[a]=c("#"+b);this.config.clickHandler[a]=function(e){d[a](e);return false};
this.config.cssSelector[a].click(this.config.clickHandler[a]);this.config.cssDisplay[a]=this.config.cssSelector[a].css("display");a=="pause"&&this.config.cssSelector[a].css("display","none")}else this._warning("Unknown/Illegal function in cssId\n\njPlayer('cssId', '"+a+"', '"+b+"')");else this._warning("cssId CSS Id must be a string\n\njPlayer('cssId', '"+a+"', "+b+")")},loadBar:function(a){if(this.config.cssId.loadBar!=undefined){var b=this.config.cssSelector.loadBar.offset();a=a.pageX-b.left;b=
this.config.cssSelector.loadBar.width();this.playHead(100*a/b)}},playBar:function(a){this.loadBar(a)},onProgressChange:function(a){if(c.isFunction(a))this.onProgressChangeCustom=a;else this._warning("onProgressChange parameter is not a function.")},onProgressChangeCustom:function(){},jPlayerOnProgressChange:function(a,b,d,e,g){this.config.diag.loadPercent=a;this.config.diag.playedPercentRelative=b;this.config.diag.playedPercentAbsolute=d;this.config.diag.playedTime=e;this.config.diag.totalTime=g;
this.config.cssId.loadBar!=undefined&&this.config.cssSelector.loadBar.width(a+"%");this.config.cssId.playBar!=undefined&&this.config.cssSelector.playBar.width(b+"%");this.onProgressChangeCustom(a,b,d,e,g);this._forceUpdate()},jPlayerController:function(a){var b=0,d=0,e=0,g=0,i=0;if(this.config.audio.readyState>=1){b=this.config.audio.currentTime*1E3;d=this.config.audio.duration*1E3;d=isNaN(d)?0:d;e=d>0?100*b/d:0;g=this.config.audio.buffered?100*this.config.audio.buffered.end()/this.config.audio.duration:
100;i=this.config.audio.buffered?100*this.config.audio.currentTime/this.config.audio.buffered.end():e}if(this.config.audio.ended){clearInterval(this.config.jPlayerControllerId);this.jPlayerOnSoundComplete()}else!this.config.diag.isPlaying&&g>=100&&clearInterval(this.config.jPlayerControllerId);a?this.jPlayerOnProgressChange(g,0,0,0,d):this.jPlayerOnProgressChange(g,i,e,b,d)},volumeMin:function(){this.volume(0)},volumeMax:function(){this.volume(100)},volumeBar:function(a){if(this.config.cssId.volumeBar!=
undefined){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){if(this.config.cssId.volumeBarValue!=null){this.config.cssSelector.volumeBarValue.width(a+"%");this._forceUpdate()}},onSoundComplete:function(a){if(c.isFunction(a))this.onSoundCompleteCustom=a;else this._warning("onSoundComplete parameter is not a function.")},onSoundCompleteCustom:function(){},
jPlayerOnSoundComplete:function(){this.element.trigger("jPlayer.setButtons",false);this.onSoundCompleteCustom()},getData:function(a){for(var b=a.split("."),d=this.config,e=0;e<b.length;e++)if(d[b[e]]!=undefined)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=false,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a);b=true}catch(e){}else if(navigator.plugins&&
navigator.mimeTypes.length>0)if(d=navigator.plugins["Shockwave Flash"])if(navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a)b=true;return b},_forceUpdate:function(){this.config.graphicsFix&&this.config.hSel.text(""+Math.random())},_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 : id='"+this.config.id+"' : "+a)}}})(jQuery);

jQuery(function($) {
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			}
		},
		enhancements : {
			slideshow : function(){
				var delay = (arguments[0] || 3) * 1500,
				    ss = $('#featured, #featured_child'),
				    items, cycle, current;

				if (ss.length === null) {
					return;
				}

				items = ss.find('li');

				//hide elements by 0 opacity rather than display:none
				ss.find('li[class!=active]').css({
					'opacity' : '0',
					'display' : 'block'
				});			

				//get active element from HTML or set it to the first element if it's missing
				current = items.index(ss.find('li.active'));
				if (current < 0) {
					current = 0;
				}

				//set initial values for current element
				items.eq(current).css({
					'opacity'	: 1,
					'display' : 'block'
				}).removeClass('active');

				//function switching images			 
				cycle = function(){
					var prev = current;					
					current = current + 1 === items.length ? 0 : current + 1;
					items.eq(current).css('z-index',150).animate({ 'opacity' : 1 }, 900, function(){
						items.eq(prev).css('opacity', 0);
						$(this).css('z-index',100);
					});
				};

				window.setInterval(function(){
					cycle();
				}, delay);
			},
			deep_link : function(){
				$.address.change(function(event){
					$('#content-wrapper').html('<img src="public/images/content-loader.gif" />');
					$('#content-wrapper').load(event.value + ' #content-wrapper', function(){
						/*var leftHeight = $("#left").css("height");
						var rightHeight = $("#right").css("height");
						if(leftHeight > rightHeight){
							//alert('Left side is taller.');
							$("#right").css("height", leftHeight);
						} else {
							//alert('Right side is taller.');
							$("#left").css("height", rightHeight);
						}*/
					});
				});
				$('#right a[target!=_blank]').livequery('click', function(){
					var href = $(this).attr('href');
					if(href == "#music"){
						$('html,body').animate({
							scrollTop: $("#footer").offset().top
						}, 800, function(){
								$("#jquery_jplayer").jPlayer("play");
							});
						return false;
					} else {
						$('#content-wrapper').html("");
						$("#left").css("height", "auto");
						$.address.value($(this).attr('href'));
						return false;
					}
				});
			},
			side_comment : function(){
				// Slide down or up the side comment form
				$("#side-comment-link").click(function(){
					$("#side-comment-form-wrapper").slideToggle();
					return false;
				});
				
				// Submit the side comment form
				$("#side-comment-form").submit(function(){
					
					// Clear the current status text, if any
					$("#side-comment-status").html("");
					
					// Create variables that contain the values of the form fields
					var sc_name = $("#side-comment-name").val();
					var sc_email = $("#side-comment-email").val();
					var sc_content = $("#side-comment-content").val();
					
					// Validate the name field
				    if(sc_name == ""){
						$("#side-comment-status").html("Please Enter Your Full Name!");
						$("#side-comment-name").focus();
						return false;
					}
					
					// Validate the email field
					if(sc_email == ""){
						$("#side-comment-status").html("Please Enter a Valid Email Address!");
						$("#side-comment-email").focus();
						return false;
					}
					var email_regex = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
					if(!email_regex.test(sc_email)){
						$("#side-comment-status").html("Please Enter a Valid Email Address!");
						$("#side-comment-email").focus();
						return false;
					}
					
					// Validate the comment field
					if(sc_content == ""){
						$("#side-comment-status").html("Please Enter a Comment!");
						$("#side-comment-content").focus();
						return false;
					}
					
					// Show the loader animation
					$('#side-comment-status').html('<img src="http://bethminer.com/public/images/loader-purple.gif" />');
					
					// Submit the form via AJAX
					$.post($(this).attr('action'), {
						'comment_name' : sc_name,
						'comment_email' : sc_email,
						'record_id' : '237',
						'comment_message' : sc_content
					},
					function(data){						
						//Clear the progress loader and display the success message
						$("#side-comment-status").html("");
						$("#side-comment-name").val("");
						$("#side-comment-email").val("");
						$("#side-comment-content").val("");
						$('#side-comment-status').html('<p>' + data + '</p>');
						// Prepend comment into the list
						$("#side-comments").prepend('<div class="comment"><h3>' + sc_name + ' Once Said:</h3><p>' + sc_content + '</p></div>');
						setTimeout(function(){
							$("#side-comment-status").html("");
							$('#side-comment-form-wrapper').slideUp();
						}, 3000);
					});
					
					// Return false stops the form from submiting to another page
					return false;
				});
			},
			ml_form : function(){
				// Clear/Restore the default values
				// Name field
				$("#ml-name").focus(function(){
					if($("#ml-name").val() == "Enter Your Full Name..."){
						$("#ml-name").val("");
					}
				});
				$("#ml-name").blur(function(){
					if($("#ml-name").val() == ""){
						$("#ml-name").val("Enter Your Full Name...");
					}
				});
				// Email field
				$("#vjjy-vjjy").focus(function(){
					if($("#vjjy-vjjy").val() == "Enter Your Email Address..."){
						$("#vjjy-vjjy").val("");
					}
				});
				$("#vjjy-vjjy").blur(function(){
					if($("#vjjy-vjjy").val() == ""){
						$("#vjjy-vjjy").val("Enter Your Email Address...");
					}
				});
				
				// Submit the mailing list form
				$("#ml-form").submit(function(){
					
					// Clear the current status text, if any
					$("#ml-status").html("");
					
					// Create variables that contain the values of the form fields
					var ml_name = $("#ml-name").val();
					var ml_email = $("#vjjy-vjjy").val();
					var ml_state = $('#ml-state :selected').text()
					
					// Validate the name field
				    if(ml_name == "" || ml_name == "Enter Your Full Name..."){
						$("#ml-status").html("Please Enter Your Full Name!");
						$("#ml-name").val("");
						$("#ml-name").focus();
						return false;
					}
					
					// Validate the email field
					if(ml_email == "" || ml_email == "Enter Your Email Address..."){
						$("#ml-status").html("Please Enter a Valid Email Address!");
						$("#vjjy-vjjy").val("");
						$("#vjjy-vjjy").focus();
						return false;
					}
					var email_regex = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
					if(!email_regex.test(ml_email)){
						$("#ml-status").html("Please Enter a Valid Email Address!");
						$("#vjjy-vjjy").focus();
						return false;
					}
					
					// Validate the state menu
					if(ml_state == "Choose Your State..."){
						$("#ml-status").html("Please Select Your State!");
						$("#ml-state").focus();
						return false;
					}
				});
			},
			blogForm : function(){
				// Submit a blog comment
				$("#blog-comment-form").livequery('submit',function(){
					
					// Clear the current status text, if any
					$("#blog-comment-status").html("");
					
					// Create variables that contain the values of the form fields
					var blog_name = $("#blog-comment-name").val();
					var blog_email = $("#blog-comment-email").val();
					var blog_message = $("#blog-comment-message").val();
					var blog_id = $("#blog-record-id").val();
					
					// Validate the name field
				    if(blog_name == ""){
						$("#blog-comment-status").html("Please Enter Your Full Name!");
						$("#blog-comment-name").focus();
						return false;
					}
					
					// Validate the email field
					if(blog_email == ""){
						$("#blog-comment-status").html("Please Enter a Valid Email Address!");
						$("#blog-comment-email").focus();
						return false;
					}
					var email_regex = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
					if(!email_regex.test(blog_email)){
						$("#blog-comment-status").html("Please Enter a Valid Email Address!");
						$("#blog-comment-email").focus();
						return false;
					}
					
					// Validate the name field
				    if(blog_message == ""){
						$("#blog-comment-status").html("Please Enter your Comment!");
						$("#blog-comment-message").focus();
						return false;
					}
					
					// Show the loader animation
					$('#blog-comment-status').html('<img src="http://bethminer.com/public/images/loader-brown.gif" />');
					
					// Submit the form via AJAX
					$.post($(this).attr('action'), {
						'comment_name' : blog_name,
						'comment_email' : blog_email,
						'comment_message' : blog_message,
						'record_id' : blog_id
					},
					function(data){						
						//Clear the progress loader and display the success message
						$("#blog-comment-status").html("");
						$("#blog-comment-name").val("");
						$("#blog-comment-email").val("");
						$("#blog-comment-message").val("");
						$('#blog-comment-status').html(data);
						// Prepend comment into the list
						$("#blog-comments").prepend('<div class="comment"><h3>' + blog_name + ' Once Said:</h3><p>' + blog_message + '</p></div>');
					});
					
					// Return false stops the form from submiting to another page
					return false;
				});
			}
		}
	};

	Engine.utils.links();
	Engine.utils.mails();
	//Engine.enhancements.equal_columns();
	Engine.enhancements.slideshow();
	Engine.enhancements.deep_link();
	Engine.enhancements.side_comment();
	Engine.enhancements.ml_form();
	Engine.enhancements.blogForm();
});
