if (!Bs_Objects) {var Bs_Objects = [];};


function alc_slider2Way(theFieldnamePrefix) {
  
  this._objectId;
	
  
	this.fieldName;
	
	
	this._disabled = false;	

	
  this.direction       = 0;
	
	
  this.width           = 100;
	
	
  this.height          = 20;
	
	
  this.minVal          = 00;
	
	
  this.maxVal          = 100000;

        
 this.minSeparation          = 8;
	
	
  this.valueDefault      = [00,00];
	
	
  this.arrowAmount     = 1;
	
	
	this.arrowMouseOver = false;
	
	
	this.arrowKeepFiringTimeout = 10;
	
	
	this._stopFireArrowFlag = false;
  
	
	this.wheelAmount = 5;
	
	
  
  this.colorbar;
  
	
  this.baseZindex      = 50;
	
	
	this.moveX = 0;
	
	
	this.moveY = 0;
  
	
  this.imgBasePath;

	
  this.imgDir  = site_image_url;
	
	
  this._bgImgSrc;
		
	
  this._bgImgRepeat;
  
	
	this._bgImgCssStyle;
	
	
	
  this._bgImgLeftSrc;
	
	
  this._bgImgLeftWidth;
	
	
  this._bgImgLeftHeight;
	
	
  this._bgImgRightSrc;
	
	
  this._bgImgRightWidth;
	
	
  this._bgImgRightHeight;
	
	
	
  this._sliderImgSrc;
	
	
  this._sliderImgWidth;

	
	
  this._sliderImgHeight;
    
	
  this.styleContainerClass='font6s';
	

  this.styleValueFieldClass = 'font6s';
	
	
  this.styleValueTextClass  = 'font6s';
  
	
  this.bgColor;	
	
	
  this._arrowIconLeftSrc;
  
	
  this._arrowIconLeftWidth   = 0;
  
	
  this._arrowIconLeftHeight  = 0;
  
	
  this._arrowIconLeftCssStyle  = 0;

	
  this._arrowIconRightSrc;
  
	
  this._arrowIconRightWidth  = 0;
  
	
  this._arrowIconRightHeight = 0;
    
	
  this._arrowIconRightCssStyle  = 0;
	
  
  this.valueInterval   = 1;
  
  
  this.useInputField = 2;
  
  
  this.inputTextFieldEvent = 'over';
  
  
  this.ctrl = new Array(2);
  
  
  this._valueInternal = new Array(2);

  
  this._display         = 2;

  

  this._arrowLeftContainerId;
  this._arrowLeftContainerObj;
  this._arrowLeftIconId;
  this._arrowLeftIconObj;
  
  this._arrowRightContainerId;
  this._arrowRightContainerObj;
  this._arrowRightIconId;
  this._arrowRightIconObj;
	
  this._valueContainerId;
	this._valueContainerObj;

  this._handleId;
  this._handleObj = new Array(2);
  this._valueFieldId;
  this._valueFieldObj;
  this._valueTextId;
  this._valueTextObj;
  this._slideBarId;
  this._slideBarObj;
  this._colorbarId;
  this._colorbarObj;
  
  
  
  this._posUpperLeftX;
  this._posUpperLeftY;
  this._posSlideStart;
  this._posSlideEnd;
  
  
  
  this._slideWidth;
  
  
  
  
  
  this._attachedEvents;
  this.eventOnChange;
  this.slideStartCB;
  this.slideMoveCB;
  this.slideEndCB;
  
  
	
	this._constructor = function(theFieldnamePrefix) {
  	
    this._id = Bs_Objects.length;
    Bs_Objects[this._id] = this; 
    this._objectId = "Bs_Slider2_"+this._id;
    
    this.objectName = this._objectId;
    
    
    if (typeof(theFieldnamePrefix) == 'string') {
      this.fieldName = theFieldnamePrefix + '_value';  
       this.objectName = theFieldnamePrefix;
    }
  }
   
  
  this._checkup = function() {
    if (typeof(this.minVal)     == 'undefined') this.minVal     = 0;
    if (typeof(this.maxVal)     == 'undefined') this.maxVal     = 10;
    if (typeof(this.valueDefault) == 'undefined') this.valueDefault = [this.minVal, this.minVal];
    this._valueInternal = this.valueDefault;
    
    if (typeof(this.imgBasePath) == 'string')  this.imgDir = this.imgBasePath;
  }
  
	

	
	
  this.render = function(tagId) {

    this._checkup();
    
    this._containerId           = 'co'   + tagId;
    this._handleId              = 'po'   + tagId;
    this._arrowLeftContainerId  = 'alc'  + tagId;
    this._arrowLeftIconId       = 'ali'  + tagId;
    this._arrowRightContainerId = 'arc'  + tagId;
    this._arrowRightIconId      = 'ari'  + tagId;
    this._valueContainerId      = 'vc'   + tagId;
    this._valueFieldId          = 'vf'   + tagId;
    if (typeof(this.fieldName) == 'undefined') this.fieldName = tagId + '_value';
    this._valueTextId           = 'vt'   + tagId;
    this._slideBarId            = 'bar'  + tagId;
    this._colorbarId            = 'cb'   + tagId;
    
    var divWidth      = this.width; 
    var divHeight     = this.height;
    
    
    var out         = new Array();
    var outI        = 0;
    var localOffset = 0;
    
    
    out[outI++] = '<div id="' + this._containerId + '"';
    if (this.styleContainerClass) {
      out[outI++] = ' class="' + this.styleContainerClass + '"';
    }
    out[outI++] = ' style="position:relative;';
    if (this._display == 0) {
      out[outI++] = ' display:none;';
    } else if (this._display == 1) {
      out[outI++] = ' visibility:hidden;';
    }
    out[outI++] = ' onmousewheel="Bs_Objects['+this._id+'].onMouseWheel(); return false;"';
    out[outI++] = '">';
    
		out[outI++] = '<div';
    out[outI++] = ' onmousewheel="Bs_Objects['+this._id+'].onMouseWheel(); return false;"';
		out[outI++] = ' style="position:absolute; left:' + this.moveX + '; top:' + this.moveY + ';">';
		
		
    out[outI++] = '<div style="position:absolute; display:none; z-index:75;" id="' + this._handleId  + '0' + '">';
    
	//set left Arrow icon
	out[outI++] = '<img name="bsslidericonname0" src="'+site_image_url+'YT_drag.jpg" border=0 width=' + this._sliderImgWidth + ' height=' + this._sliderImgHeight + '>';
    out[outI++] = '</div>';

   out[outI++] = '<div style="position:absolute; display:none; z-index:75;" id="' + this._handleId + '1' +  '">';
	
	//ser right Arrow icon
    out[outI++] = '<img name="bsslidericonname1" src="'+site_image_url+'YT_drag.jpg" border=0 width=' + this._sliderImgWidth + ' height=' + this._sliderImgHeight + '>';
    out[outI++] = '</div>';
    
    
    if ((this.arrowAmount > 0) && this._arrowIconLeftSrc) {
      out[outI++] = '<div id="' + this._arrowLeftContainerId + '" style="position:absolute; left:' + localOffset + '; top:0;">';
			out[outI++] = '<a href="javascript:void(false);"';
			if (this.arrowMouseOver) {
				out[outI++] = ' onMouseOver="Bs_Objects['+this._id+'].onChangeByArrow(false, true); return false;"';
				out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
			} else {
				
				
				
				out[outI++] = ' onMouseDown="Bs_Objects['+this._id+'].onChangeByArrow(false, true); return false;"';
				out[outI++] = ' onMouseUp="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
				out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
			}
			out[outI++] = '>';
			out[outI++] = '<img id="' + this._arrowLeftIconId + '" src="' + this.imgDir + this._arrowIconLeftSrc + '" border="0" width="' + this._arrowIconLeftWidth + '" height="' + this._arrowIconLeftHeight + '"';
			if (typeof(this.arrowIconLeftCssStyle) != 'undefined') {
				out[outI++] = ' style="' + this.arrowIconLeftCssStyle + '"';
			}
			out[outI++] = '>';
			out[outI++] = '</a></div>';
      localOffset += this._arrowIconLeftWidth;
    }
    
		
		if (typeof(this._bgImgLeftSrc) != 'undefined') {
			var tmpLeft = (this.direction == 0) ? localOffset : 0;
			var tmpTop  = (this.direction == 0) ? 0           : localOffset;
			out[outI++] = '<div style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + ';">';
			out[outI++] = '<img src="' + this.imgDir + this._bgImgLeftSrc + '" width="' + this._bgImgLeftWidth + '" height="' + this._bgImgLeftHeight + '" border="0">';
			out[outI++] = '</div>';
			localOffset += (this.direction == 0) ? this._bgImgLeftWidth : this._bgImgLeftHeight;
		}
		
  
    if (this.colorbar) {
      out[outI++] = '<div id="' + this._colorbarId + '" onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"';
	 // out[outI++] = '<div id="' + this._colorbarId + '" ';
	  
      if (this.colorbar['cssClass']) {
        out[outI++] = ' class="' + this.colorbar['cssClass'] + '"';
      }
      out[outI++] = ' style="position:absolute; z-index:70; width:0;';
      if ('undefined' != typeof(this.colorbar['color'])) {
        out[outI++] = ' background-color:' + this.colorbar['color'] + ';';
      } else if ('undefined' == typeof(this.colorbar['cssClass'])) {
        out[outI++] = ' background-color:red;';
      }
      if ('undefined' != typeof(this.colorbar['offsetLeft'])) {
        out[outI++] = ' left:' + (localOffset + this.colorbar['offsetLeft']) + ';';
      }
      if ('undefined' != typeof(this.colorbar['offsetTop'])) {
        out[outI++] = ' top:' + this.colorbar['offsetTop'] + ';';
      }
      if ('undefined' != typeof(this.colorbar['height'])) {
        out[outI++] = ' height:' + this.colorbar['height'] + ';';
      }
      out[outI++] = '">';
      out[outI++] = '<img src="'+site_image_url+'spacer.gif" width="1" height="2"></div>';
    }


	
/*
//for color bar	
if (this.colorbar) 
	{
out[outI++] = '<div id="' + this._colorbarId + '" ';
//onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"
if (this.colorbar['cssClass']) {
out[outI++] = ' class="' + this.colorbar['cssClass'] + '"';
}
out[outI++] = ' style="position:absolute; z-index:40; width:0;';
if ('undefined' != typeof(this.colorbar['color'])) {
out[outI++] = ' background-color:' + this.colorbar['color'] + ';';
} 
else if ('undefined' == typeof(this.colorbar['cssClass'])) {
out[outI++] = ' background-color:orange;';}
if ('undefined' != typeof(this.colorbar['offsetLeft'])) {
out[outI++] = ' left:' + (localOffset + this.colorbar['offsetLeft']) + ';';}
if ('undefined' != typeof(this.colorbar['offsetTop'])) {
out[outI++] = ' top:' + this.colorbar['offsetTop'] + ';';
}
if ('undefined' != typeof(this.colorbar['height'])) {
out[outI++] = ' height:' + this.colorbar['height'] + ';';
}
out[outI++] = '">';
out[outI++] = '<img src="/images/spacer.gif" width="1" height="2"></div>';
}

    
//end for color bar


*/
		
    
   out[outI++] = '<div id="' + this._slideBarId + '" onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"';
	//out[outI++] = '<div id="' + this._slideBarId + '" ';
		
		var tmpLeft = (this.direction == 0) ? localOffset : 0;
		var tmpTop  = (this.direction == 0) ? 0           : localOffset;
		out[outI++] = ' style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + '; width:' + divWidth + '; height: ' + divHeight + '; clip:rect(0 ' + divWidth + '  ' + divHeight + ' 0);';
		
    if (this.bgColor) {
      out[outI++] = 'background-color:' + this.bgColor + '; layer-background-color:' + this.bgColor + ';';
    }
    if (this._bgImgSrc) {
      out[outI++] = ' background-image: url(' + this.imgDir + this._bgImgSrc + '); background-repeat:' + this._bgImgRepeat + ';';
    }
		if (this._bgImgCssStyle) {
	    out[outI++] = this._bgImgCssStyle;
		}
    out[outI++] = '"></div>';
		
    localOffset += (this.direction == 0) ? this.width : this.height;
    
		
		
		if (typeof(this._bgImgRightSrc) != 'undefined') {
			var tmpLeft = (this.direction == 0) ? localOffset : 0;
			var tmpTop  = (this.direction == 0) ? 0           : localOffset;
			out[outI++] = '<div style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + ';">';
			out[outI++] = '<img src="' + this.imgDir + this._bgImgRightSrc + '" width="' + this._bgImgRightWidth + '" height="' + this._bgImgRightHeight + '" border="0">';
			out[outI++] = '</div>';
			localOffset += (this.direction == 0) ? this._bgImgRightWidth : this._bgImgRightHeight;
		}
		
    
    if ((this.arrowAmount > 0) && this._arrowIconRightSrc) {
			var tmpLeft = (this.direction == 0) ? localOffset : 0;
			var tmpTop  = (this.direction == 0) ? 0           : localOffset;
      out[outI++] = '<div id="' + this._arrowRightContainerId + '" style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + ';">';
			out[outI++] = '<a href="javascript:void(false);"';
			if (this.arrowMouseOver) {
				out[outI++] = ' onMouseOver="Bs_Objects['+this._id+'].onChangeByArrow(true, true); return false;"';
				out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
			} else {
				
				
				
				out[outI++] = ' onMouseDown="Bs_Objects['+this._id+'].onChangeByArrow(true, true); return false;"';
				out[outI++] = ' onMouseUp="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
				out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';
			}
			out[outI++] = '>';
			out[outI++] = '<img id="' + this._arrowRightIconId + '" src="' + this.imgDir + this._arrowIconRightSrc + '" border="0" width="' + this._arrowIconRightWidth + '" height="' + this._arrowIconRightHeight + '"';
			if (typeof(this.arrowIconRightCssStyle) != 'undefined') {
				out[outI++] = ' style="' + this.arrowIconRightCssStyle + '"';
			}
			out[outI++] = '>';
			out[outI++] = '</a></div>';
      localOffset += this._arrowIconRightWidth;
    }
    
    
    var styleValueFieldClass = (this.styleValueFieldClass) ? ' class="' + this.styleValueFieldClass + '"' : '';
    var styleValueTextClass  = (this.styleValueTextClass)  ? ' class="' + this.styleValueTextClass  + '"' : '';
    out[outI++] = '<div id="' + this._valueContainerId + '" style="position:absolute; left:' + localOffset + '; top:0px;">';
    if (this.useInputField == 1) {
      
      out[outI++] = '<span' + styleValueTextClass + ' id="' + this._valueTextId + '">' + this.valueDefault  + '</span>';
      out[outI++] = '<input type="hidden" name="' + this.fieldName + '" id="' + this._valueFieldId + '" value="' + this.valueDefault + '">';
    } else if (this.useInputField == 2) {
      
      out[outI++] = '<input type="hidden"' + styleValueFieldClass + ' onMouseOver="bsFormFieldSetFocusAndSelect(this, false);" name="' + this.fieldName + '" id="' + this._valueFieldId + '" value="' + this.valueDefault + '" size="2"';
      if (styleValueFieldClass == '') { 
        out[outI++] = ' style="vertical-align:text-top; width:30; height:' + this.height + ';"';
      }
      out[outI++] = ' onKeyUp="Bs_Objects['+this._id+'].onChangeByInput(this.value, false);" onBlur="Bs_Objects['+this._id+'].onChangeByInput(this.value, true);">';
    } else if (this.useInputField == 3) {
      
      out[outI++] = '<input type="text"' + styleValueFieldClass + ' onMouseOver="bsFormFieldSetFocusAndSelect(this, false);" name="' + this.fieldName + '" id="' + this._valueFieldId + '" value="' + this.valueDefault + '" size="2"';
      if (styleValueFieldClass == '') { 
        out[outI++] = ' style="display:none; vertical-align:text-top; width:30; height:' + this.height + ';"';
      } else {
        out[outI++] = ' style="display:none;"';
      }
      out[outI++] = ' onKeyUp="Bs_Objects['+this._id+'].onChangeByInput(this.value, false);" onBlur="var _bss = Bs_Objects['+this._id+']; _bss.onChangeByInput(this.value, true); _bss.textboxEdit(false)">';
      out[outI++] = '<span' + styleValueTextClass + ' style="" id="' + this._valueTextId   + '" ';
      if (this.inputTextFieldEvent == 'click') {
        out[outI++] = 'onClick="Bs_Objects['+this._id+'].textboxEdit(true);"';
      } else {
        out[outI++] = 'onMouseOver="Bs_Objects['+this._id+'].textboxEdit(true);"';
      }
      out[outI++] = '>' + this.valueDefault  + '</span>';
    } else { 
      out[outI++] = '<input type="text" name="' + this.fieldName + '" id="' + this._valueFieldId + '" value="' + this.valueDefault.join(",") + '">';
    }
    out[outI++] = '</div>';
    
		out[outI++] = '</div>';
    
    
    out[outI++] = '</div>';
    document.getElementById(tagId).innerHTML = out.join('');
    this._containerObj           = document.getElementById(this._containerId);
    this._handleObj[0]           = document.getElementById(this._handleId + '0');
    this._handleObj[1]           = document.getElementById(this._handleId + '1');
    this._valueContainerObj      = document.getElementById(this._valueContainerId);
    this._arrowLeftContainerObj  = document.getElementById(this._arrowLeftContainerId);
    this._arrowLeftIconObj       = document.getElementById(this._arrowLeftIconId);
    this._arrowRightContainerObj = document.getElementById(this._arrowRightContainerId);
    this._arrowRightIconObj      = document.getElementById(this._arrowRightIconId);
    this._valueFieldObj          = document.getElementById(this._valueFieldId);
    this._valueTextObj           = document.getElementById(this._valueTextId);
    this._slideBarObj            = document.getElementById(this._slideBarId);
    this._colorbarObj            = document.getElementById(this._colorbarId);
    
    this._posSlideStart = (this.direction == 0) ? getDivLeft(this._slideBarObj) : getDivTop(this._slideBarObj);
    this._slideWidth    = (this.direction == 0) ? this.width - this._sliderImgWidth : this.height - this._sliderImgHeight;
    this._posSlideEnd   = this._posSlideStart + this._slideWidth;
    
    this._currentRelSliderPosX = [this._posSlideStart, this._posSlideStart];

    
    if ((this.valueDefault[0] > this.minVal) || (this.valueDefault[1] > this.minVal)) {
      //alert(this.valueDefault[0] + " -- " + this.minVal);
	  //alert(this.valueDefault[1] + " -- " + this.minVal);
      var hundertPercent = this.maxVal - this.minVal;
      var myPercent0      = (this.valueDefault[0]-this.minVal) * 100 / hundertPercent;
      var myPercent1      = (this.valueDefault[1]-this.minVal) * 100 / hundertPercent;
      
      //alert(myPercent0 + " -- " + myPercent1);
	  this._currentRelSliderPosX[0] += (myPercent0 * this._slideWidth / 100);
       this._currentRelSliderPosX[1] += (myPercent1 * this._slideWidth / 100);
      this._updateColorbar(this._currentRelSliderPosX);
    }
    if (this.direction == 0) {
        this._handleObj[0].style.left = this._currentRelSliderPosX[0];
        this._handleObj[1].style.left = this._currentRelSliderPosX[1];
    } else {
        alert('Not implemented');
        this._handleObj.style.top  = this._currentRelSliderPosX;
    }
    this._handleObj[0].style.display = 'block';
    this._handleObj[1].style.display = 'block';

    
    temp = ech_attachMouseDrag(this._handleObj[0],this.slideStart,null,this.slideMove,null,this.slideEnd,null,null,null);
    temp = temp.linkCtrl(getDivImage('','bsslidericonname0'));
    this.ctrl[0]           = temp;
    this.ctrl[0].num       = 0;
    this.ctrl[0].sliderObj = this; 

    temp = ech_attachMouseDrag(this._handleObj[1],this.slideStart,null,this.slideMove,null,this.slideEnd,null,null,null);
    temp = temp.linkCtrl(getDivImage('','bsslidericonname1'));
    this.ctrl[1]           = temp;
    this.ctrl[1].num       = 1;
    this.ctrl[1].sliderObj = this; 
		
    var x = getDivLeft(this._handleObj[0]);
    var y = getDivTop(this._handleObj[0]);
    y = 0; 
    
    
    
    if (this.direction == 0) {   
      this.ctrl[0].minX = this._posSlideStart;
      this.ctrl[0].maxX = this._posSlideEnd;
      this.ctrl[0].minY = y;
      this.ctrl[0].maxY = y;
      this.ctrl[1].minX = this._posSlideStart;
      this.ctrl[1].maxX = this._posSlideEnd;
      this.ctrl[1].minY = y;
      this.ctrl[1].maxY = y;
    }


  }
  
  
  
  this.drawInto = function(tagId) {
    this.render(tagId);
		if (this._disabled) this.setDisabled(true);
  }
  
  
  this.draw = function(tagId) {
    this.render(tagId);
		if (this._disabled) this.setDisabled(true);    
  }

  
  this.attachEvent = function(trigger, yourEvent) {
    if (typeof(this._attachedEvents) == 'undefined') {
      this._attachedEvents = new Array();
    }
    
    if (typeof(this._attachedEvents[trigger]) == 'undefined') {
      this._attachedEvents[trigger] = new Array(yourEvent);
    } else {
      this._attachedEvents[trigger][this._attachedEvents[trigger].length] = yourEvent;
    }
  }
  
  
  this.hasEventAttached = function(trigger) {
    return (this._attachedEvents && this._attachedEvents[trigger]);
  }
  
  
  this.fireEvent = function(trigger) {
    if (this._attachedEvents && this._attachedEvents[trigger]) {
      var e = this._attachedEvents[trigger];
      if ((typeof(e) == 'string') || (typeof(e) == 'function')) {
        e = new Array(e);
      }
      for (var i=0; i<e.length; i++) {
        if (typeof(e[i]) == 'function') {
          e[i](this);
        } else if (typeof(e[i]) == 'string') {
          eval(e[i]);
        } 
      }
    }
  }
  
  
  
  this.attachOnChange = function(functionName) {
    this.eventOnChange = functionName;
  }

  this.attachOnSlideStart = function(functionName) {
    this.slideStartCB = functionName;
  }
  this.attachOnSlideMove = function(functionName) {
    this.slideMoveCB = functionName;
  }
  this.attachOnSlideEnd = function(functionName) {
    this.slideEndCB = functionName;
  }
  
    
  
  this.attachOnArrow = function(functionName) {
    this.eventOnArrow = functionName;
  }
  this.attachOnInputChange = function(functionName) {
    this.eventOnInputChange = functionName;
  }
  this.attachOnInputBlur = function(functionName) {
    this.eventOnInputBlur = functionName;
  }
  
  
	
  
  this.setSliderIcon = function(imgName, width, height) {
    this._sliderImgSrc    = imgName;
    this._sliderImgWidth  = width;
    this._sliderImgHeight = height;
  }
  
	
  this.setArrowIconLeft = function(imgName, width, height) {
    this._arrowIconLeftSrc    = imgName;
    this._arrowIconLeftWidth  = width;
    this._arrowIconLeftHeight = height;
  }
	
	
  this.setArrowIconRight = function(imgName, width, height) {
    this._arrowIconRightSrc    = imgName;
    this._arrowIconRightWidth  = width;
    this._arrowIconRightHeight = height;
  }
  
  
  this.setBackgroundImage = function(src, repeat, cssStyle) {
    this._bgImgSrc        = src;
    this._bgImgRepeat     = repeat;
		this._bgImgCssStyle   = cssStyle;
  }
	
  
  this.setBackgroundImageLeft = function(imgName, width, height) {
    this._bgImgLeftSrc    = imgName;
    this._bgImgLeftWidth  = width;
    this._bgImgLeftHeight = height;
  }
	
  
  this.setBackgroundImageRight = function(imgName, width, height) {
    this._bgImgRightSrc    = imgName;
    this._bgImgRightWidth  = width;
    this._bgImgRightHeight = height;
  }
	
  
  
  this.setDisplay = function(display) {
    this._display = display;
    if (this._containerObj) {
      switch (display) {
        case 0:
          this._containerObj.style.display = 'none';
          break;
        case 1:
          this._containerObj.style.visibility = 'hidden';
          break;
        case 2:
          
          this._containerObj.style.visibility = 'visible';
          this._containerObj.style.display = 'block';
          break;
        default: 
          
      }
    }
  }
  
	this.setDisabled = function(b) {
		if (typeof(b) == 'undefined') b = !this._disabled;
		
		if (b) {
			
			
			
			var filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayScale=1); progid:DXImageTransform.Microsoft.BasicImage(opacity=.5)';
			var cursor = 'default';
		} else {
			var filter = null;
			var cursor = 'hand'; 
		}
		
			var t = new Array(
				this._containerId, this._arrowLeftContainerId, this._arrowRightContainerId, 
				this._valueFieldId, this._valueTextId, 
				this._slideBarId, this._colorbarId, this._handleId + '0', this._handleId + '1'
			); 
			for (var i=0; i<t.length; i++) {
				var elm = document.getElementById(t[i]);
				if (elm != null) elm.style.filter = filter;
			}
			var elm = document.getElementById(this._arrowLeftIconId);
			if (elm != null) elm.style.cursor = cursor;
			
			var elm = document.getElementById(this._arrowRightIconId);
			if (elm != null) elm.style.cursor = cursor;
			
			var elm = document.getElementById(this._valueFieldId);
			if (elm != null) elm.disabled = b;
			
		
		
		
		this._disabled = b;
	}
  
  
  this.getValue = function() {
    return this._valueInternal;
  }
  

this.getValueInPercent = function() {
        var retVal = new Array(2);
        var range   = Math.abs(this.maxVal - this.minVal);
        retVal[0] = this._valueInternal[0] / range * 100;
        retVal[1] = this._valueInternal[1] / range * 100;
        return retVal;
}
	
	
  
  this.getSliderPos = function() {
    var absLeng0 = getDivLeft(this.ctrl[0].div) - this.ctrl[0].minX;
     var absLeng1 = getDivLeft(this.ctrl[1].div) - this.ctrl[1].minX;
    var absRang = this.maxVal - this.minVal;
    
    return [(absLeng0 * absRang/this._slideWidth) + this.minVal, (absLeng1 * absRang/this._slideWidth) + this.minVal];
  }

    
  
  this.onChangeBySlide = function(ctrl) {
    if (this._disabled) return;
    var newPos = this._getNewLocationFromCursor(ctrl.num);
    var val = this._getValueByPosition(newPos);
    val     = this._roundToGrid(val);
    if (val != this._valueInternal[ctrl.num]) {
      this._valueInternal[ctrl.num] = val;
      this.updateHandle(newPos, ctrl.num);
      this.updateValueField(this._valueInternal);
      this.updateValueText(this._valueInternal);
      this._updateColorbar(newPos);
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, val, newPos, true);
      this.fireEvent('onChange');
    }
  }
  
  
  this.onChangeByClick = function(event) {
    if (this._disabled) return;
    var newPos = 0;
    if ('undefined' != typeof(event.offsetX)) {
      newPos = (this.direction == 0) ? event.offsetX + this._posSlideStart : event.offsetY + this._posSlideStart;
    } else if ('undefined' != typeof(event.layerX)) {
      newPos = (this.direction == 0) ? event.layerX + this._posSlideStart  : event.layerY  + this._posSlideStart;
    } else {
      return; 
    }

    
    var val = this._getValueByPosition(newPos);
    val     = this._roundToGrid(val);
    if (val != this._valueInternal[0] && val != this._valueInternal[1]) {
      var index = (Math.abs(this._currentRelSliderPosX[0] - newPos) <= Math.abs(this._currentRelSliderPosX[1] - newPos)) ? 0 : 1;
      this._valueInternal[index] = val;
      this.updateHandle(newPos, index);
      this.updateValueField(this._valueInternal);
      this.updateValueText(this._valueInternal);
      this._updateColorbar(newPos);
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, val, newPos, false);
      this.fireEvent('onChange');
    }
  }
  
  
  this.onChangeByInput = function(val, isBlur) {
    if (this._disabled) return;
    if (val == '') {
      val = this.minVal;
    }
    val = this._roundToGrid(val);
    var newPos = this._getPositionByValue(val);
    if (val != this._valueInternal) {
      this._valueInternal = val;
      this.updateHandle(newPos);
      this._updateColorbar(newPos);
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, val, newPos, false);
      this.fireEvent('onChange');
      if (isBlur) { 
        this.updateValueField(val);
        this.updateValueText(val);
      }
    } else if (isBlur) {
      
      
      this.updateValueField(val);
      this.updateValueText(val);
    }
  }
  
  
  this.onChangeByArrow = function(leftOrRight, keepFiring, loopCall) {
		if (!loopCall) this._stopFireArrowFlag = false;
		
		if (this._stopFireArrowFlag) return;
    if (this._disabled) return;
		
    var val = parseFloat(this._valueInternal);
    if (leftOrRight) {
      val += this.arrowAmount; 
    } else {
      val -= this.arrowAmount; 
    }
    val = this._roundToGrid(val);
    if (val != this._valueInternal) {
      this._valueInternal = val;
      var newPos = this._getPositionByValue(val);
      this.updateHandle(newPos);
      this.updateValueField(val);
      this.updateValueText(val);
      this._updateColorbar(newPos);
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, val, newPos, false);
      this.fireEvent('onChange');
    }
		
		if (keepFiring) {
			if (!this._stopFireArrowFlag && (this.arrowKeepFiringTimeout > 0)) {
				setTimeout('Bs_Objects[' + this._id + '].onChangeByArrow(' + leftOrRight + ', ' + keepFiring + ', true);', this.arrowKeepFiringTimeout);
			}
		}
  }
  
	
	
this.onMouseWheel = function() {
    
    return;
    if (this._disabled) return;
		
    var val = parseFloat(this._valueInternal);
    if (event.wheelDelta > 0) {
      val -= this.wheelAmount;
    } else {
      val += this.wheelAmount;
    }
    val = this._roundToGrid(val);
    if (val != this._valueInternal) {
      this._valueInternal = val;
      var newPos = this._getPositionByValue(val);
      this.updateHandle(newPos);
      this.updateValueField(val);
      this.updateValueText(val);
      this._updateColorbar(newPos);
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, val, newPos, true);
      this.fireEvent('onChange');
    }
}
	
	
	
	this.stopFireArrow = function() {
		this._stopFireArrowFlag = true;
	}
	
  
  this.setValue = function(val) {
		
    var val0 = this._roundToGrid(val[0]);
    var val1 = this._roundToGrid(val[1]);

    var newPos0 = this._getPositionByValue(val0);
    var newPos1 = this._getPositionByValue(val1);
    if (val[0] != this._valueInternal[0] || val[1] != this._valueInternal[1]) {
      if (val[0] != this._valueInternal[0]) {
          this._valueInternal[0] = val0;
          this.updateHandle(newPos0, 0);
      }
      if (val[1] != this._valueInternal[1]) {
          this._valueInternal[1] = val1;
          this.updateHandle(newPos1, 1);
      }
      if ('undefined' != typeof(this.eventOnChange)) this.eventOnChange(this, this._valueInternal, newPos0, false);
      this.fireEvent('onChange');
      this.updateValueField(this._valueInternal);
      this.updateValueText(this._valueInternal);
    }
    
    this._updateColorbar(newPos0);
  }
	
  
  this.onChangeByApi = function(val) {
		this.setValue(val);
  }
	
  
  this.attachMouseEvents = function(turnOn)
  {
    if (turnOn) {
        temp = ech_attachMouseDrag(this._handleObj[0],this.slideStart,null,this.slideMove,null,this.slideEnd,null,null,null);
        temp = temp.linkCtrl(getDivImage('','bsslidericonname0'));
        temp = ech_attachMouseDrag(this._handleObj[1],this.slideStart,null,this.slideMove,null,this.slideEnd,null,null,null);
        temp = temp.linkCtrl(getDivImage('','bsslidericonname1'));
    } else {
        ech_detachMouseDrag(this._handleObj[0]);
        ech_detachMouseDrag(this._handleObj[1]);
    }
  }

  
  this._updateColorbar = function(newPos) {


    




    
    if (this._colorbarObj) {
        var newWidth = (this._currentRelSliderPosX[1] - this._currentRelSliderPosX[0]) + this.colorbar['widthDifference']; 
        if (newWidth < 0) newWidth = 0;
        this._colorbarObj.style.width = newWidth;
        this._colorbarObj.style.left = this._currentRelSliderPosX[0] + (this._sliderImgWidth / 2);
			
        if (typeof(this.colorbar['color2']) != 'undefined') {
            
            var percent  = this.getValueInPercent();
            var newColor = mixColor(this.colorbar['color'], this.colorbar['color2'], percent);
            document.getElementById(this._colorbarId).style.backgroundColor = newColor;
        }
    }
  }
  
  
  this._getValueByPosition = function(pos) {
		if (this.direction == 0) {
	    pos -= this.ctrl[0].minX;
  	  var hundertPercent = this.ctrl[0].maxX - this.ctrl[0].minX;
		} else {
	    pos -= this.ctrl.minY;
  	  var hundertPercent = this.ctrl.maxY - this.ctrl.minY;
		}
    var myPercent      = pos / hundertPercent;
    var val            = this.minVal + ((this.maxVal - this.minVal) * myPercent);
    return val;
  }
  
  
  this._getPositionByValue = function(val) {
    val = val - this.minVal; 
    var hundertPercent = this.maxVal - this.minVal;
    var myPercent      = val / hundertPercent;
		if (this.direction == 0) {
	    var pos = this.ctrl[0].minX + ((this.ctrl[0].maxX - this.ctrl[0].minX) * myPercent);
		} else {
	    var pos = this.ctrl.minY + ((this.ctrl.maxY - this.ctrl.minY) * myPercent);
		}
    return pos;
  }
  
  
  this._roundToGrid = function(val) {
    val = parseFloat(val);
    if (isNaN(val)) return this.minVal;
    
    val = Math.round(val / this.valueInterval) * this.valueInterval;
    
    val = Math.round(val*10000)/10000;
    
    
    if (val < this.minVal) val = this.minVal;
    if (val > this.maxVal) val = this.maxVal;

    return val;
  }
  
  
  this._getNewLocationFromCursor = function(sliderNum) {
	var ox = this._posEventSlideStartX;
    var oy = this._posEventSlideStartY;

    switch (this.direction) {
      case 0: 
        var t = this.ctrl[sliderNum].pageX - ox;
        var x = parseInt(this._posObjSlideStartX) + t;
        if (x > this.ctrl[sliderNum].maxX) x = this.ctrl[sliderNum].maxX;
        if (x < this.ctrl[sliderNum].minX) x = this.ctrl[sliderNum].minX;

        if (sliderNum == 0) {
            if (this._currentRelSliderPosX[1] - this.minSeparation < x) {
                x = this._currentRelSliderPosX[1] - this.minSeparation;
            }
        } else if (sliderNum == 1) {
             if (this._currentRelSliderPosX[0] + this.minSeparation > x) {
                x = this._currentRelSliderPosX[0] + this.minSeparation;
             }
        }

        return x;
        
      case 1: 
        var t = this.ctrl.pageY - oy;
        var y = parseInt(this._posObjSlideStartY) + t;
        if (y > this.ctrl.maxY) y = this.ctrl.maxY;
        if (y < this.ctrl.minY) y = this.ctrl.minY;
        return y;
    }
  }
  
  
  this.updatePointer = function(newPos) {
    this.updateHandle(newPos);
  }
  
  
  this.updateHandle = function(newPos, ctrlNum) {
   
   if (ctrlNum == null || ctrlNum < 0 || ctrlNum > 1) return;
    if (this.direction == 0) {
        this._currentRelSliderPosX[ctrlNum] = newPos;
        this.ctrl[ctrlNum].div.style.left   = newPos;
    } else {
        this._currentRelSliderPosX[ctrlNum]  = newPos;
        this.ctrl[ctrlNum].div.style.top    = newPos;
    }
    return;
		
  }
  
  
  this.updateValueField = function(val) {
    if (this._valueFieldObj) {
      this._valueFieldObj.value = val;
    }
  }
  
  
  this.updateValueText = function(val) {
    if (this._valueTextObj) {
      
      
      
      this._valueTextObj.innerHTML = val;
	 
      
    }
  }
  
  
  this.arrowOnClick = function() {

  }
  
  
  this.onChange = function(val) {
		if (this._disabled) return;
		this.setValue(val);
    
  }
  

  
  
  
  this.textboxEdit = function(editMode) {
    if (this._disabled) return;
    if (editMode) {
      if ('undefined' != typeof(this._valueFieldObj)) {
        this._valueTextObj.style.display = 'none';
        this._valueFieldObj.style.display = 'block';
        bsFormFieldSetFocusAndSelect(this._valueFieldObj, false);
      }
    } else {
      if ('undefined' != typeof(this._valueTextObj)) {
        this._valueFieldObj.style.display = 'none';
        this._valueTextObj.style.display  = 'block';
      }
    }
  }
  
  
  this.slideMove = function(ctrl, client) {
    ctrl.sliderObj.onChangeBySlide(ctrl);
  }
	
	
  
  this.slideStart = function(ctrl, client) {
		
		
		
		
		
		
    ctrl.sliderObj._posEventSlideStartX = ctrl.startX;
    ctrl.sliderObj._posEventSlideStartY = ctrl.startY;
    ctrl.sliderObj._posObjSlideStartX = ctrl.sliderObj._handleObj[ctrl.num].style.left;
    ctrl.sliderObj._posObjSlideStartY = ctrl.sliderObj._handleObj[ctrl.num].style.top;
    
    var pos = ctrl.sliderObj.getSliderPos();
    ctrl.sliderObj.setValue(pos);
    
    if ('undefined' != typeof(ctrl.sliderObj.slideStartCB)) {
      ctrl.sliderObj.slideStartCB(ctrl.sliderObj, ctrl.sliderObj.getValue(), pos);
    }
  }
  
  
  
  this.slideEnd = function(ctrl, client){
		if (this._disabled) return;
    var pos = ctrl.sliderObj.getSliderPos();
    if ('undefined' != typeof(ctrl.sliderObj.slideEndCB)) {
      ctrl.sliderObj.slideEndCB(ctrl.sliderObj, ctrl.sliderObj.getValue(), pos);
    }

    return;
  }
  
  
  
  
	this._constructor(theFieldnamePrefix); 
 
}

