/*
  * function scroll();
  * authors: Liudas Markevicius liumis@liumis.com
  * params: content Content id
  *			positin (up/down: 1/0)
  *			action start/stop: 1/0
  */
var time = false;
var limit = 0;

function scroll_div( content, position, action ) {
	if (action == 0) {
		if ( time ) {
			clearTimeout( time );
		}
	} else {
		var scroll_content = document.getElementById( content );
		var top_margin = parseInt(scroll_content.style.marginTop);
		var step;
		if ( position == 0 ) {
			limit = bot_limit;  // -- hackas +1 :D :D (medutis)
			step = -1;
		} else {
			limit = 0;
			step = 1;
		}
		if ( top_margin == limit ) {
			if ( time ) {
				clearTimeout( time );
			}
			return false;
		}
		
		scroll_content.style.marginTop = top_margin + step +'px';
		
		time = window.setTimeout("scroll_div('"+ content +"', "+ position + ", " + action + ")", 1);
	}
}
function getBotLimit( outer, scroll ) {
	try {
		var bot_limit = document.getElementById('outer').offsetHeight - document.getElementById('scroll').offsetHeight;
		if ( bot_limit > 0) {
			bot_limit = 0;
		}
		return bot_limit;
	}
	catch ( e ) {
	
	}
}