
function __IMAGEMAP_doPostBack(e, formName, imageMapName, hotSpotIndex)
{
	var theForm = document.forms[formName];
	if (!theForm) {
	    theForm = document.getElementById(formName);	
	}
	if(theForm.onsubmit && (theForm.onsubmit == true)) {
	    return;
	}
	if (!e) {
    	var e = window.event;
    }
    var offsets = {offsetX : 0, offsetY : 0};
	if (e.offsetX || e.offsetY) {
		offsets.offsetX = e.offsetX;
		offsets.offsetY = e.offsetY;
	} else {
	    offsets = __IMAGEMAP_getOffsets(e);
	}
	theForm.__EVENTTARGET.value = imageMapName;
	theForm.__EVENTARGUMENT.value = hotSpotIndex;
	theForm.__IMAGEMAP_X.value = offsets.offsetX;
	theForm.__IMAGEMAP_Y.value = offsets.offsetY;
	theForm.submit();
}

function __IMAGEMAP_getOffsets (e) {
    var target = e.target;
    if (typeof target.offsetLeft == 'undefined') {
        target = target.parentNode;
    }
    var pageCoords = __IMAGEMAP_getPageCoords(target);
    var eventCoords = { 
        x: window.pageXOffset + e.clientX,
        y: window.pageYOffset + e.clientY
    };
    var offsets = {
        offsetX: eventCoords.x - pageCoords.x,
        offsetY: eventCoords.y - pageCoords.y
    }
    return offsets;
}

function __IMAGEMAP_getPageCoords (element) {
    var coords = {x : 0, y : 0};
    while (element) {
        coords.x += element.offsetLeft;
        coords.y += element.offsetTop;
        element = element.offsetParent;
    }
    return coords;
}

function __IMAGEMAP_setStatus(text)
{
    setTimeout("window.status = '" + text + "';return true;", 0);
    return true;
}


