var scroller  = null;
var scrollbar = null;


function scrollbarEventDown (o, c, type) {
		if (c == "Scrollbar-Up") o.style.backgroundImage = "url('i/indexscroll/scroll-up-hl.gif')";
		else if (c == "Scrollbar-Down") o.style.backgroundImage = "url('i/indexscroll/scroll-down-hl.gif')";
		else if (c == "Scrollbar-Track") o.style.backgroundImage = "url('i/indexscroll/scrollbar-bg-hl.gif')";
}

function scrollbarEventUp (o, c, type) {
		if (c == "Scrollbar-Up") o.style.backgroundImage = "url('i/indexscroll/scroll-up.gif')";
		else if (c == "Scrollbar-Down") o.style.backgroundImage = "url('i/indexscroll/scroll-down.gif')";
		else if (c == "Scrollbar-Track") o.style.backgroundImage = "url('i/indexscroll/scrollbar-bg.gif')";
}

function testScrollbarEnable (o, s) {
//	alert(o.getDimensions().theight);
	if(o.getDimensions().theight > 126)
	{
	document.getElementById("Scrollbar-Container").style.display = 'block'; 
	document.getElementById("Scrollbar-Container").style.visibility = 'visible'; 
	}
	else {
		document.getElementById("Scrollbar-Container").style.display = 'none'; 
		document.getElementById("Scrollbar-Container").style.visibility = 'hidden'; 
	}
	o.reset();
}
  
function initScrollBar() {
  	scroller  = new Scrolling.Scroller(document.getElementById("Scroller"), 370, 126);
  scrollbar = new Scrolling.Scrollbar(document.getElementById("Scrollbar-Container"), scroller, new Scrolling.ScrollTween());
  //scroller.scrollTo(0, 120);
  scrollbar.onMouseDown = scrollbarEventDown;
	scrollbar.onMouseUp = scrollbarEventUp;
	
	testScrollbarEnable (scroller, scrollbar);
	//scrollbar.disable();	

}

addDOMLoadEvent(function() {
 
/*  	scroller  = new Scrolling.Scroller(document.getElementById("Scroller"), 370, 126);
  scrollbar = new Scrolling.Scrollbar(document.getElementById("Scrollbar-Container"), scroller, new Scrolling.ScrollTween());
  //scroller.scrollTo(0, 120);
  scrollbar.onMouseDown = scrollbarEventDown;
	scrollbar.onMouseUp = scrollbarEventUp;
	
	testScrollbarEnable (scroller, scrollbar);
	//scrollbar.disable();*/
	
  
  });
