naw=navigator.appName;
if (naw == "Netscape") {
	var speed = 20;
} else {
	var speed = 7;
}


var position = 0;
var scroller_add = 0;
var slidepos = 0;

var margines = 173;
//var margines = 50;
var all = 460;
var top = -17;
var bottom = top + all;
var height = all - 32;

var u = false;
var d = false;
var grafika = 0;

var scroll_size = 16;

function up() {
	if(press) press = false;
	position = position + speed;
	if (position >= 0) {
		position = 0;
		u = false;
	}
	document.getElementById("jednatresc").style.top=position + "px";
	if (u == true)
		setTimeout('up()', 10);
	slidepos = slidepos - scroller_add;
	if (slidepos < top)
		slidepos = top;
	if (slidepos > bottom - 46)
		slidepos = bottom - 46;
	if(u) document.getElementById("scroller").style.top=Math.round(slidepos) + 'px';
	if(position == 0)
		document.getElementById("scroller").style.top=Math.round(top) + 'px';
}

function down() {
	if(press) press = false;
	if (document.getElementById("jednatresc").scrollHeight < all)
		return false;
	position = position - speed;
	if (position < document.getElementById("jednatresc").scrollHeight * -1 + all) {
		position = document.getElementById("jednatresc").scrollHeight * -1 + all;
		d = false;
	}
	document.getElementById("jednatresc").style.top=position + "px";
	if (d == true)
		setTimeout('down()', 10);
	slidepos = slidepos + scroller_add;
	if (slidepos < top)
		slidepos = top;
	if (slidepos > bottom - 46)
		slidepos = bottom - 46;
	if(d) document.getElementById("scroller").style.top=Math.round(slidepos) + 'px';
	if(position == document.getElementById("jednatresc").scrollHeight * -1 + all)
		document.getElementById("scroller").style.top=Math.round(bottom - 46) + 'px';
}

function start_slider() {
	var tresc = document.getElementById("jednatresc");
	if((tresc == null) || (tresc.scrollHeight < all)) {
		document.getElementById("scroller").style.visibility = "hidden";
		document.getElementById("scroller").style.width = "0px";
		document.getElementById("scroller").style.height = "0px";
		document.getElementById("scrollup").style.visibility = "hidden";
		document.getElementById("scrollup").style.width = "0px";
		document.getElementById("scrollup").style.height = "0px";
		document.getElementById("scrolldown").style.visibility = "hidden";
		document.getElementById("scrolldown").style.width = "0px";
		document.getElementById("scrolldown").style.height = "0px";
		return false;
	}
	var news = tresc.scrollHeight;
	scroller_add = ((height - scroll_size) / ((news - all) / speed));
	slidepos = top;
	document.getElementById("scroller").style.top=Math.round(slidepos) + 'px';
}

var press;

function move(e) {
	if (!e)
		var e = window.event;
	if (press == true) {
		slidepos = e.clientY - margines;
		if (slidepos < top)
			slidepos = top;
		else if (slidepos > bottom - 46)
			slidepos = bottom - 46;
		position = -Math.round(((slidepos - top) / scroller_add) * speed);
		if (position >= 0)
			position = 0;
		else if (position < document.getElementById("jednatresc").scrollHeight * -1 + all)
			position = document.getElementById("jednatresc").scrollHeight * -1 + all;
		document.getElementById("jednatresc").style.top=position + "px";
		document.getElementById("scroller").style.top=slidepos + "px";
	}
}

function press_down() {
	press = true;
}

function press_up() {
	press = false;
}


