/***
    Java Script scroller.js
    Modified By
	by Ashish Yadav
    
	For: Videoupload Project
	Date: 15/01/2008
	
****/

var theHandle = []; var theRoot = []; var theThumb = []; var theScroll = []; var thumbTravel = []; var ratio = [];

function instantiateScroller(count, id, left, top, width, height, speed){
	if(document.getElementById) {
		theScroll[count] = new ypSimpleScroll(id, left, top, width, height, speed);
	}
}

function createDragger(count, handler, root, thumb, minX, maxX, minY, maxY){
	//alert(count+" "+handler+" "+root+" "+thumb+" "+minX+" "+maxX+" "+minY+" "+maxY);
	
	
var buttons = '<div class="up" id="up'+count+'"><a  onClick="theScroll['+count+'].scrollNorth(\''+count+'\')"><img src="include/Scroller/up.gif" width="20" height="20"  style="top:10px" ></a></div><div class="dn"  id="dn'+count+'""><a  onClick="theScroll['+count+'].scrollSouth(\''+count+'\')"><img src="include/Scroller/dn.gif" width="20" height="20" style="top:10px"></a></div><div class="thumb" id="'+thumb+'" style="left:35px; top:15px;"><a  onClick="theScroll['+count+'].endScroll()"><img src="include/Scroller/bar.gif" width="20" height="30"></div>';
		
		document.getElementById(root).innerHTML = buttons + document.getElementById(root).innerHTML;
        theRoot[count]   = document.getElementById(root);
		theThumb[count]  = document.getElementById(thumb);
		var thisup = document.getElementById("up"+count);
		var thisdn = document.getElementById("dn"+count);
		theThumb[count].style.left = parseInt(minX+15) + "px";
		thisup.style.left = parseInt(minX+15) + "px";
		thisdn.style.left = parseInt(minX+15) + "px";
		theThumb[count].style.border =0;
		theThumb[count].style.top = 46 + "px";
		thisup.style.top = 25 + "px";
		thisdn.style.top = (parseInt(minY+maxY)+75) + "px";
		//thisdn.style.top = "390px";

		theScroll[count].load();

		//Drag.init(theHandle[count], theRoot[count]); //not draggable on screen
		Drag.init(theThumb[count], null, minX+15, maxX+15, minY+30, maxY+60);
		
		// the number of pixels the thumb can travel vertically (max - min)
		thumbTravel[count] = theThumb[count].maxY - theThumb[count].minY;

		// the ratio between scroller movement and thumbMovement
		ratio[count] = theScroll[count].scrollH / thumbTravel[count];

		theThumb[count].onDrag = function(x, y) {
		theScroll[count].jumpTo(null, Math.round((y - theThumb[count].minY) * ratio[count]));
		}

}	


 

 

 