var scrollcontainerwidth = 140;
var scrollcontainerheight = 137;
var scrollcontainer = false;
var scrollcontent = false;
var scrollcurrentx = 0;
var scrollcurrenty = 0;
var scrollheight = 0;
var scrollspeedy = 4; // vertical pixels to move per repeat
var scrollspeedx = 0; // horizontal pixels to move per repeat
var scrollrepeat = 40; // milliseconds per repeat
var scrollmove = false;
var scrollinit = false;

function scrollerInit() {
	scrollcontainer = gE('scrollcontainer');
	scrollcontent = gE('scrollcontent', scrollcontainer);
	sS(scrollcontainer,scrollcontainerwidth,scrollcontainerheight);
	sC(scrollcontainer,0,scrollcontainerwidth,scrollcontainerheight,0);
	scrollheight = gH(scrollcontent);
	pos = getPos('spos');
	if (ie && ua.indexOf('win')>-1) {
		pos[0]+=25;
		pos[1]-=3;
	} else if (ie && ua.indexOf('mac')>-1) {
		pos[0]+=17;
		pos[1]-=4;
	} else if (nn) {
		pos[0]+=0;
		pos[1]-=19;
	} else if (ua.indexOf('gecko')>-1 && ua.indexOf('khtml')==-1) {
		pos[0]+=17;
		pos[1]-=15;
	} else {
		pos[0]+=28;
		pos[1]-=4;
	}
	sP(scrollcontainer, pos[0], pos[1]);
	sE(scrollcontainer);
	sE(scrollcontent);
	scrollinit = true;
}

function scroll() {
	if (scrollinit && scrollheight > scrollcontainerheight) {
		if (scrollmove == 'up') {
			scrollcurrentx += scrollspeedx;
			scrollcurrenty += scrollspeedy;
			sP(scrollcontent,scrollcurrentx,scrollcurrenty);
			if (scrollcurrenty > 0) {
				scrollcurrenty = 0;
				scrollmove = false;
			}
		} else if (scrollmove == 'down') {
			scrollcurrentx -= scrollspeedx;
			scrollcurrenty -= scrollspeedy;
			if (-scrollcurrenty > scrollheight-scrollcontainerheight) {
				scrollcurrenty = -(scrollheight-scrollcontainerheight);
				scrollmove = false;
			}
			sP(scrollcontent,scrollcurrentx,scrollcurrenty);
		} else {
			scrollmove = false;
		}
		if (scrollmove) {
			setTimeout("scroll()",scrollrepeat);
		}
	}
}
function scrollUp() {
	scrollmove = 'up';
	scroll();
}

function scrollDown() {
	scrollmove = 'down';
	scroll();
}

function scrollOut() {
	scrollmove = false;
}

function scrollJump(where) {
	if (where == 'top') {
		scrollcurrenty = 0;
		sP(scrollcontent,scrollcurrentx,scrollcurrenty);
	} else if (where == 'bottom') {
		scrollcurrenty = -(scrollheight-scrollcontainerheight);
		sP(scrollcontent,scrollcurrentx,scrollcurrenty);
	}
}

onload=function(){

	scrollerInit();
}