﻿document.forms[0].action = '';
$(document).ready(function() {

    //gives any container with the class .smallRoundedCorners rounded corners
    $(function() {
        $('.smallRoundedCorners').append('<div class="smallRoundedUL"></div><div class="smallRoundedLL"></div><div class="smallRoundedLR"></div><div class="smallRoundedUR"></div>');
    });

    //used for the asp.net sitemap control to turn the seperator arrows to the desired format.
    var bcitem = $('#breadcrumb span span');
    for (var i = 0; i < bcitem.length; i++) {
        if (bcitem[i].textContent == " » ") {
            $(bcitem[i]).addClass("BreadCrumbArrow");
        }
    }
    
    
    document.getElementById("navLinks");
    //controls the main navigation during hover state
    $('#navLinks > li').hover(
    function() { changeNav(this.id); },
    function() { changeNavBack(this.id); });

    var hoveredId = "none";
    var navOn = "";

    function changeNav(navId)//action for when mouse pointer is hovering over item
    {
        var id = "#subNav" + navId;
        $(id).removeClass('hide');
        $(id).addClass('show');

        if ($(id).hasClass('current')) { return false; }
        else {
            $('.current').removeClass('show');
            $('.current').addClass('hide');
        }
    }

    function changeNavBack(navId)//action for mouse pointer leaving item
    {
        navOn = "in the code";
        var id = "#subNav" + navId;
        $(id).removeClass('show');
        $(id).addClass('hide');
        $('.current').removeClass('hide');
        $('.current').addClass('show');

        hoveredId = navId;
    }

    $('#subNav > ul').hover(
        function() { subNavHover(this.id); },
        function() { subNavOff(this.id); });

    function subNavHover(navId) {
        if (hoveredId == "none") { return false; }
        else {
            $('.current').addClass('hide');
            $('#subNav' + hoveredId).removeClass('hide');
            $('#subNav' + hoveredId).addClass('show');
            if ($('#' + hoveredId).attr('class') != "activeNavItem")
                $('#' + hoveredId).addClass('subNavHovered');
        }
    }

    function subNavOff(navId) {
        $('#subNav' + hoveredId).addClass('hide');
        $('.current').removeClass('hide');
        $('#' + hoveredId).removeClass('subNavHovered');
        hoveredId = "none";
    }



});