/*
Sony Style Endeca Slider
AUTHOR: Jonathan Cheung | Sr. Flash Developer
===================================================================================================================================================================
// !  * 

	Pre-requisites: Scriptaculous Slider (Control.Slider class)

	Functions:
	initialize: constructor
	updateBarPosition: function to update the highlight between the 2 end points with the blue bar 
// ===================================================================================================================================================================
*/
var SonyStylePriceSlider = Class.create(Control.Slider, {
	//Set timeout
	timeOutInterval: 2, //Seconds
	timerVar: null,
	initialize:function($super, handle, track, options){
		$super(handle, track, options);
		this.updateBarPosition();
	},
	updateBarPosition:function(){
    	var sliderKnobOneValue = this.handles[0].style.left.toString().substring(0,this.handles[0].style.left.length-2);
    	var sliderKnobTwoValue = this.handles[1].style.left.toString().substring(0,this.handles[1].style.left.length-2);
  		var sliderWidth = Math.abs(sliderKnobTwoValue-sliderKnobOneValue);
      	
      	var leftPosition =  (sliderKnobTwoValue > sliderKnobOneValue)? sliderKnobOneValue:sliderKnobTwoValue;
   		this.track.select('.sliderBar')[0].setStyle({
 			width: sliderWidth+"px",
 			left: this.handles[0].style.left
   		});	
  	},
  	
	stripPX: function (styleString){
	   	styleString = styleString.substring(0,styleString.length-2);
	   	return Number(styleString);
	}
});
