var menu;
var submenu;
var menu_timer;
function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function ShowSubmenu(o, submenu_id, x, y) {
	Hide();
	menu = o;
	if(document.all) {
		submenu = document.all[submenu_id];
		if(submenu == null) return;
		submenu.style.display = "block";
		submenu.style.top = y + 24;
		submenu.style.left = x;
	} else {
		submenu = document.getElementById(submenu_id);
		if(submenu == null) return;
		submenu.style.display = "block";	
		submenu.style.top = y + 23 + "px";
		submenu.style.left = x + "px";
	}
}

function Hide() {
	ResetTimer();
	if(submenu != null) {
		submenu.style.display = "none";
	}
}		

function ResetTimer() {
	if(menu_timer!=null) {
		clearTimeout(menu_timer);
	}
}

function SetTimer() {
	menu_timer=setTimeout('Hide();', 100);
}

function ShowWindow(url, width, height) {
  paywin = window.open(url, "displayWindow","width="+width+",height="+height+",status=no,toolbar=no,menubar=no,scrollbars=no");
  paywin.moveTo(Math.ceil((window.screen.width-width)/ 2),Math.ceil((window.screen.height-height)/ 2));
  paywin.focus();
}
