function getX (el) {
    if (el == null) return 0;

	var pos = el.offsetLeft;

	while ((el=el.offsetParent) != null) { pos += el.offsetLeft; }

    return parseInt (pos);
}

function getY (el) {
    if (el == null) return 0;

	var pos = el.offsetTop;

	while ((el=el.offsetParent) != null) { pos += el.offsetTop; }

    return parseInt (pos);
}

function getMousePositionX (evt) {
	if (evt.pageX) return evt.pageX + document.body.scrollLeft;
	if (evt.clientX) return evt.clientX + document.body.scrollLeft;
}

function getMousePositionY (evt) {
	if (evt.pageY) return evt.pageY + document.body.scrollTop;
	if (evt.clientY) return evt.clientY + document.body.scrollTop;
}

function getHeight (el) {
    if (el == null) return 0;

    return el.offsetHeight;
}

function getWidth (el) {
    if (el == null) return 0;

    return el.offsetWidth;
}

function getParentNodeByElementID (el, el_ID) {
    if (el == null) return null;

    do {
        if (el.id == el_ID) return el;
    } while ((el=el.parentNode) != null);

    return null;
}

function getParentNodeByElementName (el, el_Name, requireID) {
    if (el == null) return null;

    do {
        if (el.nodeName != el_Name) continue;
        if ((requireID) && (el.id == '')) continue;

        return el;
    } while ((el=el.parentNode) != null);

    return null;
}

function mouseover (name, statusMsg) {
    if (name != "") {
        document.images[name].src="images/buttons/" + name + "_mo.jpg";
    }

    window.status=statusMsg;
}

function mouseout (name) {
    if (name != "") {
        document.images[name].src="images/buttons/" + name + ".jpg";
    }

    window.status="";
}

function comingsoon () {
  alert ("Content for this section will be coming soon");
}

/*
    This function scrolls an element in a div container to the top of the div container.
    The purpose is primarily to scroll to the top of the list without needing to use
    anchor tags.

    NOTE: To ensure scrolling, there must be enough entries or blank lines to allow the
    target element to scroll to the top of the container.
*/
function scrollToTopOfList (elementName, containerName) {
    var elemObj = document.getElementById (elementName);
    var containerObj = document.getElementById (containerName);

    var newTopOffset = 0;

    // Test to see if element object has a container - if not, offset from list container object
    if (elemObj.offsetParent.className == '') {
        newTopOffset = elemObj.offsetTop - containerObj.offsetTop;
    } else {
        newTopOffset = elemObj.offsetTop;
    }

    containerObj.scrollTop = newTopOffset;
}

function disableEnterKey(e) {
    var key = (window.event) ? event.keyCode : e.which;
    return (key != 13);
}

