﻿



$(document).ready(function () {

    $("ul#topnav li").hover(function () { //Hover over event on list item
        $(this).css({ 'background': '#1c0073 url() repeat-x' }); //Add background color + image on hove#f6b116 list item
        $(this).find("span").show(); //Show the subnav
        $(this).find("span").css({ 'background': '#1c0073 repeat-x' });
        $("ul#topnav li").each(function (i) {
            if ($(this).attr('id') == 'active') {
                //alert('here');
                $(this).css({ 'background': '#250098 repeat-x' });

                $(this).find("span").css({ 'background': '#250098 repeat-x' });
                $(this).find("span").show();
                $(this).css({ 'z-index': '0' });
                $(this).find("span").css({ 'z-index': '0' });
            }
            else {
                $(this).css({ 'z-index': '99' });
                $(this).find("span").css({ 'z-index': '99' });
            }
        });

    }, function () { //on hover out...

        $("ul#topnav li").each(function (i) {

            if ($(this).attr('id') == 'active') {

                //                $(this).css({ 'background': 'gray repeat-x' });
                //                $(this).find("span").css({ 'background': 'gray repeat-x' });
                //                $(this).find("span").show();
                //                $(this).css({ 'z-index': '0' });
                //                $(this).find("span").css({ 'z-index': '0' });
            }
            else {
                $(this).css({ 'background': 'none' }); //Ditch the background
                $(this).find("span").hide(); //Hide the subnav
            }
        });
    });

    //    $("ul#topnav li").click(function () {
    //        //Clear id first
    //        $("li").each(function () {
    //            $(this).attr('id', '');
    //        });

    //        $(this).attr('id', 'active');

    //        $("li").each(function (i) {
    //            if ($(this).attr('id') != 'active') {
    //                $(this).css({ 'background': 'none' });
    //                $(this).find("span").css({ 'background': '#1d88bd repeat-x' });
    //                $(this).css({ 'z-index': '99' });
    //                $(this).find("span").css({ 'z-index': '99' });
    //                $(this).find("span").hide();
    //            }
    //            else {
    //                //$('input[name=ctl00$hidActiveMenu]').val(i);
    //                //$('#ctl00_hidActiveMenu').val(i);
    //                //setActiveMenu(i);
    //                //alert($('#ctl00_hidActiveMenu').val());
    //                $(this).css({ 'background': '#f6b116 repeat-x' });
    //                $(this).find("span").css({ 'background': '#f6b116 repeat-x' });

    //                $(this).css({ 'z-index': '0' });
    //                $(this).find("span").css({ 'z-index': '0' });
    //                $(this).find("span").show();
    //            }
    //        });

    //        $(this).mouseout(function () {
    //            $("li").each(function () {
    //                if ($(this).attr('id') != 'active') {
    //                    //$(this).css({ 'background': 'none' });
    //                    //$(this).find("span").hide();
    //                }
    //                else {
    //                    $(this).css({ 'background': '#f6b116 repeat-x' });
    //                    $(this).find("span").show();
    //                    $(this).find("span").css({ 'background': '#f6b116 repeat-x' });
    //                    $(this).css({ 'z-index': '0' });
    //                    $(this).find("span").css({ 'z-index': '0' });
    //                }
    //            });
    //        });
    //    });

});


