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