
var PozycjaX = 0;
var PozycjaY = 0;
var ScrollingTest = 0;
var TempoScroll = 14;

function ScrollingStart(wyzej, elem, kurs, skok)
{
	PozycjaY = parseInt(document.getElementById(wyzej).style.width);
	ScrollingTest = 1;
	Scrolling(wyzej, elem, kurs, skok);
}

function ScrollingStop()
{
	ScrollingTest = 0;
}

function Scrolling(wyzej, elem, kurs, skok)
{
	var MaxOffsetWidth = document.getElementById(elem).offsetWidth - document.getElementById(wyzej).offsetWidth;
	var MaxOffsetHeight = document.getElementById(elem).offsetHeight - document.getElementById(wyzej).offsetHeight;
	var FunctionRekurencja = "Scrolling('" + wyzej + "', '" + elem + "', '" + kurs + "', " + skok + ")";
	
	
	switch(kurs)
	{
		
		case 'right':
			var temp = PozycjaY * (-1);
			if(temp < MaxOffsetWidth)
			{
				PozycjaY = PozycjaY - skok;
				document.getElementById(elem).style.marginLeft = PozycjaY + "px";
				if(ScrollingTest == 1)
					setTimeout(FunctionRekurencja, TempoScroll);
			}
			else
			{
				PozycjaY = parseInt(document.getElementById(wyzej).style.width);
				document.getElementById(elem).style.marginLeft = PozycjaY + "px";
				setTimeout(FunctionRekurencja, TempoScroll);
			}
			break;
	}
}



function YesNo( strona, pytanie )
{
	if(confirm(pytanie))
		location = strona;
}

