var currObj2;              // stores the current object being manipulated (leftSlider or rightSlider object)
var leftpos22 = 0;          // the current left pos2ition after mouse is released
var rightpos22 = 25000;     // the current right pos2ition after mouse is released
var sliderWidth2 = 0.075;      // the width of the sliders (includes borders)
var sliderBarWidth2 = 175; // the width of the slider bar (does not include borders)
var mouseStart2 = -99999   // an arbitrary number used to show that it is the first time we are hitting the moveSlider22 function.
var pos2;                  // pos2ition with offset2 used during the move
var min2 = 0;              // min2imum value of the data
var max2 = 15000;          // max2imum value of the data


/* funciton moveSlider2(obj)
parameter obj - object reference to the calling object
This function sets the resets the starting mouse pos2ition and sets the document methods used to watch for mouse events.
*/
function moveSlider2(obj) {
mouseStart2 = -99999;   // set the beginning mouse pos2ition to an unlikely number.
currObj2 = obj;         // set the currObj2 variable to the object that was clicked
document.onmousemove = moveSlider22; // set the onmousemove method to the function that moves the slider
document.onmouseup = moveDone2;   // set the onmouseup method to the function that stops listening for the mousemove and reclaculates the data
}
function start_slider(){
	document.getElementById('leftX').innerHTML=min;
	document.getElementById('rightX').innerHTML=max;
	document.getElementById('leftX2').innerHTML=min2;
	document.getElementById('rightX2').innerHTML=max2;
}
/* function moveSlider22
 This function is called by the mousemove event checks the current mouse pos2ition and compares it to the mouse pos2ition when the move was started. uses the difference as an offset2 from the slider's staring pos2ition to move the slider with the mouse
*/
function moveSlider22(e){

if (!e) var e = window.event;  // if IE, then we need to assign e
if (e.pageX) pos2X = e.pageX;   // FF, opera, netscape
else if (e.clientX) {          // IE
  pos2X = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;  
}
if (mouseStart2 == -99999) mouseStart2 = pos2X;  // -99999 is an arbitrary number.  It is unlikely to be hit
var offset2 = pos2X - mouseStart2; // determin2e the difference from where the mouse started to where it is now
if (currObj2.id=="sliderLeft2") {  // If we are moving the left slider
  pos2 = leftpos22 + offset2;        // the new pos2ition should be the current left pos2ition + the offset2
  if (pos2 < 0) pos2 = 0;          // if this makes the left pos2ition less than 0 then use 0
  if (pos2 > rightpos22 - sliderWidth2) pos2 = rightpos22 - sliderWidth2; // if the pos2ition would put us past the right slider then move up to the right slider
  var number2;
  number2 =  Math.round(pos2/sliderBarWidth2*50)%50/50 * (max2-min2) + min2; // put the new left pos2ition in a text box to be viewed. (this is not required)
 
	document.getElementById('leftX2').innerHTML = Math.round(number2);
 
}else {
  pos2 = rightpos22 + offset2   // the new pos2ition should be the current right pos2ition + the offset2
  if (pos2 < leftpos22 + sliderWidth2) pos2 = leftpos22 + sliderWidth2;  // if the new pos2ition would take us past the left slider then move next to the left slider
  if (pos2 > sliderBarWidth2 ) pos2 = sliderBarWidth2 ;  // if the new pos2ition is past the end of the bar, pos2ition at the end of the bar.
  var number2;
  //find the end. by comparison and put the final number in the rightX box
  if (pos2==sliderBarWidth2){
	number2 =  max2;
  }else{
	number2 =  Math.round(pos2/sliderBarWidth2*50)%50/50 * (max2-min2); // put the new right pos2ition in a text box to be viewed. (this is not required)
  }
  
	document.getElementById('rightX2').innerHTML = Math.round(number2);

}        
currObj2.style.left = pos2 + "px";  // move the slider to the new pos2ition

}

// function moveDone2()
// sets the current left/right pos2ition memory variable.
//  clears the mouse monitoring methods.
//  Calls the function to recaculate the data

function moveDone2(e) {
if (currObj2.id == "sliderLeft") leftpos22 = pos2;    // set the current left pos2ition to the value of pos2
else rightpos22 = pos2;                              // set the current right pos2ition to the value of pos2
document.onmousemove = function() {};             // stop listening for a mousemove event
document.onmouseup = function() {};               // stop listening for a mouseup event
//print ("value" + LeftX);
}