var scrolltimer;
var amount = 10;	//v px
var speed = 50;		//v milisekundi
var cont;


function vertScroll(id, dir) {
 obj = document.getElementById(id);
 cont = document.getElementById('short_news');
 if (dir == 'up' && obj) {
	moveUp(obj);
 }
 if (dir == 'dw' && obj) {
   moveDwn(obj); 
 }
}

function moveUp(obj) {
	top_bound = parseInt(cont.style.top) + parseInt(cont.offsetHeight);
	y_pos = parseInt(obj.style.top);
	bottom = parseInt(obj.style.top) + parseInt(obj.offsetHeight)+ parseInt(cont.offsetHeight);

	if (obj && cont) {
		if (top_bound < bottom) {
		obj.style.top = y_pos - parseInt(amount) + 'px';
		scrolltimer = setTimeout("moveUp(obj)", speed);
		} 
	}
}

function moveDwn(obj) {
	y_pos = parseInt(obj.style.top);
	
	if (obj && cont) {
		if (y_pos + parseInt(cont.style.top) < parseInt(cont.style.top)) {
			obj.style.top = y_pos + parseInt(amount) + 'px';
			scrolltimer = setTimeout("moveDwn(obj)", speed);
		}
	}	
}

function stopScroll() {
	clearTimeout(scrolltimer);
}
