function clearSelection() { 
    var sel ; 
    if(document.selection && document.selection.empty){ 
      document.selection.empty() ; 
    } else if(window.getSelection) { 
      sel=window.getSelection(); 
      if(sel && sel.removeAllRanges) 
        sel.removeAllRanges() ;
	}
	}	
	


function _scrollBar(_idTxt,_idSlide)
   {
    this.idTxt    =  _idTxt;
    this.idSlide  =  _idSlide;
    this.hTxt     =  70;
   if (document.getElementById(this.idTxt).scrollHeight>this.hTxt)
	{
    this.startY   =  0;
    this.valueY   =  0;
    this.delta    =  0;
    this.hSlide   =  20;
    this.hScroll  =  50,
    this.dragStart=  function(e)
                 {  
                  evt=e?e:window.event;
                  this.startY=evt.clientY;
		  var temp=this;	
                  document.onmousemove=function(e){temp.keepDrag(e);};
                  document.onmouseup  =function(e){temp.stopDrag(e);}; 
                 };
    this.keepDrag =  function(e)
                 {            
		  clearSelection();
                  evt=e?e:window.event;
		  var curentY=evt.clientY;
                  curentY=this.valueY+curentY-this.startY;
                  curentY=(curentY>this.hScroll)?this.hScroll:curentY;
                  curentY=(curentY<0  )?0  :curentY;
		  document.getElementById(this.idSlide).style.top=curentY+"px";  
                  document.getElementById(this.idTxt).scrollTop   =Math.floor(curentY*this.delta);                                    };
    this.dragIt    =  function(_dy)
                 {            
				 clearSelection();
                  curentY=this.valueY+_dy;
                  curentY=(curentY>this.hScroll)?this.hScroll:curentY;
                  curentY=(curentY<0  )?0  :curentY;
		  document.getElementById(this.idSlide).style.top=curentY+"px";  
                  document.getElementById(this.idTxt).scrollTop   =Math.floor(curentY*this.delta);                   
		  this.valueY =curentY;
                 };            
    this.stopDrag  =  function(e)
                 {                  
                  document.onmousemove="";
		  document.onmouseup  ="";
                  evt=e?e:window.event;
		  var curentY=evt.clientY;
                  curentY=this.valueY+curentY-this.startY;
		  curentY=(curentY>this.hScroll)?this.hScroll:curentY;
		  curentY=(curentY<0  )?0  :curentY;
                  this.valueY =curentY;
                 }; 
     this.whellActivate=function()
		  {
		  if (window.addEventListener)
		       window.addEventListener('DOMMouseScroll',this.f, false);
		  window.onmousewheel = document.onmousewheel = this.f;
		  }
     this.wheelIt = function(evt)
                 {
	          delta = 0;
	 	  evt=evt?evt:window.event;
		  if (evt.wheelDelta) 
		     {
		      delta = evt.wheelDelta/120;
		     } else if (evt.detail) 
	   	       delta = -evt.detail/3;	 
		   if (delta<0)
	              this.dragIt(10)    
	   	   else if (delta>0)
	             this.dragIt(-10);    

		   if (evt.preventDefault)
		      evt.preventDefault();
	  	   evt.returnValue = false;
		};
 
    this.wheelDeactivate = function()
                        {
			 window.onmousewheel = document.onmousewheel ="";
			 if (window.addEventListener)
			 window.removeEventListener('DOMMouseScroll', this.f, false);
 			}
     this.valueY=0;

     this.delta =((document.getElementById(this.idTxt).scrollHeight-this.hTxt)*1.00)/this.hScroll; 
     document.getElementById(this.idTxt).scrollTop=0; 
     var that=this;             
     this.f=function(e){that.wheelIt(e)};
	 document.getElementById(this.idSlide).style.display="block";
	 document.getElementById(this.idSlide).style.top="0px";	 
	 document.getElementById(this.idTxt).scrollTop   =0;	 
     document.getElementById("holder"+this.idTxt).onmouseover=function(){that.whellActivate()};
	 document.getElementById("holder"+this.idTxt).onmouseout=function(){that.wheelDeactivate()};	 
	 }
	 else 
	  {
	   document.getElementById("holder"+this.idTxt).onmouseover=function(){};
	   document.getElementById("holder"+this.idTxt).onmouseout=function(){};	   
	   document.getElementById(this.idSlide).style.display="none";
   	   document.getElementById(this.idTxt).scrollTop   =0;		   
	  }
 }
 
 
var scrollBar1;
var scrollBar0;
function onLoadFunction()
 {
   scrollBar1=new _scrollBar("txt1","slider1");
   scrollBar0=new _scrollBar("txt0","slider0");
 }

 