// JavaScript Document
function getFormElementValue(formname, elementname) {
		var value = document.getElementsByName(elementname)[0].value;
	return value;		
}

function checkBrowser ()
{
	if (navigator.userAgent.indexOf("Opera")!=-1
    && document.getElementById) type="OP";

	if (document.all) type="IE";	

	if (document.layers) type="NN";
	
	if (!document.all && document.getElementById) type="MO";
	
	return type;
}

function getPageCoords (element) {
     /*var element;
     if (document.all)
       element = document.all[elementId];
     else if (document.getElementById)
       element = document.getElementById(elementId);
     */
	 if (element) {
       var coords = {x: 0, y: 0};
       do {
		if(element.currentStyle)
		{
			if(element.currentStyle.position!='relative')
			{
				coords.x += element.offsetLeft;
				coords.y += element.offsetTop;
			}
		}
		else
		{
			coords.x += element.offsetLeft;
			coords.y += element.offsetTop;
		}

         element = element.offsetParent;
       }
       while (element)
       return coords;
     }
     else
       return null;
    }

function showPopup (icon, popupId)
{
	if (checkBrowser() == "IE")
	{
		var coords = getPageCoords(icon);
    	if (coords)
      	{
			posx = parseInt(coords.x) + 16;
			posy = parseInt(coords.y) - parseInt(document.getElementById(popupId).offsetHeight) - 3;
		}
		document.getElementById(popupId).style.posLeft = posx;
		document.getElementById(popupId).style.posTop = posy;
		document.getElementById(popupId).style.visibility = "visible";
	}
	if (checkBrowser() == "MO")
	{
		posx = icon.x;
		posy = icon.y;
		document.getElementById(popupId).style.left = (posx + 16) + "px";
		document.getElementById(popupId).style.top = (posy - document.getElementById(popupId).offsetHeight - 3) + "px";
		document.getElementById(popupId).style.visibility = "visible";
	}
}


function hidePopup (id)
{
	document.getElementById(id).style.visibility = "hidden";
}
