/**
 * Genral behaviour for input fields
 *
 * On focus
 * - Empty field if default value is shown
 * - Else, select all text
 *
 * On blur
 * - If empty, set default value
 */
(function($){
    $('input[type="text"]').focus(function() {
        if (this.value == this.defaultValue){
            this.value = '';
        }
        if(this.value != this.defaultValue){
            this.select();
        }
    });

    $('input[type="text"]').blur(function() {
        if ($.trim(this.value) == '') {
            this.value = (this.defaultValue ? this.defaultValue : '');
        }
    });
})(jQuery)
