;(function($){$.ui=$.ui||{};$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name];}
var tmp=$('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute',top:'-5000px',left:'-5000px',display:'block'}).appendTo('body');$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css('cursor'))||(/^[1-9]/).test(tmp.css('height'))||(/^[1-9]/).test(tmp.css('width'))||!(/none/).test(tmp.css('backgroundImage'))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));try{$('body').get(0).removeChild(tmp.get(0));}catch(e){}
return $.ui.cssCache[name];},disableSelection:function(e){e.unselectable="on";e.onselectstart=function(){return false;};if(e.style){e.style.MozUserSelect="none";}},enableSelection:function(e){e.unselectable="off";e.onselectstart=function(){return true;};if(e.style){e.style.MozUserSelect="";}},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?'scrollTop':'scrollLeft',has=false;if(e[scroll]>0)return true;e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has;}});var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).trigger("remove");return _remove.apply(this,arguments);};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1);};var widgetPrototype={init:function(){},destroy:function(){},getData:function(e,key){return this.options[key];},setData:function(e,key,value){this.options[key]=value;},enable:function(){this.setData(null,'disabled',false);},disable:function(){this.setData(null,'disabled',true);}};$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options,data){var isMethodCall=(typeof options=='string'),args=arguments;if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options](data):undefined);}
return this.each(function(){var instance=$.data(this,name);if(!instance){$.data(this,name,new $[namespace][name](this,options));}else if(isMethodCall){instance[options].apply(instance,$.makeArray(args).slice(1));}});};$[namespace][name]=function(element,options){var self=this;this.options=$.extend({},$[namespace][name].defaults,options);this.element=$(element).bind('setData.'+name,function(e,key,value){return self.setData(e,key,value);}).bind('getData.'+name,function(e,key){return self.getData(e,key);}).bind('remove',function(){return self.destroy();});this.init();};$[namespace][name].prototype=$.extend({},widgetPrototype,prototype);};$.widget("ui.mouse",{init:function(){var self=this;this.element.bind('mousedown.mouse',function(){return self.click.apply(self,arguments);}).bind('mouseup.mouse',function(){(self.timer&&clearInterval(self.timer));}).bind('click.mouse',function(){if(self.initialized){self.initialized=false;return false;}});if($.browser.msie){this.unselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');}},destroy:function(){this.element.unbind('.mouse').removeData("mouse");($.browser.msie&&this.element.attr('unselectable',this.unselectable));},trigger:function(){return this.click.apply(this,arguments);},click:function(e){if(e.which!=1||$.inArray(e.target.nodeName.toLowerCase(),this.options.dragPrevention||[])!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[e,this.element]))){return true;}
var self=this;this.initialized=false;var initialize=function(){self._MP={left:e.pageX,top:e.pageY};$(document).bind('mouseup.mouse',function(){return self.stop.apply(self,arguments);});$(document).bind('mousemove.mouse',function(){return self.drag.apply(self,arguments);});if(!self.initalized&&Math.abs(self._MP.left-e.pageX)>=self.options.distance||Math.abs(self._MP.top-e.pageY)>=self.options.distance){(self.options.start&&self.options.start.call(self.options.executor||self,e,self.element));(self.options.drag&&self.options.drag.call(self.options.executor||self,e,this.element));self.initialized=true;}};if(this.options.delay){if(this.timer){clearInterval(this.timer);}
this.timer=setTimeout(initialize,this.options.delay);}else{initialize();}
return false;},stop:function(e){if(!this.initialized){return $(document).unbind('mouseup.mouse').unbind('mousemove.mouse');}
(this.options.stop&&this.options.stop.call(this.options.executor||this,e,this.element));$(document).unbind('mouseup.mouse').unbind('mousemove.mouse');return false;},drag:function(e){var o=this.options;if($.browser.msie&&!e.button){return this.stop.call(this,e);}
if(!this.initialized&&(Math.abs(this._MP.left-e.pageX)>=o.distance||Math.abs(this._MP.top-e.pageY)>=o.distance)){(o.start&&o.start.call(o.executor||this,e,this.element));this.initialized=true;}else{if(!this.initialized){return false;}}
(o.drag&&o.drag.call(this.options.executor||this,e,this.element));return false;}});})(jQuery);;(function($){$.widget("ui.slider",{init:function(){var self=this;this.element.addClass("ui-slider");this.initBoundaries();this.handle=$(this.options.handle,this.element);if(!this.handle.length){self.handle=self.generated=$(self.options.handles||[0]).map(function(){var handle=$("<div/>").addClass("ui-slider-handle").appendTo(self.element);if(this.id)
handle.attr("id",this.id);return handle[0];});}
$(this.handle).mouse({executor:this,delay:this.options.delay,distance:this.options.distance,dragPrevention:this.options.prevention?this.options.prevention.toLowerCase().split(','):['input','textarea','button','select','option'],start:this.start,stop:this.stop,drag:this.drag,condition:function(e,handle){if(!this.disabled){if(this.currentHandle)this.blur(this.currentHandle);this.focus(handle,1);return!this.disabled;}}}).wrap('<a href="javascript:void(0)" style="cursor:default;"></a>').parent().bind('focus',function(e){self.focus(this.firstChild);}).bind('blur',function(e){self.blur(this.firstChild);}).bind('keydown',function(e){if(/(37|38|39|40)/.test(e.keyCode)){self.moveTo({x:/(37|39)/.test(e.keyCode)?(e.keyCode==37?'-':'+')+'='+self.oneStep(1):null,y:/(38|40)/.test(e.keyCode)?(e.keyCode==38?'-':'+')+'='+self.oneStep(2):null},this.firstChild);}});this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.element.bind('mousedown.slider',function(e){self.click.apply(self,[e]);self.currentHandle.data("mouse").trigger(e);self.firstValue=self.firstValue+1;});$.each(this.options.handles||[],function(index,handle){self.moveTo(handle.start,index,true);});if(!isNaN(this.options.startValue))
this.moveTo(this.options.startValue,0,true);this.previousHandle=$(this.handle[0]);if(this.handle.length==2&&this.options.range)this.createRange();},setData:function(event,key,value){this.options[key]=value;if(/min|max|steps/.test(key)){this.initBoundaries();}},initBoundaries:function(){var element=this.element[0];var o=this.options;$.extend(o,{axis:o.axis||(element.offsetWidth<element.offsetHeight?'vertical':'horizontal'),max:!isNaN(parseInt(o.max,10))?{x:parseInt(o.max,10),y:parseInt(o.max,10)}:({x:o.max&&o.max.x||100,y:o.max&&o.max.y||100}),min:!isNaN(parseInt(o.min,10))?{x:parseInt(o.min,10),y:parseInt(o.min,10)}:({x:o.min&&o.min.x||0,y:o.min&&o.min.y||0})});o.realMax={x:o.max.x-o.min.x,y:o.max.y-o.min.y};o.stepping={x:o.stepping&&o.stepping.x||parseInt(o.stepping,10)||(o.steps?o.realMax.x/(o.steps.x||parseInt(o.steps,10)||o.realMax.x):0),y:o.stepping&&o.stepping.y||parseInt(o.stepping,10)||(o.steps?o.realMax.y/(o.steps.y||parseInt(o.steps,10)||o.realMax.y):0)};},plugins:{},createRange:function(){this.rangeElement=$('<div></div>').addClass('ui-slider-range').css({position:'absolute'}).appendTo(this.element);this.updateRange();},updateRange:function(){var prop=this.options.axis=="vertical"?"top":"left";var size=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(prop,parseInt($(this.handle[0]).css(prop),10)+this.handleSize(0,this.options.axis=="vertical"?2:1)/2);this.rangeElement.css(size,parseInt($(this.handle[1]).css(prop),10)-parseInt($(this.handle[0]).css(prop),10));},getRange:function(){return this.rangeElement?this.convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10)):null;},ui:function(e){return{instance:this,options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?2:1)):{x:Math.round(this.value(null,1)),y:Math.round(this.value(null,2))},range:this.getRange()};},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);this.element.triggerHandler(n=="slide"?n:"slide"+n,[e,this.ui()],this.options[n]);},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");this.handle.mouse("destroy");this.generated&&this.generated.remove();},enable:function(){this.element.removeClass("ui-slider-disabled");this.disabled=false;},disable:function(){this.element.addClass("ui-slider-disabled");this.disabled=true;},focus:function(handle,hard){this.currentHandle=$(handle).addClass('ui-slider-handle-active');if(hard)
this.currentHandle.parent()[0].focus();},blur:function(handle){$(handle).removeClass('ui-slider-handle-active');if(this.currentHandle&&this.currentHandle[0]==handle){this.previousHandle=this.currentHandle;this.currentHandle=null;};},value:function(handle,axis){if(this.handle.length==1)this.currentHandle=this.handle;if(!axis)axis=this.options.axis=="vertical"?2:1;var value=((parseInt($(handle!=undefined&&handle!==null?this.handle[handle]||handle:this.currentHandle).css(axis==1?"left":"top"),10)/(this.actualSize[axis==1?"width":"height"]-this.handleSize(handle,axis)))*this.options.realMax[axis==1?"x":"y"])+this.options.min[axis==1?"x":"y"];var o=this.options;if(o.stepping[axis==1?"x":"y"]){value=Math.round(value/o.stepping[axis==1?"x":"y"])*o.stepping[axis==1?"x":"y"];}
return value;},convertValue:function(value,axis){if(!axis)axis=this.options.axis=="vertical"?2:1;return this.options.min[axis==1?"x":"y"]+(value/(this.actualSize[axis==1?"width":"height"]-this.handleSize(null,axis)))*this.options.realMax[axis==1?"x":"y"];},translateValue:function(value,axis){if(!axis)axis=this.options.axis=="vertical"?2:1;return((value-this.options.min[axis==1?"x":"y"])/this.options.realMax[axis==1?"x":"y"])*(this.actualSize[axis==1?"width":"height"]-this.handleSize(null,axis));},handleSize:function(handle,axis){if(!axis)axis=this.options.axis=="vertical"?2:1;return $(handle!=undefined&&handle!==null?this.handle[handle]:this.currentHandle)[0][axis==1?"offsetWidth":"offsetHeight"];},click:function(e){var pointer=[e.pageX,e.pageY];var clickedHandle=false;this.handle.each(function(){if(this==e.target)
clickedHandle=true;});if(clickedHandle||this.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(e.pageY-this.offset.top-this.currentHandle.outerHeight()/2),x:this.convertValue(e.pageX-this.offset.left-this.currentHandle.outerWidth()/2)},null,!this.options.distance);},start:function(e,handle){var o=this.options;if(!this.currentHandle)
this.focus(this.previousHandle,true);this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:e.pageY-this.handleOffset.top,left:e.pageX-this.handleOffset.left};this.firstValue=this.value();this.propagate('start',e);return false;},stop:function(e){this.propagate('stop',e);if(this.firstValue!=this.value())
this.propagate('change',e);this.focus(this.currentHandle,true);return false;},oneStep:function(axis){if(!axis)axis=this.options.axis=="vertical"?2:1;return this.options.stepping[axis==1?"x":"y"]?this.options.stepping[axis==1?"x":"y"]:(this.options.realMax[axis==1?"x":"y"]/this.actualSize[axis==1?"width":"height"])*5;},translateRange:function(value,axis){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&value>=this.translateValue(this.value(1),axis))
value=this.translateValue(this.value(1,axis)-this.oneStep(axis),axis);if(this.currentHandle[0]==this.handle[1]&&value<=this.translateValue(this.value(0),axis))
value=this.translateValue(this.value(0,axis)+this.oneStep(axis));}
if(this.options.handles){var handle=this.options.handles[this.handleIndex()];if(value<this.translateValue(handle.min,axis)){value=this.translateValue(handle.min,axis);}else if(value>this.translateValue(handle.max,axis)){value=this.translateValue(handle.max,axis);}}
return value;},handleIndex:function(){return this.handle.index(this.currentHandle[0])},translateLimits:function(value,axis){if(!axis)axis=this.options.axis=="vertical"?2:1;if(value>=this.actualSize[axis==1?"width":"height"]-this.handleSize(null,axis))
value=this.actualSize[axis==1?"width":"height"]-this.handleSize(null,axis);if(value<=0)
value=0;return value;},drag:function(e,handle){var o=this.options;var position={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);position.left=this.translateLimits(position.left,1);position.top=this.translateLimits(position.top,2);if(o.stepping.x){var value=this.convertValue(position.left,1);value=Math.round(value/o.stepping.x)*o.stepping.x;position.left=this.translateValue(value,1);}
if(o.stepping.y){var value=this.convertValue(position.top,2);value=Math.round(value/o.stepping.y)*o.stepping.y;position.top=this.translateValue(value,2);}
position.left=this.translateRange(position.left,1);position.top=this.translateRange(position.top,2);if(o.axis!="vertical")this.currentHandle.css({left:position.left});if(o.axis!="horizontal")this.currentHandle.css({top:position.top});if(this.rangeElement)
this.updateRange();this.propagate('slide',e);return false;},moveTo:function(value,handle,noPropagation){var o=this.options;if(handle==undefined&&!this.currentHandle&&this.handle.length!=1)
return false;if(handle==undefined&&!this.currentHandle)
handle=0;if(handle!=undefined)
this.currentHandle=this.previousHandle=$(this.handle[handle]||handle);if(value.x!==undefined&&value.y!==undefined){var x=value.x;var y=value.y;}else{var x=value,y=value;}
if(x&&x.constructor!=Number){var me=/^\-\=/.test(x),pe=/^\+\=/.test(x);if(me){x=this.value(null,1)-parseInt(x.replace('-=',''),10);}else if(pe){x=this.value(null,1)+parseInt(x.replace('+=',''),10);}}
if(y&&y.constructor!=Number){var me=/^\-\=/.test(y),pe=/^\+\=/.test(y);if(me){y=this.value(null,2)-parseInt(y.replace('-=',''),10);}else if(pe){y=this.value(null,2)+parseInt(y.replace('+=',''),10);}}
if(o.axis!="vertical"&&x){if(o.stepping.x)x=Math.round(x/o.stepping.x)*o.stepping.x;x=this.translateValue(x,1);x=this.translateLimits(x,1);x=this.translateRange(x,1);this.currentHandle.css({left:x});}
if(o.axis!="horizontal"&&y){if(o.stepping.y)y=Math.round(y/o.stepping.y)*o.stepping.y;y=this.translateValue(y,2);y=this.translateLimits(y,2);y=this.translateRange(y,2);this.currentHandle.css({top:y});}
if(this.rangeElement)
this.updateRange();if(!noPropagation){this.propagate('start',null);this.propagate('stop',null);this.propagate('change',null);this.propagate("slide",null);}}});$.ui.slider.getter="value";$.ui.slider.defaults={handle:".ui-slider-handle",distance:1};})(jQuery);