var currentTimeoutID;
var mainChild;
var baseHeight;
var passedHeight = 0;
var maxHeight;
var firstTime = true;

function beginScroll(){
	container = document.getElementById('vertical_scroll_container_div');
	all_children = container.getElementsByTagName('div');
	children = new Array();
	var j = 0;
	for (var i = 0; i < all_children.length; i++){
		if (all_children[i].className == 'inside_scroll_container'){
			children[j++] = all_children[i];
		}
	}
	num_children = children.length;
	baseHeight = children[0].offsetHeight;
	maxHeight = (num_children - 1) * baseHeight;
	mainChild = children[0];
	scrollStart();
}

function scrollStart(){
	if (passedHeight == maxHeight){
		passedHeight = -1 * baseHeight;
	}
	if (firstTime == true){
		passedHeight = 0;
		firstTime = false;
	}
	else {
		passedHeight = passedHeight + 10;
	}
	if (passedHeight > 0){
		pos = '-'+passedHeight+'px';
	}
	else if (passedHeight < 0){
		pos = (-1*passedHeight)+'px';
	}
	else {
		pos = '0px';
	}
	mainChild.style.marginTop = pos;
	if (passedHeight % baseHeight == 0){
		currentTimeoutID = setTimeout(function(){scrollStart()},5000);
	} else {
		currentTimeoutID = setTimeout(function(){scrollStart()},25);
	}
}
