var ScrollUtils = 
{	
	'getComps': function(div_list)
	{
		var returnData					= {};
		returnData.contentHolder		= div_list[0];
		returnData.content				= div_list[0].getElementsByTagName('div')[0];
		
		for(var counter = 1;counter < div_list.length;counter++)
		if(StyleInfo.getClass(div_list[counter]).indexOf('scrollbar-hilight-color') != -1){returnData.scrollbar = div_list[counter];break;}		

		returnData.mainBox					= returnData.scrollbar.parentNode;
		
		returnData.content.measures 		= StyleInfo.getMeasures(returnData.content);
		returnData.scrollbar.measures		= StyleInfo.getMeasures(returnData.scrollbar);
		returnData.contentHolder.measures	= StyleInfo.getMeasures(returnData.contentHolder);
		
		var sComps						= returnData.scrollbar.getElementsByTagName('div');
		
		returnData.button_up			= sComps.length > 1 && sComps[0] != null ? sComps[0] : null;
		returnData.button_track			= sComps[1] != null ? sComps[1] : sComps[0];
		returnData.button_dw			= sComps.length > 1 && sComps[2] != null ? sComps[2] : null;
		
		if(returnData.button_up != null)returnData.button_up.measures		= StyleInfo.getMeasures(returnData.button_up);
		if(returnData.button_track != null)returnData.button_track.measures	= StyleInfo.getMeasures(returnData.button_track);
		if(returnData.button_dw != null)returnData.button_dw.measures		= StyleInfo.getMeasures(returnData.button_dw);
		
		return returnData;
	},
	
	'defineTrackSize': function(selfRef)
	{
		var components			= selfRef.getComponents();
		var properties			= selfRef.getProperties();
		
		var cont_height 		= components.content.measures.height;
		var availHeight			= ScrollUtils.trackRange(selfRef);
		
		var maxHeight 			= availHeight.max - 4;
		if(components.button_dw != null)maxHeight -= components.button_dw.measures.height;		
		selfRef.setProperty('maxBarHeight',maxHeight);
		
		properties.ratio		= cont_height / (availHeight.max - availHeight.min);
		var aspect				= Math.round((availHeight.max - availHeight.min) / properties.ratio);
		
		if(isNaN(aspect))aspect = 0;
		
		if(aspect < properties.minBarHeight)
		{
			properties.ratio	= cont_height / ((availHeight.max - availHeight.min - properties.minBarHeight));
			aspect				= properties.minBarHeight;
		}
		else if(aspect > maxHeight)aspect = maxHeight;
		
		components.button_track.style.height 		= aspect + 'px';
		components.button_track.measures.height		= aspect;
		
		selfRef.setComponents(components);
		selfRef.setProperties(properties);
	},
	
	'trackRange': function(selfRef)
	{
		var components			= selfRef.getComponents();
		
		var up_measures = components.button_up != null ? components.button_up.measures : {'height': 0};
		var dw_measures = components.button_dw != null ? components.button_dw.measures : {'height': 0};
		var cn_measures	= components.scrollbar.measures;
		
		return {'min': (0 + up_measures.height), 'max': (cn_measures.height - dw_measures.height)};		
	}
}