
document.byId = function(strId) {
    if (document.getElementById)
        return document.getElementById(strId);
    else if (document.all)
        return document.all[strId];
    else if (document[strId])
        return document[strId];
    else if (document.layers && document.layers[strId])
        return document.layers[strId];
}

if (String && String.prototype) {
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, "");
    }
}

function swapImage(imgObj, strImg) {
    imgObj.old = imgObj.src;
    imgObj.src = strImg;
}

function restoreImage(imgObj) {
    imgObj.src = imgObj.old;
}

var __arrMenus = new Array(
    "profilenav", "casenav"
);

var __obMenuTimer = null;

function hideAllMenusExcept(strMenuId) {
    for (var i = 0; i < __arrMenus.length; ++i) {
        if (__arrMenus[i] != strMenuId) {
            var obMenu = document.byId(__arrMenus[i]);
            if (obMenu)
                obMenu.style.visibility = "hidden";
        }
    }
}

function showMenu(strMenuId) {
    hideAllMenusExcept(strMenuId);
    var obMenu = document.byId(strMenuId);
    obMenu.style.visibility = "visible";
}

function hideMenu(strMenuId) {
    var obMenu = document.byId(strMenuId);
    obMenu.style.visibility = "hidden";
}

function menuMouseOver(strMenuId) {
    if (__obMenuTimer) {
        clearTimeout(__obMenuTimer);
        __obMenuTimer = null;
    }
    showMenu(strMenuId);
}

function menuMouseOut(strMenuId) {
    __obMenuTimer = setTimeout("hideMenu('" + strMenuId + "')", 500);
}


