var xOffset = 0;
var yOffset = 0;
function showPopup (targetObjectId, eventObj,xpos,ypos,thesource,nohideexisting)
{
	if (targetObjectId != window.currentlyVisiblePopup)
    	{
		if(eventObj)
		{
			if (!nohideexisting)
			{
				hideCurrentPopup();
			}
			eventObj.cancelBubble = true;
			var img = document.images[thesource];
			var pos = getXYcoord(thesource);
			if (xpos == -1)
			{
				var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
			}
			else
			{
				var newXCoordinate = (eventObj.pageX)?xpos + pos.x :xpos + pos.x + ((document.body.scrollLeft)?document.body.scrollLeft:0);
			}
			if (ypos == -1)
			{
				var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
			}
			else
			{
				var newYCoordinate = (eventObj.pageY)?ypos + pos.y :ypos + pos.y  + ((document.body.scrollTop)?document.body.scrollTop:0);
			}
			if (document.images[thesource] == null)
			{
				newXCoordinate = pos.x + xpos;
				newYCoordinate = pos.y + ypos;
			}
			moveObject(targetObjectId, newXCoordinate, newYCoordinate);
			if( changeObjectVisibility(targetObjectId, 'visible','block')) 
			{
				window.currentlyVisiblePopup = targetObjectId;
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
}
function hideCurrentPopup()
{
    if(window.currentlyVisiblePopup)
	{
		changeObjectVisibility(window.currentlyVisiblePopup, 'hidden','none');
		window.currentlyVisiblePopup = false;
    }
}
window.addOnload(initializeHacks);
document.onclick = hideCurrentPopup;
function initializeHacks()
{
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) && (navigator.platform.indexOf('Mac') != -1)	&& getStyleObject('blankDiv')) { window.onresize = explorerMacResizeFix; }
    resizeBlankDiv();
    createFakeEventObj();
}
function createFakeEventObj() {if (!window.event) { window.event = false; } }
function resizeBlankDiv()
{
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) && (navigator.platform.indexOf('Mac') != -1)	&& getStyleObject('blankDiv'))
	{
		getStyleObject('blankDiv').width = document.body.clientWidth - 20;
		getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}
function explorerMacResizeFix () { location.reload(false); }

