// JavaScript Document
window.step = 50;
window.container = 'scrollContainer';
window.content = 'scrollContent';
function scrollDown(){
	var containerHeight = document.getElementById(window.container).offsetHeight;
	var content = document.getElementById(window.content);
	var currentTop = content.style.top;
	if(currentTop == '')
		currentTop = 0;
	else 
		currentTop = parseInt(currentTop.replace('px',''));
	if(content.offsetHeight + currentTop > containerHeight){
		var newTop = currentTop-step;
		if((newTop * -1)>content.offsetHeight-containerHeight)
			newTop = -1*(content.offsetHeight-containerHeight);
		content.style.top = (newTop) + "px";
	}
}

function scrollUp(){
	var content = document.getElementById(window.content);
	var currentTop = content.style.top;
	if(currentTop == '')
		currentTop = 0;
	else 
		currentTop = parseInt(currentTop.replace('px',''));
	if(currentTop<0){
		var newTop = currentTop + step;
		if(newTop > 0)
			newTop = 0;
		content.style.top = (newTop)+"px";
	}
}

function scrollOptions(){
	var contentHeight = document.getElementById('scrollContent').offsetHeight;
	var containerHeight = document.getElementById('scrollContainer').offsetHeight;
	if(contentHeight > containerHeight)
		document.getElementById('arrows').style.display = 'inline';
	else
		document.getElementById('arrows').style.display = 'none';
}

function continuousScrollDown(){
	endContinuousScrollUp();
	endContinuousScrollDown();
	scrollDown();
	window.scrollDown_timeout = setInterval("scrollDown()",100);
}

function endContinuousScrollDown(){
	if (typeof(window.scrollDown_timeout) != "undefined") clearTimeout(window.scrollDown_timeout);
}

function continuousScrollUp(){
	endContinuousScrollUp();
	endContinuousScrollDown();
	scrollUp();
	window.scrollUp_timeout = setInterval("scrollUp()",100);
}

function endContinuousScrollUp(){
	if (typeof(window.scrollUp_timeout) != "undefined") clearTimeout(window.scrollUp_timeout);
}

