$(document).ready(function() {
    
   $('.blur-input').blurInput();
   $('.quicknav').quickNav();
});

$.fn.quickNav = function() {

    if (!this.hasClass('no-tab')) {
        var getContainer = function(href) {
            var box = href.split('#')[1];
            return $('#'+box);
        };

        return this.each(function() {
            var el = $(this);
            el.find('li a').each(function() {
                var button = $(this);
                if (!button.hasClass('selected')) {
                    getContainer(this.href).hide();
                }

                button.click(function() {
                    $('.quick-tab').hide();
                    el.find('a').removeClass('selected');
                    getContainer(this.href).show();
                    $(this).addClass('selected');
                    return false;
                });
            });
        });
    }
}

$.fn.blurInput = function() {
    return this.each(function() {
        var el = $(this);
        var defaultValue = el.attr('defaultvalue');

        el.focus(function() {
            if (this.value == '' || this.value == defaultValue) {
                this.value = "";
            }
        });

        el.blur(function() {
            if (this.value == '' || this.value == defaultValue) {
                this.value = defaultValue;
            }
        });

        if (this.value == "") {
            this.value = defaultValue;
        }
    });
}