﻿var sc_container;
var sc_content;
var sc_clipheight;
var sc_contentheight;
var sc_scrollrange;
var sc_position;
var sc_intervall;

function init_scroll(Container, Content) {
	sc_container = document.getElementById(Container);
	sc_content = document.getElementById(Content);
	sc_clipheight = sc_container.offsetHeight;
	sc_contentheight = sc_content.offsetHeight;
	sc_scrollrange = sc_contentheight - sc_clipheight;
	sc_position = 0;
}

function scroll(amount, speed) {
	sc_interval = setInterval("do_scroll(" + amount + ")", speed);
}

function stop_scroll() {
	clearInterval(sc_interval);
}	

function do_scroll(amount) {
	sc_position += amount;
	if (sc_position <= 0) {sc_position = 0; stop_scroll();} 
	if (sc_position >= sc_scrollrange) {sc_position = sc_scrollrange; stop_scroll();}
	sc_content.style.top = -sc_position + "px";
}
