var overLink = 0;
var currentFrame = 1;
var maxFrames = 3;
var animation;
var frog;

function swapMenu(menuNum, menuItem, onOff) {
	clearTimeout(animation);
	
	if (onOff=='on') {
		overLink = 1;
		clearTimeout(animation);
		clearTimeout(flasher);
		clearTimeout(frog);
		anomation=false;
	}
	else {
		overLink = 0;
		clearTimeout(frog);
	}
}

function startAnimation() {
	for (i=1; i<=3; i++) {
		if (i != currentFrame) {
			document.getElementById('Image' + (i).toString()).src = '/global/images/matrix0' + (i) + '.gif';
			document.getElementById('div' + i.toString() + 'Links').style.zIndex = '5';
		}
	}
	//swapDiv(currentFrame, 1, true);
}

function duckSeason(effect) {
	overLink = effect;
}

function swapDiv(divNum, houdini, animate, trueEvent) {
	if (animate==false) {
		clearTimeout(frog);
	}
	
	if (overLink == 0) {
		if (houdini) {
			visToggle ='15';
		}
		else {
			visToggle = '5';
		}
		
		for (i=1; i<=3; i++) {
			document.getElementById('Image' + (i).toString()).src = '/global/images/matrix0' + (i) + '.gif';
			document.getElementById('div' + i.toString() + 'Links').style.zIndex = '5';
		}
		
		for (i=1; i<=3; i++) {
			if (i == divNum && !trueEvent) {
				
				document.getElementById('Image' + (divNum).toString()).src = '/global/images/matrix0' + (divNum) + '.gif';
				var flasher = setTimeout("document.getElementById('div" + divNum.toString() + "Links').style.zIndex = visToggle;", 250);
			}
			
			else {
				document.getElementById('Image' + (i).toString()).src = '/global/images/matrix0' + (i) + '.gif';
				document.getElementById('div' + i.toString() + 'Links').style.zIndex = '5';
			}

		}
		currentFrame = divNum;
		currentFrame++;
		if(currentFrame > maxFrames) {
			currentFrame=1;
		}
		
		clearTimeout(animation);
		if (animate==true) {
			animation = setTimeout("startAnimation()", 3000);
		}
	}

}