var imgOLED;
var counter;
var ujkep;
var indexrol;
var elsokep;
var OLEDSwapCounter;
var OLEDTimeCounter;
OLEDTimeCounter = 0;
OLEDSwapCounter = 0;

img1 = new Image();
img1.src = "http://www.nexttimes.eu/pix/png/bg_ultimate_hor.png";
img2 = new Image();
img2.src = "http://www.nexttimes.eu/pix/jpg/bgu_footer_load.jpg";
img3 = new Image();
img3.src = "http://www.nexttimes.eu/pix/jpg/bguscreen_loading.jpg";
img4 = new Image();
img4.src = "http://www.nexttimes.eu/pix/jpg/bguscreen_default.jpg";
img5 = new Image();
img5.src = "http://www.nexttimes.eu/pix/jpg/bguscreen_a-fonok.jpg";
img6 = new Image();
img6.src = "http://www.nexttimes.eu/pix/jpg/bguscreen_dr-csont.jpg";
img7 = new Image();
img7.src = "http://www.nexttimes.eu/pix/jpg/bguscreen_odaat.jpg";
img8 = new Image();
img8.src = "http://www.nexttimes.eu/pix/png/tv_169.png";

function SwapCounterAdd(file2swap) {
	document.getElementById('OLED_switch').innerHTML = '<img src="http://www.magnificat.cc/pix/gif/spacer.gif" alt="" title="" onload="javascript:OLED_swap(\'' + file2swap + '\')" />';
	OLEDSwapCounter++;
}

function OLED_swap(ujkep) {
	if (ujkep == 'index') {
		elsokep = '0';
	} else {
		elsokep = ujkep;
	}
	imgOLED = new Image();
	imgOLED.src = "../pix/png/bg_header-pix-" + elsokep + ".png";
	t=setTimeout('OLEDSwapGo("header-pix")',OLEDTimeCounter + 3000);
	if ((OLEDSwapCounter == 0) && (ujkep == 'index')) {
		t=setTimeout('SwapCounterAdd("1")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 1) {
		t=setTimeout('SwapCounterAdd("2")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 2) {
		t=setTimeout('SwapCounterAdd("3")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 3) {
		t=setTimeout('SwapCounterAdd("4")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 4) {
		t=setTimeout('SwapCounterAdd("5")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 5) {
		t=setTimeout('SwapCounterAdd("6")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 6) {
		t=setTimeout('SwapCounterAdd("7")',OLEDTimeCounter + 9000);
	} else if (OLEDSwapCounter == 7) {
		t=setTimeout('SwapCounterAdd("0")',OLEDTimeCounter + 9000);
		OLEDSwapCounter = 0;
	}
};

function OLEDSwapGo(divTheatre,pic) {
	/*document.getElementById("theatre").style.background="background-image: url('" + imgOLED.src + "') no-repeat";*/
	var m = $(divTheatre);
	var fx = new Fx.Tween(m,{
		duration: 1500,
		onComplete: function(){ 
				m.setStyle('background-image','url(' + imgOLED.src + ')');
				m.fade('in');
		}
	});
	fx.start('opacity',1,0);
	OLEDTimeCounter + 1500;
};

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("navlist");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			node.onmouseover=function() {
				this.className+=" over";
			}
			node.onmouseout=function() {
				this.className=this.className.replace(" over", "");
			}
		}
		}
	}
}
window.onload=startList;
