var old_id = 0;
var isCurrentVisible = false;
var bAutoShow = true;
var hide_timeout = 1000;
var old_timeout = 0;
var main_timeout = 0;

function isMenuVisible(id) {
	if (id != 0) {
		if (document.getElementById("mnu_" + id).style.display == "") {
			return true;
		}
		else {
			return false;
		}
	}
	else {
		return false
	}
}

function showMenu_noMain(id) {
	clearTimeout(old_timeout);

	if (isMenuVisible(old_id) == true && id != old_id) {		
		hideMenu_noTimer(old_id);
	}
	
	if (bAutoShow == true) {
		if (document.getElementById("ifra_" + id)) {
			showIFrame_noSize("ifra_" + id);
		}

		document.getElementById("mnu_" + id).style.display = "";
		old_id = id;
	}
}

function showMenu(id) {
	clearTimeout(main_timeout);
	showMenu_noMain(id);
}

function hideMenu_noTimer(id) {
	document.getElementById("mnu_" + id).style.display = "none";

	if (document.getElementById("ifra_" + id)) {
		document.getElementById("ifra_" + id).style.display = "none";
	}

	old_id = 0;
}

function hideMenu(id) {
	clearTimeout(old_timeout);
	old_timeout = setTimeout("hideMenu_noTimer('" + id + "');", hide_timeout);
}

function rollover(imgID,pathImg) {
	var thisimg = document.getElementById(imgID);
	thisimg.src = pathImg;
	thisimg.title = pathImg;
}

function showMainMenu(idMain, idFrame) {
	document.getElementById(idMain).style.display = "";
	showIFrame(idFrame);
}

function hideMainMenu_noTimer(idMain) {
	document.getElementById(idMain).style.display = "none";
}

function hideMainMenu(idMain) {
	clearTimeout(main_timeout);
	main_timeout = setTimeout("hideMainMenu_noTimer('" + idMain + "');", hide_timeout);
}

function showIFrame(idFrame) {
	var useragent = navigator.userAgent;
	var pos = useragent.indexOf('MSIE');
	if (pos > -1) {
		var sVer = useragent.substring(pos + 5);
		var pos = sVer.indexOf(';');
		var nVer = parseFloat(sVer.substring(0, pos));
		
		if (nVer < 7) {
			docwidth = document.body.clientWidth; 
			docheight = document.body.clientHeight; 

			document.getElementById(idFrame).style.width = docwidth - 200;
			document.getElementById(idFrame).style.height = docheight - 50;

			document.getElementById(idFrame).style.display = "block";
		}
	}
}

function showIFrame_noSize(idFrame) {
	var useragent = navigator.userAgent;
	var pos = useragent.indexOf('MSIE');
	if (pos > -1) {
		var sVer = useragent.substring(pos + 5);
		var pos = sVer.indexOf(';');
		var nVer = parseFloat(sVer.substring(0, pos));
		
		if (nVer < 7) {
			document.getElementById(idFrame).style.display = "block";
		}
	}
}
