//ui core per jQuery 1.3.2
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},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}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=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)}else{j=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"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
/*
 * jQuery UI Slider @VERSION
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Slider
 *
 * Depends:
 *      ui.core.js
 */

(function(jQuery) {

   
jQuery.widget("ui.slider", jQuery.extend({}, jQuery.ui.mouse, {
   
        _init: function() {
                var self = this, o = this.options;
                this._keySliding = false;
                this._handleIndex = null;
                this._detectOrientation();
                this._mouseInit();
                this.element
                        .addClass("ui-slider"
                                + " ui-slider-" + this.orientation
                                + " ui-widget"
                                + " ui-widget-content"
                                + " ui-corner-all");
                //LG - inizio                 
                var labelsHtml = jQuery(".ui-slider-labels",this.element).children();                
                if(labelsHtml && labelsHtml.length>1){
	                this.options.step=1;
	                this.options.min=1;  
	                this.options.max=labelsHtml.length;
	                
	                var stepDivisor =  labelsHtml.length-1; //(labelsHtml.length > 1) ? (labelsHtml.length-1) : 1;
	                var widthLabel = Math.floor(this.element.outerWidth()/stepDivisor);
	                //widthLabel=widthLabel+5;
	                var heightLabel = labelsHtml.eq(0).css('height');
	                labelsHtml.css('width',widthLabel+'px');
	                labelsHtml.eq(labelsHtml.length-1).css('width',widthLabel+1+'px');
	                labelsHtml.parent().css('width',widthLabel*(this.options.max)+1+'px');
	                labelsHtml.parent().css('margin-left',"-"+Math.floor(widthLabel/2)+'px');
	            }
                //LG - fine
                
                this.range = jQuery([]);                
                if (o.range) {  
                		this.range = jQuery('<div></div>');
                        if (o.range === true) {
                                if (!o.values) o.values = [this._valueMin(), this._valueMin()];
                                if (o.values.length && o.values.length != 2) {
                                            o.values = [o.values[0], o.values[0]];
                                }
                        } 
                        this.range.appendTo(this.element).addClass("ui-slider-range");
                        if (o.range == "min" || o.range == "max") {
                                this.range.addClass("ui-slider-range-" + o.range);
                        }   
                        // note: this isn't the most fittingly semantic framework class for this element,
                        // but worked best visually with a variety of themes                        
                        this.range.addClass("ui-widget-header");
                }

                    if (jQuery(".ui-slider-handle", this.element).length == 0){
                        jQuery('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
                    }
                    if (o.values && o.values.length) {
                        while (jQuery(".ui-slider-handle", this.element).length < o.values.length){
                                jQuery('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
                        }
                    }
   
                    this.handles = jQuery(".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(event) {
                                event.preventDefault();
                            })
                        .hover(function() {
                                    if (!o.disabled) {
                                        jQuery(this).addClass('ui-state-hover');
                                }
                               }, function() {
                                    jQuery(this).removeClass('ui-state-hover');
                               })
                        .focus(function() {
                                if (!o.disabled) {

                                        jQuery(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); jQuery(this).addClass('ui-state-focus');
                                } else {
                                        jQuery(this).blur();
                                    }
                        })
                        .blur(function() {
                                jQuery(this).removeClass('ui-state-focus');
                        });

    
                    this.handles.each(function(i) {
                             jQuery(this).data("index.ui-slider-handle", i);
                    });

   
                    this.handles.keydown(function(event) {   
                            var ret = true;   
                            var index = jQuery(this).data("index.ui-slider-handle");   
                            if (self.options.disabled)
                                     return;   
                            switch (event.keyCode) {
                                    case jQuery.ui.keyCode.HOME:
                                    case jQuery.ui.keyCode.END:
                                    case jQuery.ui.keyCode.UP:
                                    case jQuery.ui.keyCode.RIGHT:
                                    case jQuery.ui.keyCode.DOWN:
                                    case jQuery.ui.keyCode.LEFT:
                                            ret = false;
                                            if (!self._keySliding) {
                                                    self._keySliding = true;
                                                    jQuery(this).addClass("ui-state-active");
                                                    self._start(event, index);
                                            }
                                            break;
                            }
                            var curVal, newVal, step = self._step();
                            if (self.options.values && self.options.values.length) {
                                    curVal = newVal = self.values(index);
                            } else {
                                    curVal = newVal = self.value();
                            }   
                            switch (event.keyCode) {
                                    case jQuery.ui.keyCode.HOME:
                                            newVal = self._valueMin();
                                            break;
                                    case jQuery.ui.keyCode.END:
                                            newVal = self._valueMax();
                                            break;
                                    case jQuery.ui.keyCode.UP:
                                    case jQuery.ui.keyCode.RIGHT:
                                            if(curVal == self._valueMax()) return;
                                            newVal = curVal + step;
                                            break;
                                    case jQuery.ui.keyCode.DOWN:
                                    case jQuery.ui.keyCode.LEFT:
                                            if(curVal == self._valueMin()) return;
                                            newVal = curVal - step;
                                            break;
                             }
                             self._slide(event, index, newVal);
                             return ret;
   
                     }).keyup(function(event) {   
                            var index = jQuery(this).data("index.ui-slider-handle");
   
                            if (self._keySliding) {
                                    self._stop(event, index);
                                    self._change(event, index);
                                    self._keySliding = false;
                                    jQuery(this).removeClass("ui-state-active");
                            }   
                     });
   
                     this._refreshValue();
   
             },
   
             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(event) {
   
                     var o = this.options;
   
                     if (o.disabled)
                            return false;
    
                    this.elementSize = {
                             width: this.element.outerWidth(),
                            height: this.element.outerHeight()

                    };
                     this.elementOffset = this.element.offset();
   
                     var position = { x: event.pageX, y: event.pageY };
                    var normValue = this._normValueFromMouse(position);
   
                     var distance = this._valueMax() - this._valueMin() + 1, closestHandle;
                    var self = this, index;

                    this.handles.each(function(i) {
                             var thisDistance = Math.abs(normValue - self.values(i));
                            if (distance > thisDistance) {
                                    distance = thisDistance;
                                     closestHandle = jQuery(this);
                                    index = i;
                            }
                     });

   
                     // workaround for bug #3736 (if both handles of a range are at 0,
                    // the first is always used as the one with least distance,
                    // and moving it is obviously prevented by preventing negative ranges)
                    if(o.range == true && this.values(1) == o.min) {
                             closestHandle = jQuery(this.handles[++index]);
                    }
   
                    this._start(event, index);
   
                     self._handleIndex = index;
   
                     closestHandle
                            .addClass("ui-state-active")
                            .focus();
                   
                    var offset = closestHandle.offset();

                     var mouseOverHandle = !jQuery(event.target).parents().andSelf().is('.ui-slider-handle');
                    this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
                            left: event.pageX - offset.left - (closestHandle.width() / 2),
                            top: event.pageY - offset.top
                                     - (closestHandle.height() / 2)

                                    - (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
                                    - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
                                    + (parseInt(closestHandle.css('marginTop'),10) || 0)
                     };
   
                     normValue = this._normValueFromMouse(position);

                    this._slide(event, index, normValue);
                    return true;
    
            },
    
            _mouseStart: function(event) {
                     return true;
            },
    
            _mouseDrag: function(event) {

                    var position = { x: event.pageX, y: event.pageY };
                     var normValue = this._normValueFromMouse(position);
                  
                    this._slide(event, this._handleIndex, normValue);
    
                    return false;
    
            },
    
            _mouseStop: function(event) {

    
                    this.handles.removeClass("ui-state-active");
                     this._stop(event, this._handleIndex);
                    this._change(event, this._handleIndex);
                    this._handleIndex = null;
                     this._clickOffset = null;
   
                     return false;
   
             },
          
             _detectOrientation: function() {

                    this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
            },
    
            _normValueFromMouse: function(position) {
    
                    var pixelTotal, pixelMouse;
                     if ('horizontal' == this.orientation) {
                            pixelTotal = this.elementSize.width;

                            pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
                    } else {
                             pixelTotal = this.elementSize.height;

                            pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
                    }
    
                    var percentMouse = (pixelMouse / pixelTotal);

                     if (percentMouse > 1) percentMouse = 1;
                    if (percentMouse < 0) percentMouse = 0;
                    if ('vertical' == this.orientation)
                             percentMouse = 1 - percentMouse;

   
                     var valueTotal = this._valueMax() - this._valueMin(),
                            valueMouse = percentMouse * valueTotal,

                            valueMouseModStep = valueMouse % this.options.step,
                             normValue = this._valueMin() + valueMouse - valueMouseModStep;
   
                    if (valueMouseModStep > (this.options.step / 2))
                             normValue += this.options.step;

   
                     // Since JavaScript has problems with large floats, round
                    // the final value to 5 digits after the decimal point (see #4124)
                    return parseFloat(normValue.toFixed(5));
    
            },
    
            _start: function(event, index) {
                     var uiHash = {
                            handle: this.handles[index],
                            value: this.value()

                     };
                    if (this.options.values && this.options.values.length) {
                            uiHash.value = this.values(index);
                             uiHash.values = this.values();

                    }
                     this._trigger("start", event, uiHash);
            },
    
            _slide: function(event, index, newVal) {
    
                    var handle = this.handles[index];
    
                    if (this.options.values && this.options.values.length) {
   
                            var otherVal = this.values(index ? 0 : 1);
   
                             if ((this.options.values.length == 2 && this.options.range === true) &&
                                     ((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))){
                                     newVal = otherVal;
                            }
    
                            if (newVal != this.values(index)) {
                                     var newValues = this.values();
                                    newValues[index] = newVal;

                                    // A slide can be canceled by returning false from the slide callback
                                    var allowed = this._trigger("slide", event, {
                                             handle: this.handles[index],
                                            value: newVal,
                                            values: newValues
                                     });

                                    var otherVal = this.values(index ? 0 : 1);
                                    if (allowed !== false) {
                                             this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
                                    }
                            }
    
                    } else {    
                            if (newVal != this.value()) {
                                    // A slide can be canceled by returning false from the slide callback
                                    var allowed = this._trigger("slide", event, {
                                            handle: this.handles[index],
                                             value: newVal
                                    });
                                    if (allowed !== false) {
                                             this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
                                    }
                                          
                             }
   
                     }
   
             },
   
             _stop: function(event, index) {
                    var uiHash = {
                             handle: this.handles[index],
                            value: this.value()

                    };
                     if (this.options.values && this.options.values.length) {
                            uiHash.value = this.values(index);
                            uiHash.values = this.values();

                     }
                    this._trigger("stop", event, uiHash);
            },
   
            _change: function(event, index) {
                     var uiHash = {
                            handle: this.handles[index],
                            value: this.value()

                     };
                    if (this.options.values && this.options.values.length) {
                            uiHash.value = this.values(index);
                             uiHash.values = this.values();

                    }
                     this._trigger("change", event, uiHash);
            },
    
            value: function(newValue) {    
                    if (arguments.length) {
                            this._setData("value", newValue);
                            this._change(null, 0);
                    }    
                    return this._value();   
            },
    
            values: function(index, newValue, animated, noPropagation) {    
                    if (arguments.length > 1) {
                            this.options.values[index] = newValue;
                            this._refreshValue(animated);

                            if(!noPropagation) this._change(null, index);
                    }
                    if (arguments.length) {
                            if (this.options.values && this.options.values.length) {
                                    return this._values(index);
                            } else {
                                    return this.value();
                            }
                    } else {
                            return this._values();
                    }   
             },  
             _setData: function(key, value, animated) {
   
                     jQuery.widget.prototype._setData.apply(this, arguments);
   
                     switch (key) {
                            case 'disabled':
                                    if (value) {
                                            this.handles.filter(".ui-state-focus").blur();
                                            this.handles.removeClass("ui-state-hover");
                                            this.handles.attr("disabled", "disabled");
                                    } else {
                                             this.handles.removeAttr("disabled");
                                    }
                            case 'orientation':    
                                    this._detectOrientation();                                   
                                    this.element
                                            .removeClass("ui-slider-horizontal ui-slider-vertical")
                                            .addClass("ui-slider-" + this.orientation);
                                    this._refreshValue(animated);
                                    break;
                             case 'value':
                                    this._refreshValue(animated);
                                    break;
                     }
   
             },
   
             _step: function() {
                    var step = this.options.step;
                    return step;
            },
    
            _value: function() {    
                    var val = this.options.value;
                    if (val < this._valueMin()) val = this._valueMin();
                    if (val > this._valueMax()) val = this._valueMax();
                    return val;   
             },
   
             _values: function(index) {   
                     if (arguments.length) {
                            var val = this.options.values[index];
                            if (val < this._valueMin()) val = this._valueMin();
                            if (val > this._valueMax()) val = this._valueMax();   
                            return val;
                     } else {
                            // .slice() creates a copy of the array
                            // this prevents outside manipulation of the internal state
                             return this.options.values.slice();
                    }   
            },
            
            _valueMin: function() {
                     var valueMin = this.options.min;
                     return valueMin;
            },
    
            _valueMax: function() {
                    var valueMax = this.options.max;
                    return valueMax;
            },
   
            _refreshValue: function(animate) {    
                    var oRange = this.options.range, o = this.options, self = this;   
                    if (this.options.values && this.options.values.length) {
                            var vp0, vp1;
                            this.handles.each(function(i, j) {
                                    var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
                                    var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
                                    jQuery(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
                                    if (self.options.range === true) {
                                             if (self.orientation == 'horizontal') {
                                                    (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
                                                    (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
                                            } else {

                                                    (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
                                                    (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
                                            }
                                    }
                                    lastValPercent = valPercent;
                            });
                    } else {
                            var value = this.value(),
                            valueMin = this._valueMin(),
                            valueMax = this._valueMax(),
                            valPercent = valueMax != valueMin  ? (value - valueMin) / (valueMax - valueMin) * 100  : 0;

                            var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
                            this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
                            //LG - inizio
                            var labelsHtml = jQuery(".ui-slider-labels",self.element).children();
                            var markersel = (oRange != "max") ? o.markerselected :  o.marker;
                        	var marker = (oRange != "max") ? o.marker : o.markerselected;
                            for(var i=1;i<=labelsHtml.length;i++){
                            	//if ((oRange!='false' && i<=value) || (oRange=='false' && i=value)){                            		 
                            	if (!oRange || oRange=='false'){
                            		if (i==value){
                                		if (markersel)	labelsHtml.eq(i-1).css('background-image',"url('"+markersel+"')");
                                	}
                                	else{
                                		if (marker)	labelsHtml.eq(i-1).css('background-image',"url('"+marker+"')");
                                	}
                            	}else{
	                            	if (i<=value){
	                            		if (markersel)	labelsHtml.eq(i-1).css('background-image',"url('"+markersel+"')");
	                            	}
	                            	else{
	                            		if (marker)	labelsHtml.eq(i-1).css('background-image',"url('"+marker+"')");
	                            	}
                            	}
                            }
                            //LG - fine
                            (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
                            (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
                            (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
                            (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });                          
                    }  
                    //LG
                    if (o.input!=false){
                    	jQuery(o.input).val(value);
                    }                               
            }     
                    
    }));
    
    jQuery.extend(jQuery.ui.slider, {
            version: "@VERSION",
            eventPrefix: "slide",
            defaults: jQuery.extend({}, jQuery.ui.mouse.defaults, {
                    animate: false,
                    distance: 0,
                    max: 100,
                    min: 0,
                    orientation: 'horizontal',
                    range: false,
                    step: 1,
                    value: 0,
                    values: null,
                    markerselected: 'images/slider-step.gif',
                    marker: 'images/slider-step-next.gif',
                    input: false
             })
    });
    
})(jQuery);
