﻿var scroller  = null;
var scrollbar = null;

function scrollbarStart() {
	scroller  = new jsScroller(get$("content_div"), 600, 430);
	scrollbar = new jsScrollbar (get$("Scrollbar-Container"), scroller, true, scrollbarEvent);
}

function scrollbarEvent (o, type) {
	if (type == "mousedown") {
		if (o.className == "Scrollbar-Track") o.style.backgroundColor = "";
		else o.style.backgroundColor = "";
	} else {
		if (o.className == "Scrollbar-Track") o.style.backgroundColor = "";
		else o.style.backgroundColor = "";
	}
}

function swapIt(o) {
	o.blur();
	if (o.className == "current") return false;
  
	var list = get$("Navigation").getElementsByTagName("a");
	for (var i = 0; i < list.length; i++) {
		if (list[i].className == "current") {
			list[i].className = "";
			get$(list[i].title).y = -scroller._y;
		}
		if (list[i].title == o.title) o.className = "current";
	}
  
	list = get$("Container").childNodes;
	for (var i = 0; i < list.length; i++) {
		if (list[i].tagName == "DIV") list[i].style.display = "none";
	}
  
	var top = get$(o.title);
	top.style.display = "block";
	scrollbar.swapContent(top);
	if (top.y) scrollbar.scrollTo(0, top.y);
  
	return false;
}
