;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/* Form submission functions for the MailChimp Widget */
;(function($){
	$(function($) {
		// Change our submit type from HTML (default) to JS
		$('#mc_submit_type').val('js');
		
		// Attach our form submitter action
		$('#mc_signup_form').ajaxForm({
			url: mailchimpSF.ajax_url, 
			type: 'POST', 
			dataType: 'text',
			beforeSubmit: mc_beforeForm,
			success: mc_success
		});
	});
	
	function mc_beforeForm(){
		// Disable the submit button
		$('#mc_signup_submit').attr("disabled","disabled");
	}
	function mc_success(data){
		// Re-enable the submit button
		$('#mc_signup_submit').removeAttr("disabled");
		
		// Put the response in the message div
		$('#mc_message').html(data);
		
		// See if we're successful, if so, wipe the fields
		var reg = new RegExp("class='mc_success_msg'", 'i');
		if (reg.test(data)){
			$('#mc_signup_form').each(function(){
				this.reset();
			});
			$('#mc_submit_type').val('js');
		}
		$.scrollTo('#mc_signup', {offset: {top: -28}});
	}
})(jQuery);

(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);

(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);

(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);

(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var a=this,b=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f=b.values&&b.values.length||1,e=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(b.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(b.range){if(b.range===true){if(!b.values)b.values=[this._valueMin(),this._valueMin()];if(b.values.length&&b.values.length!==2)b.values=[b.values[0],b.values[0]]}this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j<f;j+=1)e.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle",
g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length?
(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i-
m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false;
this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b=
this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b=
this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);
c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c<f))c=f;if(c!==this.values(b)){f=this.values();f[b]=c;a=this._trigger("slide",a,{handle:this.handles[b],value:c,values:f});this.values(b?0:1);a!==false&&this.values(b,c,true)}}else if(c!==this.value()){a=this._trigger("slide",a,{handle:this.handles[b],value:c});
a!==false&&this.value(c)}},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b);c.values=this.values()}this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=
this._trimAlignValue(a);this._refreshValue();this._change(null,0)}else return this._value()},values:function(a,b){var c,f,e;if(arguments.length>1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e<c.length;e+=1){c[e]=this._trimAlignValue(f[e]);this._change(null,e)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):
this.value();else return this._values()},_setOption:function(a,b){var c,f=0;if(d.isArray(this.options.values))f=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":if(b){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.propAttr("disabled",true);this.element.addClass("ui-disabled")}else{this.handles.propAttr("disabled",false);this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<f;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var b,c;if(arguments.length){b=this.options.values[a];
return b=this._trimAlignValue(b)}else{b=this.options.values.slice();for(c=0;c<b.length;c+=1)b[c]=this._trimAlignValue(b[c]);return b}},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=
this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e-
g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"},
b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery);

(function(c){function k(a,b){var d=function(e){e=c[a][e]||[];return typeof e=="string"?e.split(/,?\s+/):e}("getter");return c.inArray(b,d)!=-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 h=c.data(this,"jPlayer");!h&&!b&&c.data(this,"jPlayer",new c.jPlayer(this,a))._init();h&&b&&c.isFunction(h[a])&&
h[a].apply(h,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,preload:"none",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=
{version:"1.2.0",swfVersionRequired:"1.2.0",swfVersion:"unknown",jPlayerControllerId:undefined,delayedCommandId:undefined,isWaitingForPlay:false,isFileSet: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,volume:this._limitValue(this.config.volume,0,100),autobuffer:this.config.preload!="none"});c.jPlayer.count++;if(this.config.ready!=undefined)if(c.isFunction(this.config.ready))this.jPlayerReadyCustom=this.config.ready;else this._warning("Constructor's ready option is not a function.");
this.config.audio=document.createElement("audio");this.config.audio.id=this.config.aid;c.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:c("#"+this.config.aid)});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)});var d={setButtons:function(g,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}},e={setFile:function(g,f){try{a._getMovie().fl_setFile_mp3(f);a.config.autobuffer&&b.trigger("jPlayer.load");a.config.diag.src=f;a.config.isFileSet=true;b.trigger("jPlayer.setButtons",false)}catch(j){a._flashError(j)}},clearFile:function(){try{b.trigger("jPlayer.setButtons",false);a._getMovie().fl_clearFile_mp3();a.config.diag.src="";a.config.isFileSet=false}catch(g){a._flashError(g)}},
load:function(){try{a._getMovie().fl_load_mp3()}catch(g){a._flashError(g)}},play:function(){try{a._getMovie().fl_play_mp3()&&b.trigger("jPlayer.setButtons",true)}catch(g){a._flashError(g)}},pause:function(){try{a._getMovie().fl_pause_mp3()&&b.trigger("jPlayer.setButtons",false)}catch(g){a._flashError(g)}},stop:function(){try{a._getMovie().fl_stop_mp3()&&b.trigger("jPlayer.setButtons",false)}catch(g){a._flashError(g)}},playHead:function(g,f){try{a._getMovie().fl_play_head_mp3(f)&&b.trigger("jPlayer.setButtons",
true)}catch(j){a._flashError(j)}},playHeadTime:function(g,f){try{a._getMovie().fl_play_head_time_mp3(f)&&b.trigger("jPlayer.setButtons",true)}catch(j){a._flashError(j)}},volume:function(g,f){a.config.volume=f;try{a._getMovie().fl_volume_mp3(f)}catch(j){a._flashError(j)}}},h={setFile:function(g,f,j){a.config.diag.src=a.config.usingMP3?f:j;a.config.isFileSet&&!a.config.isWaitingForPlay&&b.trigger("jPlayer.pause");a.config.audio.autobuffer=a.config.autobuffer;a.config.audio.preload=a.config.preload;
if(a.config.autobuffer){a.config.audio.src=a.config.diag.src;a.config.audio.load()}else a.config.isWaitingForPlay=true;a.config.isFileSet=true;a.jPlayerOnProgressChange(0,0,0,0,0);clearInterval(a.config.jPlayerControllerId);if(a.config.autobuffer)a.config.jPlayerControllerId=window.setInterval(function(){a.jPlayerController(false)},100);clearInterval(a.config.delayedCommandId)},clearFile:function(){a.setFile("","");a.config.isWaitingForPlay=false;a.config.isFileSet=false},load:function(){if(a.config.isFileSet)if(a.config.isWaitingForPlay){a.config.audio.autobuffer=
true;a.config.audio.preload="auto";a.config.audio.src=a.config.diag.src;a.config.audio.load();a.config.isWaitingForPlay=false;clearInterval(a.config.jPlayerControllerId);a.config.jPlayerControllerId=window.setInterval(function(){a.jPlayerController(false)},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();b.trigger("jPlayer.setButtons",true);clearInterval(a.config.jPlayerControllerId);a.config.jPlayerControllerId=
window.setInterval(function(){a.jPlayerController(false)},100);clearInterval(a.config.delayedCommandId)}},pause:function(){if(a.config.isFileSet){a.config.audio.pause();b.trigger("jPlayer.setButtons",false);clearInterval(a.config.delayedCommandId)}},stop:function(){if(a.config.isFileSet)try{b.trigger("jPlayer.pause");a.config.audio.currentTime=0;clearInterval(a.config.jPlayerControllerId);a.config.jPlayerControllerId=window.setInterval(function(){a.jPlayerController(true)},100)}catch(g){clearInterval(a.config.delayedCommandId);
a.config.delayedCommandId=window.setTimeout(function(){a.stop()},100)}},playHead:function(g,f){if(a.config.isFileSet)try{b.trigger("jPlayer.load");if(typeof a.config.audio.buffered=="object"&&a.config.audio.buffered.length>0)a.config.audio.currentTime=f*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=f*a.config.audio.duration/100;else throw"e";b.trigger("jPlayer.play")}catch(j){b.trigger("jPlayer.play");
b.trigger("jPlayer.pause");a.config.delayedCommandId=window.setTimeout(function(){a.playHead(f)},100)}},playHeadTime:function(g,f){if(a.config.isFileSet)try{b.trigger("jPlayer.load");a.config.audio.currentTime=f/1E3;b.trigger("jPlayer.play")}catch(j){b.trigger("jPlayer.play");b.trigger("jPlayer.pause");a.config.delayedCommandId=window.setTimeout(function(){a.playHeadTime(f)},100)}},volume:function(g,f){a.config.volume=f;a.config.audio.volume=f/100;a.jPlayerVolume(f)}};this.config.usingFlash?c.extend(d,
e):c.extend(d,h);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){i='<object id="'+this.config.fid+'"';i+=' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';i+=' codebase="'+document.URL.substring(0,document.URL.indexOf(":"))+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';i+=' type="application/x-shockwave-flash"';i+=' width="'+this.config.width+'" height="'+this.config.height+
'">';i+="</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+'" />';i=document.createElement(i);for(e=0;e<d.length;e++)i.appendChild(document.createElement(d[e]));this.element.html(i)}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 g=0.1*Math.random();a.config.audio.volume=(a.config.volume+(a.config.volume<50?g:-g))/100},false);this.config.audio.addEventListener("ended",function(){clearInterval(a.config.jPlayerControllerId);a.jPlayerOnSoundComplete()},false);this.element.append(this.config.audio)}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(g,f){a.cssId(g,f)});if(!this.config.usingFlash){this.element.css({left:"-9999px"});window.setTimeout(function(){a.volume(a.config.volume);a.jPlayerReady()},100)}},jPlayerReady:function(a){if(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)}else this.config.swfVersion="n/a";this.jPlayerReadyCustom()},jPlayerReadyCustom:function(){},setFile:function(a,b){this.element.trigger("jPlayer.setFile",[a,b])},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,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(h){d[a](h);c(this).blur();return false};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;if(!(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+"', '"+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,h){this.config.diag.loadPercent=a;this.config.diag.playedPercentRelative=b;this.config.diag.playedPercentAbsolute=d;this.config.diag.playedTime=e;this.config.diag.totalTime=h;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,h);this._forceUpdate()},jPlayerController:function(a){var b=0,d=0,e=0,h=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;if(typeof this.config.audio.buffered=="object"&&this.config.audio.buffered.length>0){h=100*this.config.audio.buffered.end(this.config.audio.buffered.length-1)/this.config.audio.duration;i=100*this.config.audio.currentTime/this.config.audio.buffered.end(this.config.audio.buffered.length-1)}else{h=100;i=e}}!this.config.diag.isPlaying&&h>=100&&clearInterval(this.config.jPlayerControllerId);a?this.jPlayerOnProgressChange(h,
0,0,0,d):this.jPlayerOnProgressChange(h,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())},_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);

/*	MP3-jPlayer common functions js 
	1.7.3	*/

/* Setup ======================= */
function I_unwrap() {	
	if (fox_playf === "true") { 
		var i;
		var j;
		if ( typeof foxInline !== "undefined" ) {
			for (i=0; i < foxInline.length; i++) { foxInline[i].mp3 = f_arr.f_con(foxInline[i].mp3); }
		}		
		if ( typeof mp3j_info !== "undefined" ) {
			for (i=0; i < mp3j_info.length; i++) { 
				if ( mp3j_info[i].has_ul === 1 ) {
					var arr = mp3j_info[i].list; 
					for (j=0; j < arr.length; j++) { arr[j].mp3 = f_arr.f_con(arr[j].mp3); }
				}
			}
		}
		if ( typeof mp3j_fields !== "undefined" ) {
			for (i=0; i < mp3j_fields.length; i++) { 
				var arr = mp3j_fields[i].list; 
				for (j=0; j < arr.length; j++) { arr[j].mp3 = f_arr.f_con(arr[j].mp3); }
			}
		}
	}
}

function I_setup_players() {	
	var j;
	for ( j=0; j < mp3j_info.length; j++) 
	{	
		i_make_volume( j );
		i_write_download( j );
		i_write_stop_buttons( j );
		
		/* Single-file inlines */
		if ( mp3j_info[j].has_ul === 0 ) {
			// click PlayPause wrap
			jQuery("#playpause_wrap_mp3j_"+j).data( "player", { id:j } ).click( function() {
				E_playpause_click( jQuery(this).data("player").id );
				jQuery(this).blur();
				return false;
			});
			// doubleclick PlayPause wrap
			jQuery("#playpause_wrap_mp3j_"+j).data( "player", { id:j } ).dblclick( function() {
				if ( $state !== "playing" ) { E_playpause_click( jQuery(this).data("player").id ); }
				jQuery(this).blur();
				return false;
			});
		}
		/* Playlists */
		if ( mp3j_info[j].has_ul === 1 ) {
			i_write_lists_controls(j);
			// click PlayPause button
			jQuery("#playpause_mp3j_"+j).data( "player", { id:j } ).click( function() { 
				E_playpause_click( jQuery(this).data("player").id );
				jQuery(this).blur();
				return false;
			});
			// doubleclick PlayPause button
			jQuery("#playpause_mp3j_"+j).data( "player", { id:j } ).dblclick( function() { 
				if ( $state !== "playing" ) { E_playpause_click( jQuery(this).data("player").id ); }
				jQuery(this).blur();
				return false;
			});
		}
		/* Status displays */
		if ( mp3j_info[j].status === "full" ) {
			jQuery("#P-Time-MI_"+j).text("00:00");
			jQuery("#statusMI_"+j).append('Ready');
		}
	}
}

function I_images() {
	if (document.images) {	
		pic1= new Image(4,4); pic1.src=foxpathtoimages+"t30w.png"; //default hover on playlist li
	}
}

function i_make_volume ( id ) {
	jQuery('#vol_mp3j_'+id).slider({
		value : mp3j_info[id].vol,
		max: 100,
		range: 'min',
		animate: FoxAnimSlider,
		slide: function(event, ui) { 
			mp3j_info[id].vol = ui.value;
			if ( id === $tid ) { jQuery("#jquery_jplayer").jPlayer("volume", ui.value); }
		}
	});	
}

function i_write_download(id) {
	if ( mp3j_info[id].download === true ) {
		var list = mp3j_info[id].list;
		var track = mp3j_info[id].tr;
		jQuery("#download_mp3j_"+id).empty();
		jQuery("#download_mp3j_"+id).append("<a href=\"" + list[track].mp3 + "\">DOWNLOAD MP3</a>");
	}
}

function i_write_stop_buttons(id) {
	// click Stop
	jQuery("#stop_mp3j_"+id).data( "player", { pid:id } ).click( function() {
		E_stop_click( jQuery(this).data("player").pid );
		jQuery(this).blur();
		return false;
	});
	// double click Stop
	jQuery("#stop_mp3j_"+id).data( "player", { pid:id } ).dblclick( function() {
		E_stop_doubleclick( jQuery(this).data("player").pid );
		jQuery(this).blur();
		return false;
	});	
}

function i_write_lists_controls(id) {
	var newPlayerList =  mp3j_info[id].list;
	var i;
	if ( newPlayerList.length > 1 ) // Write UL's & prev/next clicks
	{
		jQuery("#UL_mp3j_"+id).empty();
		for (i=0; i < newPlayerList.length; i++) { // Write playlist
			var listItem = (i === newPlayerList.length-1) ? "<li class='mp3j_LI_last'>" : "<li>";
			listItem += "<a href='#' id='mp3j_A_"+id+"_"+i+"' tabindex='1'>"+ newPlayerList[i].name +"</a></li>";
			jQuery("#UL_mp3j_"+id).append(listItem);
			if ( i === 0 ) { 
				jQuery("#mp3j_A_"+id+"_"+i).addClass("mp3j_A_current").parent().addClass("mp3j_A_current"); 
			}
			// click Playlist
			jQuery("#mp3j_A_"+id+"_"+i).data( "player", {index:i, pid:id} ).click( function() {
				if ( $tid !== id || ($tid === id && jQuery(this).data("player").index !== mp3j_info[id].tr) ) {
					E_change_track( jQuery(this).data("player").pid, jQuery(this).data("player").index );
				}
				jQuery(this).blur();
				return false;
			});
		}
		// click Next
		jQuery("#Next_mp3j_"+id).data( "player", {pid:id} ).click( function() {
			E_change_track( jQuery(this).data("player").pid, "next" );
			jQuery(this).blur();
			return false;
		});
		// click Prev
		jQuery("#Prev_mp3j_"+id).data( "player", {pid:id} ).click( function() {
			E_change_track( jQuery(this).data("player").pid, "prev" );
			jQuery(this).blur();
			return false;
		});
		
		if ( !mp3j_info[id].lstate ) { // TODO swap things round
			mp3j_info[id].lstate = true;
			MI_toggleplaylist( "SHOW PLAYLIST", id );
		}
	} else { // Only 1 track, hide list and toggle 
		jQuery("#UL_mp3j_"+id).hide();
		jQuery("#playlist-toggle_"+id).hide(); 
	}
	
	// Write 1st titles & captions
	jQuery('#T_mp3j_'+id).append(newPlayerList[mp3j_info[id].tr].name);
	if ( newPlayerList[mp3j_info[id].tr].artist !== "" ) { 
		if ( mp3j_info[id].type === "MI" ) {
			jQuery('#C_mp3j_'+id).append(newPlayerList[mp3j_info[id].tr].artist); 
		} else { 
			jQuery('#T_mp3j_'+id).append(" - " + newPlayerList[mp3j_info[id].tr].artist); 
		}
	}
}

/* Events =============================================================== */
function E_playpause_click( id ) {
	if ( $tid === id && $state === "playing" ) {
		jQuery("#jquery_jplayer").jPlayer("pause");
		play_button( id );
		$state = "paused";
		$link_playID = "";
		return;
	}
	if ( $tid !== id ) {
		var lastid = $tid;
		$tid = ""; 
		var playlist = mp3j_info[id].list;
		var track = mp3j_info[id].tr;
		jQuery("#jquery_jplayer").jPlayer("volume", 100); //vol scaling workaround
		jQuery("#jquery_jplayer").jPlayer("setFile", playlist[track].mp3);
		play_button( lastid );
		clear_bars( lastid );
		clear_status( lastid );
		make_slider( id );
	}
	pause_button( id );
	jQuery("#jquery_jplayer").jPlayer("play");
	jQuery("#jquery_jplayer").jPlayer("volume", mp3j_info[id].vol); // reset to correct vol
	$state = "playing";
	$link_playID = "";
	$tid = id;
}

function E_stop_click( id ) {
	if ( $tid === id ) {
		play_button( id );
		clear_bars( id );
		clear_status( id );
		$tid = "";
		jQuery("#jquery_jplayer").jPlayer("clearFile");
		if ( mp3j_info[id].status === "full" ) { jQuery("#statusMI_" + id).text('Stopped'); }
		$state = "";
		$link_playID = "";
	}
}

function E_stop_doubleclick( id ) {
	change_list_classes( id, 0 );
	change_titles( id, 0 );
	change_dload_link( id, 0 );
	clear_status( id );
	mp3j_info[id].tr = 0;
	if ( $tid === id ) {
		play_button( id );
		clear_bars( id );
		$tid = "";
		jQuery("#jquery_jplayer").jPlayer("clearFile");
		$state = "";
		$link_playID = "";
	}
}

function E_change_track( id, change ) {
	var playlist = mp3j_info[id].list;
	var track;
	var lastid = $tid;
	if ( change === "next" ) { 
		track = ( mp3j_info[id].tr+1 < playlist.length ) ? mp3j_info[id].tr+1 : 0; 
	} else if ( change === "prev" ) { 
		track = ( mp3j_info[id].tr-1 < 0 ) ? playlist.length-1 : mp3j_info[id].tr-1; 
	} else { 
		track = change; 
	}
	change_list_classes( id, track );
	change_titles( id, track );
	change_dload_link( id, track );
	play_button( lastid );
	if ( $tid !== id ) { jQuery("#jquery_jplayer").jPlayer("volume", 100); } //vol scaling workaround
	$tid = id; //
	jQuery("#jquery_jplayer").jPlayer("setFile", playlist[track].mp3);
	pause_button( id );
	jQuery("#jquery_jplayer").jPlayer("play");
	jQuery("#jquery_jplayer").jPlayer("volume", mp3j_info[id].vol); //reset to correct vol
	mp3j_info[id].tr = track;
	clear_bars( lastid );
	clear_status( lastid );
	make_slider( id );
	$state = "playing";
	$link_playID = "";
}


function run_sound_complete() {
	if ( mp3j_info[$tid].has_ul === 1 ) {
		var playlist = mp3j_info[$tid].list;
		//if ( mp3j_info[$tid].loop || mp3j_info[$tid].tr+1 !== playlist.length ) {
		if ( (mp3j_info[$tid].loop || mp3j_info[$tid].tr+1 !== playlist.length) && $link_playID === "" ) {
			E_change_track( $tid, "next" );
		} else {
			change_list_classes( $tid, 0 );
			change_titles( $tid, 0 );
			change_dload_link( $tid, 0 );
			mp3j_info[$tid].tr = 0;
			play_button( $tid );
			clear_bars( $tid );
			clear_status( $tid );
			$tid = "";
			$link_playID = "";
			jQuery("#jquery_jplayer").jPlayer("setFile", silence_mp3 );
			jQuery("#jquery_jplayer").jPlayer("play");
			jQuery("#jquery_jplayer").jPlayer("clearFile");
			$state = "";
			mp3j_init();
		}
	} else {
		play_button( $tid );
		clear_bars( $tid );
		clear_status( $tid );
		var id = $tid;
		$tid = "";
		jQuery("#jquery_jplayer").jPlayer("setFile", silence_mp3 );
		jQuery("#jquery_jplayer").jPlayer("play");
		jQuery("#jquery_jplayer").jPlayer("clearFile");
		$state = "";
		if ( mp3j_info[id].loop ) {
			E_playpause_click( id );
		} else {
			mp3j_init();
		}
	}
}

/* Do stuff =============================================================== */
function change_titles( id, track ) {
	var playlist = mp3j_info[id].list;
	
	//jQuery('#T_mp3j_'+id).text( playlist[track].name );
	jQuery('#T_mp3j_'+id).empty();
	jQuery('#T_mp3j_'+id).append( playlist[track].name );
	
	//if ( playlist[track].artist !== "" ) { jQuery('#C_mp3j_'+id).text( playlist[track].artist ); } 
	//else { jQuery('#C_mp3j_'+id).empty(); }
	jQuery('#C_mp3j_'+id).empty();
	if ( playlist[track].artist !== "" ) { 
		jQuery('#C_mp3j_'+id).append( playlist[track].artist ); 
	} 
	
}

function change_dload_link( id, track ) {
	if ( !mp3j_info[id].download ) { return; }
	var playlist = mp3j_info[id].list;
	jQuery("#download_mp3j_"+id).empty();
	jQuery("#download_mp3j_"+id).removeClass("whilelinks");
	jQuery("#download_mp3j_"+id).append("<a href=\"" + playlist[track].mp3 + "\">DOWNLOAD MP3</a>");
}

function clear_bars( id ) {
	if ( id === "" ) { return; }
	jQuery("#load_mp3j_"+id).css( "width", "0" );
	jQuery('#posbar_mp3j_'+id).slider('destroy');	
}

function clear_status( id ) {
	if ( id === "" ) { return; }
	if ( mp3j_info[id].status === "basic" ) { jQuery("#indi_mp3j_" + id + " span").replaceWith(""); }
	if ( mp3j_info[id].status === "full" ) { 
		jQuery("#T-Time-MI_" + id).empty();
		jQuery("#statusMI_" + id).text('Ready');
		jQuery("#P-Time-MI_" + id).text("00:00");
	}
}

function pause_button( id ) {
	if ( mp3j_info[id].play_txt === "#USE_G#" ) { 
		jQuery("#playpause_mp3j_"+id).removeClass("buttons_mp3j"); 
		jQuery("#playpause_mp3j_"+id).addClass("buttons_mp3jpause"); 
	} else { 
		jQuery("#playpause_mp3j_"+id).empty(); 
		jQuery("#playpause_mp3j_"+id).append( mp3j_info[id].pause_txt ); 
	}
	return;
}

function play_button( id ) {
	if ( id === "" ) { return; }
	if ( mp3j_info[id].play_txt === "#USE_G#" ) {
		jQuery("#playpause_mp3j_"+id).removeClass("buttons_mp3jpause");
		jQuery("#playpause_mp3j_"+id).addClass("buttons_mp3j");
	} else {
		jQuery("#playpause_mp3j_"+id).empty();
		jQuery("#playpause_mp3j_"+id).append(mp3j_info[id].play_txt);
	}
	return;
}

function stop_popout() {
	if( typeof newwindow !== "undefined" && !newwindow.closed && newwindow.jQuery("#jquery_jplayer").jPlayer("getData", "diag.isPlaying") ){
		newwindow.jQuery("#jquery_jplayer").jPlayer("clearFile");
	}	
}

var f_arr = {
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
	f_con : function (input) {
		var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			if (enc3 !== 64) { output = output + String.fromCharCode(chr2); }
			if (enc4 !== 64) { output = output + String.fromCharCode(chr3); }
		}
		output = f_arr._utf8_f_con(output);
		return output;
	},
	_utf8_f_con : function (utftext) {
		var string = ""; 
		var i = 0; 
		var c1 = 0; 
		var c2 = 0;
		var c = 0;
		while ( i < utftext.length ) {
			c = utftext.charCodeAt(i);
			if (c < 128) { string += String.fromCharCode(c); i++; } 
			else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; }
			else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; }
		}
		return string;
	}
};

/*	MP3-jPlayer
	1.7.3 */
	
var $tid = "";
var $state = "";
var global_lp = 0;
var pp_playerID;
var pp_startplaying;
var player_height = 100;
var popout_height;
var $link_playID = "";

jQuery(document).ready(function(){
	if ( typeof mp3j_info === "undefined" ) { return; }
	mp3j_setup();
	jQuery("#jquery_jplayer").jPlayer({
			ready: function() {
				mp3j_init();
			},
			oggSupport: false,
			volume: 100,
			swfPath: foxpathtoswf
	})
	.jPlayer("onProgressChange", function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) {
		run_progress_update( $tid, loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime );
	})
	.jPlayer("onSoundComplete", function() {
		run_sound_complete();
	});	
	if (typeof window.mp3j_footerjs === "function") { mp3j_footerjs(); }
});

// Prep arrays, click functions & initial text
function mp3j_setup() {	
	I_images();
	I_unwrap();
	if ( typeof mp3j_info !== "undefined" ) { I_setup_players(); }
	return;
}

function mp3j_init() {
	var j;
	for ( j=0; j < mp3j_info.length; j++ ) {
		if ( mp3j_info[j].autoplay ) {
			mp3j_info[j].autoplay = false;
			E_playpause_click( j );
			return;
		}
	}
}

function make_slider( id ) { 
	if ( mp3j_info[id].status === "basic" ) { jQuery('#posbar_mp3j_'+id).css( "visibility", "hidden" ); }
	jQuery('#posbar_mp3j_'+id).slider({
		max: 1000,
		range: 'min',
		animate: FoxAnimSlider,
		slide: function(event, ui) { 
			if ( $state === "paused" ) { pause_button( id, mp3j_info[id].play_txt, mp3j_info[id].pause_txt ); }
			jQuery("#jquery_jplayer").jPlayer("playHead", ui.value*(10.0/global_lp) );
			$state = "playing";
		}
	});
}

function change_list_classes( id, track ) {
	jQuery("#mp3j_A_"+id+"_"+mp3j_info[id].tr).removeClass("mp3j_A_current").parent().removeClass("mp3j_A_current");
	jQuery("#mp3j_A_"+id+"_"+track).addClass("mp3j_A_current").parent().addClass("mp3j_A_current");
}

function run_progress_update( id, loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime ) {
	if ( id === "" ) { return; }
	//var ppaInt = parseInt(playedPercentAbsolute, 10);
	//var lpInt = parseInt(loadPercent, 10);
	global_lp = loadPercent;
	jQuery("#load_mp3j_"+id).css( "width", loadPercent+"%" );
	jQuery('#posbar_mp3j_'+id).slider('option', 'value', playedPercentAbsolute*10);
	var dl = mp3j_info[id].download;
	
	// BASIC Status update
	if ( mp3j_info[id].status === "basic" ) {	
		jQuery("#indi_mp3j_"+id).empty();
		if (jQuery("#jquery_jplayer").jPlayer("getData", "diag.isPlaying")){ // "PLAYING"
			if (playedTime===0 && loadPercent===0){ // connecting 
				jQuery("#indi_mp3j_"+id).append('<span style="margin-left:6px;"><span class="mp3-finding"></span><span class="mp3-tint" style="background:#999;"></span></span>');
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("whilelinks"); jQuery("#download_mp3j_"+id).addClass("betweenlinks"); }
			}
			if (playedTime===0 && loadPercent>0){// buffering
				jQuery("#indi_mp3j_"+id).append('<span style="margin-left:6px;"><span class="mp3-finding"></span><span class="mp3-tint" style="background:#999;"></span></span>');
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			} 
			if (playedTime>0){ // playing
				jQuery('#posbar_mp3j_'+id).css( "visibility", "visible" );
				jQuery("#indi_mp3j_"+id).append('<span style="margin-left:6px;"><span class="mp3-tint" style="opacity:.8; filter:alpha(opacity=80);"></span></span>');
				jQuery("#indi_mp3j_"+id).append('<span> '+jQuery.jPlayer.convertTime(playedTime)+'</span>');
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			}
		} else { // "STOPPED"
			jQuery("#indi_mp3j_"+id).empty();
			if (playedTime>0){ // paused
				jQuery("#indi_mp3j_"+id).append('<span style="margin-left:6px;"><span class="mp3-tint" style="opacity:.8; filter:alpha(opacity=80);"></span></span>');
				jQuery("#indi_mp3j_"+id).append('<span> '+jQuery.jPlayer.convertTime(playedTime)+'</span>');
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			}
			if (playedTime===0){
				if(loadPercent>0){ // stopped
					if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
				} 
			}
		}
	}
	//FULL Status update
	if ( mp3j_info[id].status === "full" ) {
		jQuery("#T-Time-MI_"+id).hide();
		jQuery("#T-Time-MI_"+id).text(jQuery.jPlayer.convertTime(totalTime));
		jQuery("#P-Time-MI_"+id).text(jQuery.jPlayer.convertTime(playedTime));
		jQuery("#statusMI_"+id).empty();
		if (jQuery("#jquery_jplayer").jPlayer("getData", "diag.isPlaying")){ // "PLAYING"
			if (playedTime===0 && loadPercent===0){ // connecting 
				jQuery("#statusMI_"+id).append('<span class="mp3-finding"></span><span class="mp3-tint"></span>Connecting');
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("whilelinks"); jQuery("#download_mp3j_"+id).addClass("betweenlinks"); }
			}
			if (playedTime===0 && loadPercent>0){// buffering
				jQuery("#statusMI_"+id).append('<span class="mp3-loading"></span><span class="mp3-tint"></span>Buffering');
				jQuery("#T-Time-MI_"+id).show();
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			} 
			if (playedTime>0){ // playing
				jQuery("#statusMI_"+id).append('Playing');
				jQuery("#T-Time-MI_"+id).show();
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			}
		} else { // "STOPPED"
			if (playedTime>0){ // paused
				jQuery("#statusMI_"+id).append('Paused');
				jQuery("#T-Time-MI_"+id).show();
				if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
			} 
			if (playedTime===0){ 
				if(loadPercent>0){ // stopped
					jQuery("#statusMI_"+id).append('Stopped');
					jQuery("#T-Time-MI_"+id).show();
					if ( dl ) { jQuery("#download_mp3j_"+id).removeClass("betweenlinks"); jQuery("#download_mp3j_"+id).addClass("whilelinks"); }
				} else { // ready 
					jQuery("#statusMI_"+id).append('Ready');
				}
			}
		}
	}
}

function launch_mp3j_popout( url, id ) {
	var li_height = 28; 
	player_height = 100 + mp3j_info[id].height;
	popout_height = ( mp3j_info[id].list.length > 1 ) ? player_height + ( mp3j_info[id].list.length * li_height) : player_height;
	if ( popout_height > popup_maxheight ) { popout_height = popup_maxheight; }
	var open_at_height = ( mp3j_info[id].lstate ) ? popout_height : player_height;
	
	pp_startplaying = ( jQuery("#jquery_jplayer").jPlayer("getData", "diag.isPlaying") ) ? true : false;
	pp_playerID = id;
	play_button( $tid );
	clear_bars( $tid );
	clear_status( $tid );
	$tid = "";
	$state = "";
	$link_playID = "";
	// g chrome workaround, stops the hang
	jQuery("#jquery_jplayer").jPlayer("setFile", silence_mp3 );
	jQuery("#jquery_jplayer").jPlayer("play");
	
	jQuery("#jquery_jplayer").jPlayer("clearFile");
	// open popup window
	newwindow = window.open(url,'mp3jpopout','height=100,width=100,location=1,status=1,scrollbars=1,resizable=1,left=25,top=25');
	newwindow.resizeTo( popup_width, open_at_height );
	if (window.focus) { newwindow.focus(); }
	return false;
}

function MI_toggleplaylist(text, id){
	if ( mp3j_info[id].lstate ) {
		if ( text==="" ) { text="SHOW"; }
		jQuery("#L_mp3j_"+id).fadeOut(300);
		jQuery("#playlist-toggle_"+id).empty();
		jQuery("#playlist-toggle_"+id).append(text);
		mp3j_info[id].lstate = false;
		return;
	}
	if ( !mp3j_info[id].lstate ) {
		if ( text==="" ) { text="HIDE"; }
		jQuery("#L_mp3j_"+id).fadeIn("slow");
		jQuery("#playlist-toggle_"+id).empty();
		jQuery("#playlist-toggle_"+id).append(text);
		mp3j_info[id].lstate = true;
		return;
	}			
}

function link_plays_track( player, track ) {
	if ( typeof mp3j_info === "undefined" ) { return; }
	player--;
	track--;
	if ( player === $link_playID && track === mp3j_info[player].tr && $state !== "" ) {
		return;	
	}
	if ( typeof mp3j_info[player].has_ul !== "undefined" && mp3j_info[player].has_ul === 1 ) {
		if ( track >= 0 && track < mp3j_info[player].list.length ) {
			E_change_track( player, track );
			$link_playID = player;
		}
	}
}
