(function(D){var A=D.fn.remove;D.fn.remove=function(){D("*",this).add(this).triggerHandler("remove");return A.apply(this,arguments)};function C(E){function G(H){var I=H.style;return(I.display!="none"&&I.visibility!="hidden")}var F=G(E);(F&&D.each(D.dir(E,"parentNode"),function(){return(F=G(this))}));return F}D.extend(D.expr[":"],{data:function(F,G,E){return D.data(F,E[3])},tabbable:function(F,G,E){var H=F.nodeName.toLowerCase();return(F.tabIndex>=0&&(("a"==H&&F.href)||(/input|select|textarea|button/.test(H)&&"hidden"!=F.type&&!F.disabled))&&C(F))}});D.keyCode={BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,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};function B(I,E,J,H){function G(L){var K=D[I][E][L]||[];return(typeof K=="string"?K.split(/,?\s+/):K)}var F=G("getter");if(H.length==1&&typeof H[0]=="string"){F=F.concat(G("getterSetter"))}return(D.inArray(J,F)!=-1)}D.widget=function(E,F){var G=E.split(".")[0];E=E.split(".")[1];D.fn[E]=function(K){var I=(typeof K=="string"),J=Array.prototype.slice.call(arguments,1);if(I&&K.substring(0,1)=="_"){return this}if(I&&B(G,E,K,J)){var H=D.data(this[0],E);return(H?H[K].apply(H,J):undefined)}return this.each(function(){var L=D.data(this,E);(!L&&!I&&D.data(this,E,new D[G][E](this,K)));(L&&I&&D.isFunction(L[K])&&L[K].apply(L,J))})};D[G][E]=function(I,J){var H=this;this.widgetName=E;this.widgetEventPrefix=D[G][E].eventPrefix||E;this.widgetBaseClass=G+"-"+E;this.options=D.extend({},D.widget.defaults,D[G][E].defaults,D.metadata&&D.metadata.get(I)[E],J);this.element=D(I).bind("setData."+E,function(M,K,L){return H._setData(K,L)}).bind("getData."+E,function(L,K){return H._getData(K)}).bind("remove",function(){return H.destroy()});this._init()};D[G][E].prototype=D.extend({},D.widget.prototype,F);D[G][E].getterSetter="option"};D.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(G,H){var F=G,E=this;if(typeof G=="string"){if(H===undefined){return this._getData(G)}F={};F[G]=H}D.each(F,function(I,J){E._setData(I,J)})},_getData:function(E){return this.options[E]},_setData:function(E,F){this.options[E]=F;if(E=="disabled"){this.element[F?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(F,H,G){var E=(F==this.widgetEventPrefix?F:this.widgetEventPrefix+F);H=H||D.event.fix({type:E,target:this.element[0]});return this.element.triggerHandler(E,[H,G],this.options[F])}};D.widget.defaults={disabled:false};D.ui={plugin:{add:function(F,E,I){var H=D.ui[F].prototype;for(var G in I){H.plugins[G]=H.plugins[G]||[];H.plugins[G].push([E,I[G]])}},call:function(E,G,F){var I=E.plugins[G];if(!I){return }for(var H=0;H<I.length;H++){if(E.options[I[H][0]]){I[H][1].apply(E.element,F)}}}},cssCache:{},css:function(E){if(D.ui.cssCache[E]){return D.ui.cssCache[E]}var F=D('<div class="ui-gen">').addClass(E).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");D.ui.cssCache[E]=!!((!(/auto|default/).test(F.css("cursor"))||(/^[1-9]/).test(F.css("height"))||(/^[1-9]/).test(F.css("width"))||!(/none/).test(F.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(F.css("backgroundColor"))));try{D("body").get(0).removeChild(F.get(0))}catch(G){}return D.ui.cssCache[E]},disableSelection:function(E){return D(E).attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},enableSelection:function(E){return D(E).attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},hasScroll:function(H,E){if(D(H).css("overflow")=="hidden"){return false}var G=(E&&E=="left")?"scrollLeft":"scrollTop",F=false;if(H[G]>0){return true}H[G]=1;F=(H[G]>0);H[G]=0;return F}};D.ui.mouse={_mouseInit:function(){var E=this;this.element.bind("mousedown."+this.widgetName,function(F){return E._mouseDown(F)});if(D.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(D.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(G){(this._mouseStarted&&this._mouseUp(G));this._mouseDownEvent=G;var E=this,H=(G.which==1),F=(typeof this.options.cancel=="string"?D(G.target).parents().add(G.target).filter(this.options.cancel).length:false);if(!H||F||!this._mouseCapture(G)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(G)&&this._mouseDelayMet(G)){this._mouseStarted=(this._mouseStart(G)!==false);if(!this._mouseStarted){G.preventDefault();return true}}this._mouseMoveDelegate=function(I){return E._mouseMove(I)};this._mouseUpDelegate=function(I){return E._mouseUp(I)};D(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},_mouseMove:function(E){if(D.browser.msie&&!E.button){return this._mouseUp(E)}if(this._mouseStarted){this._mouseDrag(E);return false}if(this._mouseDistanceMet(E)&&this._mouseDelayMet(E)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,E)!==false);(this._mouseStarted?this._mouseDrag(E):this._mouseUp(E))}return !this._mouseStarted},_mouseUp:function(E){D(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._mouseStop(E)}return false},_mouseDistanceMet:function(E){return(Math.max(Math.abs(this._mouseDownEvent.pageX-E.pageX),Math.abs(this._mouseDownEvent.pageY-E.pageY))>=this.options.distance)},_mouseDelayMet:function(E){return this.mouseDelayMet},_mouseStart:function(E){},_mouseDrag:function(E){},_mouseStop:function(E){},_mouseCapture:function(E){return true}};D.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);(function(A){A.fn.unwrap=A.fn.unwrap||function(B){return this.each(function(){A(this).parents(B).eq(0).after(this).remove()})};A.widget("ui.slider",{plugins:{},ui:function(B){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:Math.round(this.value(null,"x")),y:Math.round(this.value(null,"y"))},range:this._getRange()}},_propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);this.element.triggerHandler(C=="slide"?C:"slide"+C,[B,this.ui()],this.options[C])},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){A(this).data("mouse")._mouseDestroy()})}this.generated&&this.generated.remove()},_setData:function(B,C){A.widget.prototype._setData.apply(this,arguments);if(/min|max|steps/.test(B)){this._initBoundaries()}if(B=="range"){C?this.handle.length==2&&this._createRange():this._removeRange()}},_init:function(){var B=this;this.element.addClass("ui-slider");this._initBoundaries();this.handle=A(this.options.handle,this.element);if(!this.handle.length){B.handle=B.generated=A(B.options.handles||[0]).map(function(){var D=A("<div/>").addClass("ui-slider-handle").appendTo(B.element);if(this.id){D.attr("id",this.id)}return D[0]})}var C=function(D){this.element=A(D);this.element.data("mouse",this);this.options=B.options;this.element.bind("mousedown",function(){if(B.currentHandle){this.blur(B.currentHandle)}B._focus(this,true)});this._mouseInit()};A.extend(C.prototype,A.ui.mouse,{_mouseStart:function(D){return B._start.call(B,D,this.element[0])},_mouseStop:function(D){return B._stop.call(B,D,this.element[0])},_mouseDrag:function(D){return B._drag.call(B,D,this.element[0])},_mouseCapture:function(){return true},trigger:function(D){this._mouseDown(D)}});A(this.handle).each(function(){new C(this)}).wrap('<a href="#" style="outline:none;border:none;"></a>').parent().bind("click",function(){return false}).bind("focus",function(D){B._focus(this.firstChild)}).bind("blur",function(D){B._blur(this.firstChild)}).bind("keydown",function(D){if(!B.options.noKeyboard){return B._keydown(D.keyCode,this.firstChild)}});this.element.bind("mousedown.slider",function(D){B._click.apply(B,[D]);B.currentHandle.data("mouse").trigger(D);B.firstValue=B.firstValue+1});A.each(this.options.handles||[],function(E,D){B.moveTo(D.start,E,true)});if(!isNaN(this.options.startValue)){this.moveTo(this.options.startValue,0,true)}this.previousHandle=A(this.handle[0]);if(this.handle.length==2&&this.options.range){this._createRange()}},_initBoundaries:function(){var B=this.element[0],C=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};A.extend(C,{axis:C.axis||(B.offsetWidth<B.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(C.max,10))?{x:parseInt(C.max,10),y:parseInt(C.max,10)}:({x:C.max&&C.max.x||100,y:C.max&&C.max.y||100}),min:!isNaN(parseInt(C.min,10))?{x:parseInt(C.min,10),y:parseInt(C.min,10)}:({x:C.min&&C.min.x||0,y:C.min&&C.min.y||0})});C.realMax={x:C.max.x-C.min.x,y:C.max.y-C.min.y};C.stepping={x:C.stepping&&C.stepping.x||parseInt(C.stepping,10)||(C.steps?C.realMax.x/(C.steps.x||parseInt(C.steps,10)||C.realMax.x):0),y:C.stepping&&C.stepping.y||parseInt(C.stepping,10)||(C.steps?C.realMax.y/(C.steps.y||parseInt(C.steps,10)||C.realMax.y):0)}},_keydown:function(I,B){var D=I;if(/(33|34|35|36|37|38|39|40)/.test(D)){var F=this.options,C,H;if(/(35|36)/.test(D)){C=(D==35)?F.max.x:F.min.x;H=(D==35)?F.max.y:F.min.y}else{var G=/(34|37|40)/.test(D)?"-=":"+=";var E=/(37|38|39|40)/.test(D)?"_oneStep":"_pageStep";C=G+this[E]("x");H=G+this[E]("y")}this.moveTo({x:C,y:H},B);return false}return true},_focus:function(B,C){this.currentHandle=A(B).addClass("ui-slider-handle-active");if(C){this.currentHandle.parent()[0].focus()}},_blur:function(B){A(B).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==B){this.previousHandle=this.currentHandle;this.currentHandle=null}},_click:function(C){var D=[C.pageX,C.pageY];var B=false;this.handle.each(function(){if(this==C.target){B=true}});if(B||this.options.disabled||!(this.currentHandle||this.previousHandle)){return }if(!this.currentHandle&&this.previousHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.moveTo({y:this._convertValue(C.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this._convertValue(C.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance)},_createRange:function(){if(this.rangeElement){return }this.rangeElement=A("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this._updateRange()},_removeRange:function(){this.rangeElement.remove();this.rangeElement=null},_updateRange:function(){var C=this.options.axis=="vertical"?"top":"left";var B=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(C,(parseInt(A(this.handle[0]).css(C),10)||0)+this._handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(B,(parseInt(A(this.handle[1]).css(C),10)||0)-(parseInt(A(this.handle[0]).css(C),10)||0))},_getRange:function(){return this.rangeElement?this._convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10),this.options.axis=="vertical"?"y":"x"):null},_handleIndex:function(){return this.handle.index(this.currentHandle[0])},value:function(B,D){if(this.handle.length==1){this.currentHandle=this.handle}if(!D){D=this.options.axis=="vertical"?"y":"x"}var C=A(B!=undefined&&B!==null?this.handle[B]||B:this.currentHandle);if(C.data("mouse").sliderValue){return parseInt(C.data("mouse").sliderValue[D],10)}else{return parseInt(((parseInt(C.css(D=="x"?"left":"top"),10)/(this.actualSize[D=="x"?"width":"height"]-this._handleSize(B,D)))*this.options.realMax[D])+this.options.min[D],10)}},_convertValue:function(C,B){return this.options.min[B]+(C/(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)))*this.options.realMax[B]},_translateValue:function(C,B){return((C-this.options.min[B])/this.options.realMax[B])*(this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B))},_translateRange:function(D,C){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&D>=this._translateValue(this.value(1),C)){D=this._translateValue(this.value(1,C)-this._oneStep(C),C)}if(this.currentHandle[0]==this.handle[1]&&D<=this._translateValue(this.value(0),C)){D=this._translateValue(this.value(0,C)+this._oneStep(C),C)}}if(this.options.handles){var B=this.options.handles[this._handleIndex()];if(D<this._translateValue(B.min,C)){D=this._translateValue(B.min,C)}else{if(D>this._translateValue(B.max,C)){D=this._translateValue(B.max,C)}}}return D},_translateLimits:function(C,B){if(C>=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)){C=this.actualSize[B=="x"?"width":"height"]-this._handleSize(null,B)}if(C<=0){C=0}return C},_handleSize:function(B,C){return A(B!=undefined&&B!==null?this.handle[B]:this.currentHandle)[0]["offset"+(C=="x"?"Width":"Height")]},_oneStep:function(B){return this.options.stepping[B]||1},_pageStep:function(B){return 10},_start:function(C,B){var D=this.options;if(D.disabled){return false}this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle){this._focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:C.pageY-this.handleOffset.top,left:C.pageX-this.handleOffset.left};this.firstValue=this.value();this._propagate("start",C);this._drag(C,B);return true},_stop:function(B){this._propagate("stop",B);if(this.firstValue!=this.value()){this._propagate("change",B)}this._focus(this.currentHandle,true);return false},_drag:function(E,C){var F=this.options;var B={top:E.pageY-this.offset.top-this.clickOffset.top,left:E.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this._focus(this.previousHandle,true)}B.left=this._translateLimits(B.left,"x");B.top=this._translateLimits(B.top,"y");if(F.stepping.x){var D=this._convertValue(B.left,"x");D=Math.round(D/F.stepping.x)*F.stepping.x;B.left=this._translateValue(D,"x")}if(F.stepping.y){var D=this._convertValue(B.top,"y");D=Math.round(D/F.stepping.y)*F.stepping.y;B.top=this._translateValue(D,"y")}B.left=this._translateRange(B.left,"x");B.top=this._translateRange(B.top,"y");if(F.axis!="vertical"){this.currentHandle.css({left:B.left})}if(F.axis!="horizontal"){this.currentHandle.css({top:B.top})}this.currentHandle.data("mouse").sliderValue={x:Math.round(this._convertValue(B.left,"x"))||0,y:Math.round(this._convertValue(B.top,"y"))||0};if(this.rangeElement){this._updateRange()}this._propagate("slide",E);return false},moveTo:function(F,C,I){var G=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(C==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(C==undefined&&!this.currentHandle){C=0}if(C!=undefined){this.currentHandle=this.previousHandle=A(this.handle[C]||C)}if(F.x!==undefined&&F.y!==undefined){var B=F.x,H=F.y}else{var B=F,H=F}if(B!==undefined&&B.constructor!=Number){var E=/^\-\=/.test(B),D=/^\+\=/.test(B);if(E||D){B=this.value(null,"x")+parseInt(B.replace(E?"=":"+=",""),10)}else{B=isNaN(parseInt(B,10))?undefined:parseInt(B,10)}}if(H!==undefined&&H.constructor!=Number){var E=/^\-\=/.test(H),D=/^\+\=/.test(H);if(E||D){H=this.value(null,"y")+parseInt(H.replace(E?"=":"+=",""),10)}else{H=isNaN(parseInt(H,10))?undefined:parseInt(H,10)}}if(G.axis!="vertical"&&B!==undefined){if(G.stepping.x){B=Math.round(B/G.stepping.x)*G.stepping.x}B=this._translateValue(B,"x");B=this._translateLimits(B,"x");B=this._translateRange(B,"x");G.animate?this.currentHandle.stop().animate({left:B},(Math.abs(parseInt(this.currentHandle.css("left"))-B))*(!isNaN(parseInt(G.animate))?G.animate:5)):this.currentHandle.css({left:B})}if(G.axis!="horizontal"&&H!==undefined){if(G.stepping.y){H=Math.round(H/G.stepping.y)*G.stepping.y}H=this._translateValue(H,"y");H=this._translateLimits(H,"y");H=this._translateRange(H,"y");G.animate?this.currentHandle.stop().animate({top:H},(Math.abs(parseInt(this.currentHandle.css("top"))-H))*(!isNaN(parseInt(G.animate))?G.animate:5)):this.currentHandle.css({top:H})}if(this.rangeElement){this._updateRange()}this.currentHandle.data("mouse").sliderValue={x:Math.round(this._convertValue(B,"x"))||0,y:Math.round(this._convertValue(H,"y"))||0};if(!I){this._propagate("start",null);this._propagate("stop",null);this._propagate("change",null);this._propagate("slide",null)}}});A.ui.slider.getter="value";A.ui.slider.defaults={handle:".ui-slider-handle",distance:1,animate:false}})(jQuery);
