
<public:component>
	<public:attach event="oncontentready" onevent="init();" />


<public:property name="Min" put="setMin" get="getMin"/>
<public:property name="Max" put="setMax" get="getMax"/>
<public:property name="Pos" put="getPos" get="getPos"/>
<public:attach event="onmouseup" onevent="EndDrag();" />
<public:attach event="onmousemove" onevent="OnDrag();" />
<public:attach event="onclick" onevent="OnClick();" />
</public:component>


<script type="text/javascript" language="javascript">
  var min=0;
  var max=100;
  var pos=2;
  var curTrackBar;
  var sliderId;
   var draging=false;
    var orientation = "h";
    var trackBarWidth = 0;
    var trackBarHeight = 17;
    var sliderWidth = 6;
    var sliderHeight = 17;
    var offset=2;
  function setMax(v){max=v;}
  function getMax(){return max;}
  function setMin(v) { min=v;}
  function getMin(){return min;}
  function getPos(){return pos;}
  function setPos(v){pos=v;}
  function OnClick()
  {
  event.returnValue = false;

    var phyPos = 0;
  
        phyPos = event.clientX - element.style.pixelLeft - offset;
        if (phyPos <= 0)
        {
            phyPos = 0;
        }
        else if(phyPos >= (element.offsetWidth-sliderId.offsetWidth))
        {
            phyPos = element.offsetWidth -2;//sliderId.offsetWidth;
        }
       sliderId.style.pixelLeft = phyPos;
        pos = parseInt(((max-min)*phyPos/(element.offsetWidth-sliderId.offsetWidth)))
  }
  function init()
  {
  trackBarWidth=element.clientWidth-sliderWidth-1;
  trackBarHeight=element.clientHeight;
  min=element.Min;
  max=element.Max;
  pos=element.Pos;
  var sliderIdStr=element.id+"_slider";

  element.innerHTML+= "<div id=\"" + sliderIdStr + "\"  style='cursor:hand;position:relative;top:1px'><img src=\"" + element.TrackImg + "\"' width=6/></div>";
  var objs = element.document.getElementById(sliderIdStr);//element.getElementsByTagName("div");
  sliderId=objs;
  sliderId.onmousedown=BeforeDrag;
 // alert(sliderId.tagName);
    //sliderId.style.pixelTop = this.trackBarHeight - ((this.trackBarHeight-this.sliderHeight)*this.pos)/(this.max-this.min) - this.sliderHeight;
  sliderId.style.width = 6;
    sliderId.style.height = 17;
  }
  function BeforeDrag()
  {
  if (event.button != 1)
    {
        return;
    }
    
    element.style.cursor = "hand";    
    

    draging = true;
    offset = event.clientX - element.style.pixelLeft - sliderId.style.pixelLeft;
   
  }
  function EndDrag()
{
  
   draging = false;
}
function OnDrag()
{
if(!draging)
{
return ;
 }
    event.returnValue = false;

    var phyPos = 0;
  
        phyPos = event.clientX - element.style.pixelLeft - offset;
        if (phyPos <= 0)
        {
            phyPos = 0;
        }
        else if(phyPos >= (element.offsetWidth-sliderId.offsetWidth))
        {
            phyPos = element.offsetWidth-2;//sliderId.offsetWidth;
        }
       sliderId.style.pixelLeft = phyPos;
        pos = parseInt(((max-min)*phyPos/(element.offsetWidth-sliderId.offsetWidth)))
      /*
    OnTrackBarChng();
    */
}
</script>