var hide  = true;

function showhide(obj)
{
	var x = new getObj('testP');
	hide = !hide;
	x.style.visibility = (hide) ? 'hidden' : 'visible';
	setLyr(obj,'testP');
}

function setLyr(obj,lyr,LoR)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	//if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	
	if (LoR == 'left') {
	x.style.left = newX+120 + 'px';
	x.style.top = newY + 'px';
	} else {
	x.style.left = newX + 'px';
	x.style.top = newY+18 + 'px';
	}
	x.style.visibility = "visible";
}
function setLyr2(lyr)
{
	var x = new getObj(lyr);
	x.style.visibility = "visible";
}

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;
	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	window.status = printstring;
	return curtop;
}


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}

function showPopMenu(parentItem, menuItem) {
      //alert(findPosY(parentItem));
	  //alert(findPosX(parentItem));
}

function hidePopMenu(menu) {
     document.getElementById(menu).style.visibility = "hidden";
}
	  
function showSubMenu(subId) {
	document.getElementById(subId).style.display="block";
	if (Number(subId) != 0) {
	document.getElementById(Number(subId)-1).style.display="none";
	}
}