﻿$(function() {
    var currentUrl = window.location.pathname;
    $(".primaryNavItem").each(function() {
        if (currentUrl == $(this).attr("href")) {
            $(this).css("font-weight", "bold").css("text-decoration", "underline");
        }
    });
    $(".secondaryNavItem").each(function() {
        if (currentUrl == $(this).attr("href")) {
            $(this).css("font-weight", "bold").css("text-decoration", "underline");
            $(this).before("<span style='color:white;'>►</span>");

            //find the parent

            var parent = $(this).prev();
            while (parent != null) {
                if (parent.hasClass("primaryNavItem")) {
                    parent.css("font-weight", "bold").css("text-decoration", "underline");
                    return;
                }
                parent = parent.prev();
            }
        }
    });
});