function is_child_of(parent, child) {
    if (child != null) {
        while (child.parentNode) {
            if ((child = child.parentNode) == parent) {
                return true;
            }
        }
    }
    return false;
}

function fixOnMouseOut(element, event, JavaScript_code) {
    var current_mouse_target = null;
    if (event.toElement) {
        current_mouse_target = event.toElement;
    } else if (event.relatedTarget) {
        current_mouse_target = event.relatedTarget;
    }
    if (!is_child_of(element, current_mouse_target) && element != current_mouse_target) {
        eval(JavaScript_code);
    }
}

function HabilitarMenu(id) {
    if (id == 0) {
        $("#menu_Contern").css("display", "block");
        $("#anylinkshadow_contern").css("display", "block");

        $("#menu_Negocios").css("display", "none");
        $("#anylinkshadow_negocio").css("display", "none");
    }
    else if (id == 1) {
        $("#menu_Negocios").css("display", "block");
        $("#anylinkshadow_negocio").css("display", "block");

        $("#menu_Contern").css("display", "none");
        $("#anylinkshadow_contern").css("display", "none");
    }
}

function DesabilitaMenu(id) {
    if (id == 0) {
        $("#menu_Contern").css("display", "none");
        $("#anylinkshadow_contern").css("display", "none");
    }
    else if (id == 1) {
        $("#menu_Negocios").css("display", "none");
        $("#anylinkshadow_negocio").css("display", "none");
    }
}
