scrollskok=10
scrolltime=40
var scrollint
var trescstronki

function wysokosc()
{
	trescstronki=document.getElementById('trescstrony')
	if (!trescstronki)
		trescstronki=document.getElementById('trescstrony2')
	trescstronki.style.overflow='hidden'
	viewheight=trescstronki.clientHeight
	if (viewheight<trescstronki.scrollHeight) {
		document.getElementById('scrollup').style.display='block'
		document.getElementById('scrollup').style.visibility='hidden'
		document.getElementById('scrolldown').style.display='block'
		trescstronki.scrollTop=0
	}
}

function scrolltresc(direction)
{
	if (scrollint) clearInterval(scrollint)
	scrollit(direction)
	if (direction==1)
		scrollint=setInterval("scrollit(1)",scrolltime)
	else
		scrollint=setInterval("scrollit(-1)",scrolltime)
	return false
}

function scrollit(direction)
{
	trescstronki=document.getElementById('trescstrony')
	if (!trescstronki)
		trescstronki=document.getElementById('trescstrony2')
	viewheight=trescstronki.clientHeight
	trescstronki.scrollTop=trescstronki.scrollTop+direction*scrollskok
	if (trescstronki.scrollTop==0)
		document.getElementById('scrollup').style.visibility='hidden'
	else
		document.getElementById('scrollup').style.visibility='visible'
	if (trescstronki.scrollTop==trescstronki.scrollHeight-viewheight)
		document.getElementById('scrolldown').style.visibility='hidden'
	else
		document.getElementById('scrolldown').style.visibility='visible'
	return false
}

function stopscroll()
{
	if (scrollint) clearInterval(scrollint)
	return false
}

function scrollstart()
{
	if (scrollint) clearInterval(scrollint)
	trescstronki=document.getElementById('trescstrony')
	if (!trescstronki)
		trescstronki=document.getElementById('trescstrony2')
	trescstronki.scrollTop=0
	document.getElementById('scrollup').style.visibility='hidden'
	document.getElementById('scrolldown').style.visibility='visible'
	return false;
}

function scrollkoniec()
{
	if (scrollint) clearInterval(scrollint)
	trescstronki=document.getElementById('trescstrony')
	if (!trescstronki)
		trescstronki=document.getElementById('trescstrony2')
	viewheight=trescstronki.clientHeight
	trescstronki.scrollTop=trescstronki.scrollHeight-viewheight
	document.getElementById('scrollup').style.visibility='visible'
	document.getElementById('scrolldown').style.visibility='hidden'
	return false;
}
