function showHide(obj) {
    if (obj.style.display == "none") {
        show(obj);
    } else {
        hide(obj);
    } 
}
function show(obj) {
    if (obj.tagName.toLowerCase() == "div"
     || obj.tagName.toLowerCase() == "p"
     || obj.tagName.toLowerCase() == "tr") {
        // set the block style attribute
        obj.style.display = "block";
    } else if (obj.tagName.toLowerCase() == "span") {
        //set the inline style attribute
        obj.style.display = "inline";
    } else {
        // the default.
        obj.style.display = "inline";
    }
}
function hide(obj) {
    obj.style.display = "none";
    //obj.style.visibility = "hidden"; //doesn't collapse, just hides.
}

function noenter() {
    return !((window.event && window.event.keyCode == 13) || (event && event.which == 13));
}

function getX(theElement) {
 var elemPosX = theElement.offsetLeft;
 theElement = theElement.offsetParent;
 while(theElement != null) {
  elemPosX += theElement.offsetLeft;
  theElement = theElement.offsetParent;
 }
 return elemPosX;
}
function getY(theElement) {
 var elemPosY = theElement.offsetTop;
 theElement = theElement.offsetParent;
 while(theElement != null) {
  elemPosY += theElement.offsetTop;
  theElement = theElement.offsetParent;
 }
 return elemPosY;
}

function position(element,parent) {
    var x = getX(parent);
    var y = getY(parent);
    //element.style.top = y + parent.offsetHeight;
    var tempPosn = y + parent.offsetHeight + 1;
    element.style.top = tempPosn + "px";
    tempPosn = x + 5;
    element.style.left = tempPosn + "px";
}
function showMenu(menu,parent,timeoutRef) {
    var returnRef = 0;
    returnRef = cancelMenuTimeout(timeoutRef);
    position(menu,parent);
    show(menu);
    return returnRef;
}

function hideMenu(menu) {
    return window.setTimeout("hide(document.getElementById('" + menu.id +"'))",750);
}

function cancelMenuTimeout(timeoutRef) {
    if (timeoutRef != 0) {
        window.clearTimeout(timeoutRef);
    }
    return 0;
}







