var PopupWindow = ""

//************************************************************************************************
function OpenPopUp(windowsname,address,width,height,scrollbars,resizable)
{
	var w = 480, h = 340;
		
	if (document.all || document.layers)
	{
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	
	var popW = width, popH = height;
	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
	if(PopupWindow)
	{
		if(!PopupWindow.closed)
		{
			PopupWindow.close();
		}
	}
	PopupWindow = window.open(address, windowsname,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',status=1,toolbar=1,location=1,menubar=1,directories=0');
	PopupWindow.focus();
}



/* ******************************************** *
 * Help DIV for the ValveSizing Project       * */

        // get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!
        function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
        function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
        function getAbsPos(elt,which) {
         iPos = 0;
         while (elt != null) {
          iPos += elt["offset" + which];
          elt = elt.offsetParent;
         }
         return iPos;
        }
        //Displays the Help Tip... Needs the help string, target element (the element being rolled over, and which side 'L', 'R'
        function showHelpTip(str, target, side) {
            var src = document.getElementById("dvHelpTip");
            if (src!=undefined) {
                src.style.left=getAbsX(target)+(side=='L'?-330:30);
                src.style.top=getAbsY(target);
                src.style.display='block';
                src.innerHTML=str;
            }
            //window.alert(getAbsX(target)+":"+getAbsY(target));
        }
        function hideHelpTip(target) {
            var src = document.getElementById("dvHelpTip");
            if (src!=undefined) {
                src.style.display='none';
                src.innerHTML='';
            }
        }
