﻿jQuery.fn.FixDefaultButton = function() {
    return this.each(function() {
        if (this && typeof (this.click == 'undefined')) {
            this.click = function() {
                var result = true;
                if (this.onclick) result = this.onclick();
                if (typeof (result) == 'undefined' || result) {
                    eval(this.href);
                }
            }
        }
    });
};

var lastNavItem = '';
$(document).ready(function() {
    var header = $('#header');
    $('.nav-link.level-1', header).hover(function() {
        if (lastNavItem != $(this).html()) {
            $('.nav-item.level-1 a', header).removeClass('active');
            $(this).addClass('active');
            $('.nav-list.level-2', header).hide();
            $(this).siblings('.nav-list.level-2').fadeIn('fast');
            lastNavItem = $(this).html();
        }
    });
    $('.clsEditComp').hover(function() {
        $(this).addClass('active');
        $('.navCompEdit', $(this)).show();
    },
    function() {
        $('.navCompEdit', $(this)).hide();
        $(this).removeClass('active');
    });
    var buttons = $('input:submit');
    if (buttons.length > 0)
        buttons.button();
});
