// scroll steps in pixels
var step = 5
// interval in ms for each scrollstep
var interval = 25

var max_height=1000000 
var cntr=0
var intervalid = 50;
var direction='down'
var currPos = 0
		   
function do_scroll() {

	cntr = document.getElementById('content').scrollTop
	
	if(document.getElementById('content').scrollTop == currPos && currPos != 0) {
		if(direction == 'down') { direction = 'up' } else { direction = 'down' }
		currPos = 100000000
	} else {
		currPos = document.getElementById('content').scrollTop
	}
	
	if(direction == 'down') {
		cntr+=step
		document.getElementById('content').scrollTop = cntr
		if(cntr >max_height) {
			direction = 'up'
		}
	}
	
	if(direction == 'up') {
		cntr-=step
		document.getElementById('content').scrollTop = cntr
		if(cntr<=0) {
			direction = 'down'
			//cntr =+5
		}
	}
}

//stop the scroll
function clear_interval(){
	clearInterval(intervalid);
	return false
}

function loop_scroll(){
	intervalid=setInterval("do_scroll()",50)
	return false
}

