/*
var bindScrollbar=function(maskId,contentId,scrollBarId,cursorId){

	var maskHeight = $(maskId).getStyles("height").height.replace('px','');
	var contentHeight= $(contentId).getStyles("height").height.replace('px','');
	var deltaHeight= contentHeight-maskHeight;
	
	var mySlide = new Slider($(scrollBarId), $(cursorId), {	
		steps: contentHeight-maskHeight,
		mode: 'vertical',	
		onChange: function(step){
			var newPosition = -((step*(deltaHeight))/(deltaHeight));
			$(contentId).setStyle('margin-top', ""+newPosition+"px"); 
			
		}
	}).set(0);
};*/

/*
* **** bindScrollbar
* **** by Pietro Ferraresi
* 
* maskId: id of container of the text
* contentId: id of div of the content
* scrollBarId: id of scrollbar
* cursorId: id of cursor
*
*/

var bindScrollbar=function(maskId,contentId,scrollBarId,cursorId,scrollBarContainer){

	maskHeight = $(maskId).getStyle("height").toInt();
	contentHeight= $(contentId).getStyle("height").toInt();
	deltaHeight= contentHeight-maskHeight;
	

	if (contentHeight > maskHeight){
		$(scrollBarContainer).style.display='block';
	}else{
		$(scrollBarContainer).style.display='none';
	}
	
	mySlide = new Slider($(scrollBarId), $(cursorId), {	
		steps: deltaHeight,
		mode: 'vertical',	
		onChange: function(step){
			if (deltaHeight>0){
				var newPosition = - step;
				$(contentId).setStyle('margin-top', newPosition); 
			}
		}
		
	}).set(0);
};
