var foo1 = null;
var foo2 = null;
var foo3 = null;
var foo4 = null;
var foo5 = null;
var fooObject = null;
var filmFrame = null;
var sp1 = null;
var sp2 = null;
var sp3 = null;
var sp4 = null;
var sp5 = null;
var sp6 = null;
var sp7 = null;
var sp8 = null;
var sp9 = null;
var sp10 = null;
var sp11 = null;
var sp12 = null;
var sp13 = null;
var sp14 = null;
var counter = 0;
var spTimer = 0;
var popupShowedEn = 0;
var popupShowedPl = 0;

function init_pl() 
{
	/*
	if (popupShowedPl == 0)
	{
		alert("Uwaga!!!\n\nPokaz niedzielny ODWOLANY z przyczyn technicznych\n\nPrzepraszamy!!!");
		popupShowedPl = 1;
	}
	*/
	init_common();
}

function init() 
{
	/*
	if (popupShowedEn == 0)
	{
		alert("Special Annoncement!!!\n\n For technical reasons Sunday's battle has been canceled\n\nSorry  for inconvinience!");
		popupShowedEn = 1;
	}
	*/
	init_common();
}

function init_common()
{
	fooObject = document.getElementById('foo');
	filmFrame = document.getElementById('film');
	foo1 = document.getElementById('foo1');
	foo2 = document.getElementById('foo2');
	foo3 = document.getElementById('foo3');
	foo4 = document.getElementById('foo4');
	foo5 = document.getElementById('foo5');
	foo1.style.left = '10px';
	foo2.style.left = '305px';
	foo3.style.left = '600px';
	foo4.style.left = '895px';
	foo5.style.left = '1190px';
	setInterval(doMove, 20); // call doMove in 20msec
}

function updateObjectIframe(which)
{
	document.getElementById('foo').src = which.href;

	if ((which.href.search('sponsors.html') != -1) ||
	    (which.href.search('sponsorzy.html') != -1))
	{		
		setTimeout(init_sponsors,1500);
	}
}

function doMove() 
{
	moveObject(foo1);
	moveObject(foo2);
	moveObject(foo3);
	moveObject(foo4);
	moveObject(foo5);
	moveSponsor(sp1);
	moveSponsor(sp2);
	moveSponsor(sp3);
	moveSponsor(sp4);
	moveSponsor(sp5);
	moveSponsor(sp6);
	moveSponsor(sp7);
	moveSponsor(sp8);
	moveSponsor(sp9);
	moveSponsor(sp10);
	moveSponsor(sp11);
	moveSponsor(sp12);
	moveSponsor(sp13);
	moveSponsor(sp14);
}

function moveObject(objToMove)
{
	if (objToMove == null)
	{
		return;
	}
	if (parseInt(objToMove.style.left) > -286)
	{
		objToMove.style.left = parseInt(objToMove.style.left)-1+'px';
	}
	else
	{
		objToMove.style.left = '1190px';
	}
}

function moveSponsor(objToMove)
{
	if (objToMove == null)
	{
		return;
	}

	if (parseInt(objToMove.style.top) > -125)
	{
		objToMove.style.top = parseInt(objToMove.style.top)-1+'px';
	}
	else
	{
		objToMove.style.top = '1713px';
	}
}

function init_sponsors()
{
	counter == 0;
	var doc = null;
	if(fooObject.contentDocument)
	{
		// Firefox, Opera   
		doc = fooObject.contentDocument;
	}
	else if(fooObject.contentWindow) 
	{
		// Internet Explorer   
		doc = fooObject.contentWindow.document;
	}
	else if(fooObject.document)
	{
		// Others?   
		doc = fooObject.document;
	}

	if (doc == null)
	{
		return;
	}

	sp1 = doc.getElementById('sp1');
	sp1 = doc.getElementById('sp1');
	sp2 = doc.getElementById('sp2');
	sp3 = doc.getElementById('sp3');
	sp4 = doc.getElementById('sp4');
	sp5 = doc.getElementById('sp5');
	sp6 = doc.getElementById('sp6');
	sp7 = doc.getElementById('sp7');
	sp8 = doc.getElementById('sp8');
	sp9 = doc.getElementById('sp9');
	sp10 = doc.getElementById('sp10');
	sp11 = doc.getElementById('sp11');
	sp12 = doc.getElementById('sp12');
	sp13 = doc.getElementById('sp13');
	sp14 = doc.getElementById('sp14');
	sp1.style.top = '10px';
	sp2.style.top = '141px';
	sp3.style.top = '272px';
	sp4.style.top = '403px';
	sp5.style.top = '534px';
	sp6.style.top = '665px';
	sp7.style.top = '796px';
	sp8.style.top = '927px';
	sp9.style.top = '1058px';
	sp10.style.top = '1189px';
	sp11.style.top = '1320px';
	sp12.style.top = '1451px';
	sp13.style.top = '1582px';
	sp14.style.top = '1713px';
}

