var unself;
var activeInfo = 0;
var	isNS = (navigator.appName == "Netscape");
var isMacIE = ( (navigator.userAgent.indexOf("IE 4") > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );
var layerRef = (isNS) ? "document" : "document.all";
var styleRef = (isNS) ? "" : ".style";

function getXCoord(imgID) {
	if (isNS) xPos = document.images[imgID].x;
	else xPos = getIEXCoord(imgID)
	
	return xPos;
}

function getYCoord(imgID) {
	if (isNS) yPos = document.images[imgID].y;
	else yPos = getIEYCoord(imgID);
	
	return yPos;
}

function getIEXCoord(imgElem) {
	
	
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getIEYCoord(imgElem) {
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}

function activateInfo(layerId, imageName, left, top) {
		if (activeInfo) hideInfo(activeInfo); 
		activeInfo = layerId;
		
		var myElem = document.getElementById(imageName);
		var divLayer = document.getElementById (layerId);	
		//divLayer.style.pixelLeft = getIEXCoord(myElem) + left;
		//divLayer.style.pixelTop = getIEYCoord(myElem) + top;
		
		// DR 04-21-09 cross browser fix
		divLayer.style.left = getIEXCoord(myElem) + left + "px";
		divLayer.style.top = getIEYCoord(myElem) + top + "px";
		showInfo(layerId, left, top);
}

function showInfo(layerID, left, top) {
	eval("document.getElementById('"+layerID+"')").style.visibility='visible';
	eval("document.getElementById('"+layerID+"')").style.display='inline';
	
//	eval('document.getlayerRef + '["' + layerID + '"]' + 
//	styleRef + '.visibility = "visible"');
}

function hideInfo(layerID) {
	eval("document.getElementById('"+layerID+"')").style.visibility='hidden';
	eval("document.getElementById('"+layerID+"')").style.display='none';
	
}

// check if there's a info active
function turnOff() {
	
    if (activeInfo) {
        infoID = activeInfo;
        hideInfo(infoID);
        activeInfo = 0;
    }
}
