var scroller  = null;
var scrollbar = null;

window.onload = function () 
{
	if (document.getElementById("wrapScroll"))
	{
		/*
			Calculation of the height of the elements
		*/
		totalHeight = jQuery("div#sidemenu").height();
		maxHeight = jQuery("div#columns").height();
		scrollHeight = maxHeight - totalHeight;
		currentHeight = jQuery("div#Scroller-Container-1").height();
		
		if (currentHeight < scrollHeight)
		{
			scrollHeight = currentHeight + 0.5; // a tip to be a little more big of the container
		}
		
		jQuery("div#wrapScroll").height(scrollHeight);
		jQuery("div#Scroller-1").height( jQuery("div#wrapScroll").height() );
		jQuery("div#Scrollbar-Track-1").height( jQuery("div#wrapScroll").height() );
		
		padLeft = jQuery("#Scroller-Container-1>div:first").css("padding-left").toInt();
		if (padLeft > 8)
		{
			jQuery("#Scrollbar-Track-1").css("left", padLeft - 8);
		}
		
		scroller  = new jsScroller(document.getElementById("Scroller-1"), 220, scrollHeight);
  		scrollbar = new jsScrollbar (document.getElementById("Scrollbar-Container"), scroller, true);
	}
	
	if (document.getElementById("wrapScroll-2"))
	{
		scrollHeight = jQuery("div#attr-container").height();
		
		jQuery("div#wrapScroll-2").height(scrollHeight);
		jQuery("div#Scroller-2").height( jQuery("div#wrapScroll-2").height() );
		jQuery("div#Scrollbar-Track-2").height( jQuery("div#wrapScroll-2").height() );
		
		scroller2  = new jsScroller(document.getElementById("Scroller-2"), 220, scrollHeight, "-2");
  		scrollbar2 = new jsScrollbar (document.getElementById("Scrollbar-Container-2"), scroller2, true, null,"-2");
	}
	
	if (document.getElementById("wrapScroll-3"))
	{
		scrollHeight = jQuery("div#attr-container").height();
		
		jQuery("div#wrapScroll-3").height(scrollHeight);
		jQuery("div#Scroller-3").height( jQuery("div#wrapScroll-3").height() );
		jQuery("div#Scrollbar-Track-3").height( jQuery("div#wrapScroll-3").height() );
		
		scroller3  = new jsScroller(document.getElementById("Scroller-3"), 220, scrollHeight, "-2");
  		scrollbar3 = new jsScrollbar (document.getElementById("Scrollbar-Container-3"), scroller3, true, null,"-2");
	}
}