var TimeOut = 8000;
var chmvTimer = null;
var mvarr = new Array('#top_mv1','#top_mv2','#top_mv3','#top_mv4','#top_mv5');
var currentMV = 0;

var mvnoch = false;

function initTimer() {
	$("#top_mv_loader").fadeOut(1000,function() {
		initMV('#top_mv1');
	});
}

function initMV(trg) {
	currentMV = 0;
	$("#top_mv").fadeOut(
		"slow",
		function() {
			$(this).html($(trg).html());
			$(this).fadeIn();
		}
	);
	chmvTimer = setTimeout("cycleMV()", TimeOut);
}

function cycleMV() {
	if (mvnoch) {
		mvnoch = false;
	} else {
		changeMV(0);
	}
	chmvTimer = setTimeout("cycleMV()", TimeOut);
}

function changeMV(par) {
	if (par != 0) {
		currentMV = par - 1;
		mvnoch = true;
	} else {
		currentMV++;
		if (currentMV > 4) {
			currentMV = 0;
		}
	}
	$("#top_mv").fadeOut(
		"slow",
		function() {
			$(this).html($(mvarr[currentMV]).html());
			$(this).fadeIn();
		}
	);
}


