
function initResne()
{
	inverseHandle(document.getElementById(resne));
	
	var Fscroll = {

		obj: null,
	
		timer: null,
				
		init:   function() 
		{
	
	  		    //collect the variables
		    Fscroll.docH = document.getElementById("myScrollContent").offsetHeight;
		    Fscroll.contH = document.getElementById("myScrollContainer").offsetHeight;
		    Fscroll.scrollAreaH = document.getElementById("scrollbar").offsetHeight - 26;
		      
		    //calculate height of scroller and resize the scroller div
		    //(however, we make sure that it isn't to small for long pages)
		    Fscroll.scrollH = (Fscroll.contH * Fscroll.scrollAreaH) / Fscroll.docH;
		    //if(scroller.scrollH < 15) scroller.scrollH = 15;
		    document.getElementById("scroller").style.height = Math.round(Fscroll.scrollH) + "px";
		   document.getElementById("sMid").style.height = Math.round(Fscroll.scrollH) + "px";
  
		    //what is the effective scroll distance once the scoller's height has been taken into account
		    Fscroll.scrollDist = Math.round(Fscroll.scrollAreaH-Fscroll.scrollH);
	
		    //make the scroller div draggable
		    Drag.init(document.getElementById("scroller"),null,0,0,0,Fscroll.scrollDist);
	
	
	
				
		    //add ondrag function
		    document.getElementById("scroller").onDrag = Fscroll.scrollMe;
	
		    document.getElementById("scroll_up").onmousedown = Fscroll.scrollingUp;
		    //document.getElementById("scroll_up").onmouseup = Fscroll.stopScroll;
	
				document.getElementById("scroll_down").onmousedown = Fscroll.scrollDown;
		    
		  },
	
		  scrollMe : function(e)
		  {
		  		var scrollY = parseInt(document.getElementById("scroller").style.top);
		     var docY = 0 - (scrollY * (Fscroll.docH - Fscroll.contH) / Fscroll.scrollDist);
		     document.getElementById("myScrollContent").style.top = docY + "px";
		     return false;
		  },
	
		  StartScrollUp : function(e)
		  {
		  		this.onmousedown = Fscroll.scrollUp;
		  },
	
			stopScroll : function(e)
			{
				clearInterval(Fscroll.timer);
				return true;
			},
	
			
			scrollUp : function(e)
			{
				var scrollY = parseInt(document.getElementById("scroller").style.top);
		    	if (scrollY > 1) scrollY-=1;
		    	document.getElementById("scroller").style.top = scrollY + "px";
		    	Fscroll.scrollMe();
		    	return true;
			},
	
			scrollingUp : function(e)
			{
				Fscroll.timer = setTimtout("Fscroll.scrollUp()", 100);
				//Fscroll.scrollUp();
				return true;
			},
			 
	
			scrollDown : function(e)
			{
				var h = Fscroll.scrollAreaH - parseInt(document.getElementById("scroller").style.height);
				var scrollY = parseInt(document.getElementById("scroller").style.top);
		    	if (scrollY < h) scrollY+=1;
		    	document.getElementById("scroller").style.top = scrollY + "px";
		    	Fscroll.scrollMe();	
		    	return true;
			}
	 };

							
	Fscroll.init();	
}

var oldhandler = window.onload;
window.onload = (typeof oldhandler == "function")
    ? function() { oldhandler(); initResne(); } : initResne;


