var scrollerWidth, scrollerHeight, scrollerLeft, scrollerTop, scrollerPause, scrollerStep;
var scrollerCLeft, scrollerCRight, scrollerCTop, scrollerCBtm;
var scrollTimer, scrollerTWidth, scrollerText;

function start() 
{
//Zegar();
window.onresize = onWinResize;

	if (scrollTimer) clearTimeout(scrollTimer);

	winW = (document.layers)? window.innerWidth-16 : document.body.offsetWidth-20;
	if (winW < 780) winW = 780;
	scrollerLeft = Math.round((winW- 780) / 2) + 45;
	
	scrollerWidth=734;
	scrollerHeight = 14;
	scrollerStep=1;
	scrollerTop=3;
	scrollerPause=20;
	
	if (document.all) {
		text.innerHTML=scrollerText;
		scrollerTWidth=text.offsetWidth;
		document.all.text.style.posTop=scrollerTop;
		document.all.text.style.posLeft=scrollerLeft+scrollerWidth;
		scrollerCLeft=0; scrollerCRight=0; scrollerCTop=0; scrollerCBtm=scrollerHeight;
		document.all.text.style.clip ="rect("+scrollerCTop+" "+scrollerCRight+" "+scrollerCBtm+" "+scrollerCLeft+")";
		scrollText();
	}
	if (document.layers) {
		document.text.document.write(scrollerText);
		document.text.document.close();
		scrollerTWidth=document.text.document.width;
		document.text.top = scrollerTop;
		document.text.left = scrollerLeft+scrollerWidth;
		document.text.clip.left=0; document.text.clip.right=0; document.text.clip.top=0; document.text.clip.bottom = scrollerHeight;
		scrollText();
	}
}


function scrollText() {
	if (document.all) {
		if (document.all.text.style.posLeft >= scrollerLeft - scrollerTWidth) {
			document.all.text.style.posLeft -= scrollerStep;
			scrollerCRight += scrollerStep;
			if (scrollerCRight > scrollerWidth) scrollerCLeft += scrollerStep;
			document.all.text.style.clip ="rect("+scrollerCTop+" "+scrollerCRight+" "+scrollerCBtm+" "+scrollerCLeft+")";
			scrollTimer=setTimeout("scrollText()",scrollerPause);
		}
		else scrollReset();
	}

	if (document.layers) {
		if (document.text.left >= scrollerLeft - scrollerTWidth) {
			document.text.left -= scrollerStep;
			document.text.clip.right += scrollerStep;
			if (document.text.clip.right > scrollerWidth) document.text.clip.left += scrollerStep;
			scrollTimer=setTimeout("scrollText()",scrollerPause);
		}
		else scrollReset();
	}
}

function scrollReset() {
	if (document.all) {
		document.all.text.style.posLeft = scrollerLeft + scrollerWidth;
		scrollerCLeft=0; scrollerCRight=0;
		document.all.text.style.clip ="rect("+scrollerCTop+" "+scrollerCRight+" "+scrollerCBtm+" "+scrollerCLeft+")";
		scrollText();
	}

	if (document.layers) {
		document.text.document.write(scrollerText);
		document.text.document.close();
		document.text.left=scrollerLeft+scrollerWidth;
		document.text.clip.left=0; document.text.clip.right=0;
		scrollText();
	}
}

function scrollSpeed(inc) {
	if (inc == 0) scrollerStep = 0;
	else scrollerStep += inc;
	if (scrollerStep >= 20) scrollerStep = 20;
	if (scrollerStep<0) scrollerStep = 0;
}

function resizeFix() {
	if (!document.layers) return;
	if (widthCheck != window.innerWidth || heightCheck != window.innerHeight)
		document.location.href = document.location.href;
}

function onWinResize() {
	resizeFix();
	start();
	//if (multitabs.length > 0)
		//initMultitab();
}

