﻿function setMasterTemplateMenuEffects()
{
   // $("#divUtilityMenu a[disabled='true']:contains('|')").css("color", "#CCCCCC");

    /*This workaround accounts for the fact that ie7 and safari 3 do not recognize min-width.  The causes the "home" menu item not to look as designed*/
    $("#divHdrNav").find("div.main td.menuItem:first").css("width", "85px");
    /*****************************************************************************/

}
/******************Child Menu**********/

var cssImagesFolderPath = "/App_Skin/Menu_Child/";

$(document).ready(function() {
    $("tr.between", "#leftNav").each(function() {
        var _this = $(this)
        , bg
        , prev = _this.prev("tr")
        , next = _this.next("tr");
        bg = "\"" + cssImagesFolderPath +
        prev.attr("class") + "_" +
        next.attr("class") + "_between.gif\"";
        _this.find("td:first").css("background", "url(" + bg + ") no-repeat");
    });

    $("tr td:not('.selected') a", "#leftNav").hover(function() {
        var _this = $(this);
        arrowOn(_this);
        hoverOn(_this);
    }, function() {
        var _this = $(this);
        arrowOff(_this);
        hoverOff(_this);
    });
});
var classHolderPrev, classHolderNext;
function arrowOn(_this) {
    var arrow = _this.find("span");
    arrow.attr("class", arrow.attr("class") + "_hover");
}
function arrowOff(_this) {
    var arrow = _this.find("span");
    arrow.attr("class", arrow.attr("class").replace(/_hover/, ""));
}
function hoverOn(_this) {
    var bg
    , parent
    , prev
    , prevClass = ""
    , next
    , nextClass = "";
    classHolderPrev = "";
    classHolderNext = "";
    parent = _this.parent().parent();
    if (!parent) { return false; }
    prev = parent.prev("tr.between");
    if (prev.length > 0) {
        prevClass = prev.prev("tr").attr("class");
        bg = cssImagesFolderPath + prevClass + "_hover_fore.gif";
        classHolderPrev = prev.find("td:first").css("background");
        prev.find("td:first").css("background", "url(" + bg + ") no-repeat");
    }
    next = parent.next("tr.between");
    if (next.length > 0) {
        nextClass = next.next("tr").attr("class");
        bg = cssImagesFolderPath + nextClass + "_hover_behind.gif";
        classHolderNext = next.find("td:first").css("background");
        next.find("td:first").css("background", "url(" + bg + ") no-repeat");
    }
}
function hoverOff(_this) {
    var bg
    , parent
    , prev
    , prevClass = ""
    , next
    , nextClass = "";
    parent = _this.parent().parent();
    if (!parent) { return false; }
    prev = parent.prev("tr.between");
    if (prev.length > 0) {
        prevClass = prev.prev("tr").attr("class");
    }
    next = parent.next("tr.between");
    if (next.length > 0) {
        nextClass = next.next("tr").attr("class");
    }
    if (classHolderPrev != "") {
        prev.find("td:first").css("background", classHolderPrev);
    }
    if (classHolderNext != "") {
        next.find("td:first").css("background", classHolderNext);
    }
}