var curPopup = null;
var timer1 = 0;
var hide_delay = 100;
var tstat = 0;

function _onMouseOver(obj){
	var str = obj.innerHTML;
	if (str.match(/О компании/)){
		popupShow("AboutMenu", obj);
	}
}

function _onMouseOut(obj){
	hideMenu();
}

function popupShow(ppMenu, ppParent){
	cancelHide();
	var divId = document.getElementById("div"+ppMenu);
	if (divId == null){
		return;
	}
	if (curPopup != null){
		curPopup.style.visibility = "hidden";
	}
	//var menuId = document.getElementById(ppMenu);
	var menuId = ppParent;
	divId.style.left = (absPosition(menuId).x) + "px";
	divId.style.top = (absPosition(menuId).y + menuId.clientHeight) + "px";

	divId.style.visibility = "visible";
	curPopup = divId;
}

function absPosition(obj) {
	var x = y = 0;
	while(obj) {
		x += obj.offsetLeft;
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return {x:x, y:y};
}

function popupHide(){
	if (curPopup != null){
		if (tstat == 1) {
			curPopup.style.visibility = "hidden";
		}
	}
}

function hideMenu(){
	timer1 = setTimeout("popupHide()", hide_delay);
	tstat = 1;
}

function cancelHide(){
	if (tstat == 1) {
		clearTimeout(timer1);
	}
	tstat=0;
}

function popupHideAll(){
	var _divList = document.getElementsByTagName('div');
	for(var i=0; i < _divList.length; i++){
		_divList[i].style.visibility = "hidden";
	}
}