/* Popup Functions */

var currentPopup = 0;

 
 function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
        obj.style.zIndex = iState ? "105" : "0";
        obj.style.display= iState ? "inline" : "none"; 
        obj.style.zIndex=0
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}


function showPopup(obj,divname) {	
	
	if (currentPopup==0) {
	var popupDiv = document.getElementById([divname]);
	
	popupDiv.style.top = getTop(obj) + "px";
	
	if (obj.className.length == 7) {
		popupDiv.style.left = getLeft(obj) + 168 + "px";
		popupDiv.className = "popupLeft";
	} else {
		popupDiv.style.left = getLeft(obj) - 364 + "px";
		popupDiv.className = "popupRight";
	}
	
	currentPopup = 1;
	
	popupDiv.style.display = "block";
	}
	else {
	hidePopup([divname])
	}
}

function hidePopup(divname) {
	document.getElementById([divname]).style.display = "none";
	currentPopup = 0;
}

function delayHidePopup(num) {
	if (!num || currentPopup != num) {
		window.setTimeout("hidePopup()",1000);
	}
}

// Get the top position
function getTop(div) {
	yPos = div.offsetTop;
	tempEl = div.offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
}
	
	return yPos;
}

// Get the left position
function getLeft(div) {
	xPos = div.offsetLeft;
	tempEl = div.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	
	return xPos;
}


