// JavaScript Document

var ids;
var iframe, navRoot;

function showMenu(menu, left, top) {
	//if(show) {
		
		if(navRoot) {
			navRoot.className = "menu";
		}
		
		document.getElementById(menu + "_menu").className = "menu_over";
		
		var menuItem = document.getElementById(menu);
		
		navRoot = document.getElementById(menu + "_menu");
//		navRoot.className = "menu_over";
		ids = setTimeout("showCurrentMenu()", 500); 
		
		var obj = document.getElementById(menu) || document.images[menu] || 
								document.links[menu] || document.anchors[menu];
								
		navRoot.style.left = left = moveXbySlicePos(left, obj);
		navRoot.style.top = top = moveYbySlicePos(top, obj);
		
		navRoot.style.zindex = 100;
		
		for (i=0; i < navRoot.childNodes.length; i++) {
			  node = navRoot.childNodes[i];
              /*node.onmouseover = function() {
				clearTimeout(ids);
				ids = setTimeout("showCurrentMenu()", 1000); 
			  }
			  
			  node.onmouseout = function() { 
			  	//navRoot.className = "menu"; 
				ids = setTimeout("hideCurrentMenu()", 1500);
			  };*/
		}
		
		//ids = setTimeout("hideCurrentMenu()", 6000);
}

function showCurrentMenu() {
	navRoot.className = "menu_over";
}

function hideCurrentMenu() {
	navRoot.className = "menu";
}

function getIFrame(menu) {
    return document.getElementById(menu + "_iframe");
}

function moveXbySlicePos (x, img) { 
	if (!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
			if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
			if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}
	} else if (img.x) x += img.x;
	return x;
}

function moveYbySlicePos (y, img) {
	if(!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}		
	} else if (img.y >= 0) y += img.y;
	return y;
}

function hideMenu(menu) {
	document.getElementById(menu + "_menu").className = "menu";
}
