var scrollcontainerwidth = 0;
var scrollcontainerheight = 110;
var scrollcontainer = false;
var scrollcontent1 = false;
var scrollcontent2 = false;
var scrollcurrent1x = 0;
var scrollcurrent1y = 0;
var scrollcurrent2x = 0;
var scrollcurrent2y = 0;
var scrollspeedy = 0; // 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 scroll() {
	if (scrollinit) {
		scrollcurrent1x += scrollspeedx;
		scrollcurrent1y += scrollspeedy;
		scrollcurrent2x += scrollspeedx;
		scrollcurrent2y += scrollspeedy;
		
		if (scrollcurrent1x > scrollcontainerwidth) {
			scrollcurrent1x = scrollcurrent2x-scrollcontainerwidth;
		}
		if (scrollcurrent1x < 0-scrollcontainerwidth) {
			scrollcurrent1x = scrollcurrent2x+scrollcontainerwidth;
		}
		if (scrollcurrent2x > scrollcontainerwidth) {
			scrollcurrent2x = scrollcurrent1x-scrollcontainerwidth;
		}
		if (scrollcurrent2x < 0-scrollcontainerwidth) {
			scrollcurrent2x = scrollcurrent1x+scrollcontainerwidth;
		}
		sP(scrollcontent1,scrollcurrent1x,scrollcurrent1y);
		sP(scrollcontent2,scrollcurrent2x,scrollcurrent2y);
		if (scrollmove) {
			setTimeout("scroll()",scrollrepeat);
		}
	}
}

function scrollOut() {
	scrollmove = false;
}

function scrollSpeed(e) {
	if(nn){xpos=e.pageX;}else{if(e)xpos=e.clientX;else xpos=event.clientX;}
	var speeds = new Array(4, 3, 2, 1, 0, -1, -2, -3, -4);
	w = docW();
	if (xpos) {
		if (xpos >= 0 && xpos < (w/9)*1) {
			speed = speeds[0];
		} else if (xpos >= xpos < (w/9)*1 && xpos < (w/9)*2) {
			speed = speeds[1];
		} else if (xpos >= xpos < (w/9)*2 && xpos < (w/9)*3) {
			speed = speeds[2];
		} else if (xpos >= xpos < (w/3)*3 && xpos < (w/9)*4) {
			speed = speeds[3];
		} else if (xpos >= xpos < (w/9)*4 && xpos < (w/9)*5) {
			speed = speeds[4];
		} else if (xpos >= xpos < (w/9)*5 && xpos < (w/9)*6) {
			speed = speeds[5];
		} else if (xpos >= xpos < (w/9)*6 && xpos < (w/9)*7) {
			speed = speeds[6];
		} else if (xpos >= xpos < (w/9)*7 && xpos < (w/9)*8) {
			speed = speeds[7];
		} else if (xpos >= xpos < (w/9)*8 && xpos < (w/9)*9) {
			speed = speeds[8];
		}
	} else {
		speed = 0;
	}
	scrollspeedx = speed;
	return true;
}

function scrollerInit() {
	scrollcontainer = gE('scrollcontainer');
	scrollcontent1 = gE('scrollcontentone', scrollcontainer);
	scrollcontent2 = gE('scrollcontenttwo', scrollcontainer);
	sS(scrollcontainer,scrollcontainerwidth,scrollcontainerheight);
	sC(scrollcontainer,0,scrollcontainerwidth,scrollcontainerheight,0);
	pos = new Array(0, 80);

	sP(scrollcontainer, pos[0], pos[1]);
	sW(scrollcontent1,scrollcontainerwidth);
	sW(scrollcontent2,scrollcontainerwidth);
	sX(scrollcontent1, 0);
	sX(scrollcontent2, scrollcontainerwidth);

	scrollcurrent1x = 0;
	scrollcurrent2x = scrollcontainerwidth;

	sE(scrollcontainer);
	sE(scrollcontent1);
	sE(scrollcontent2);
	
	aE(document, 'mousemove', scrollSpeed, true);
	scrollmove = true;
	scrollinit = true;
	scroll();
}


onload=function(){
initMenus();
scrollerInit();
}
