$(document).ready(function() {
    $('label.automatic').each(function() {
        if ($(this).attr('for').length > 0) {
            $(this).click(function() { $(this).hide(); } );
            $('#'+$(this).attr('for')).focus(function() {
                $('label[for='+$(this).attr('id')+'].automatic').hide();
            });
            $('#'+$(this).attr('for')).blur(function() {
                if ($(this).val().length == 0) {
                    $('label[for='+$(this).attr('id')+'].automatic').show();
                }
            });
            if ($('#'+$(this).attr('for')).val().length > 0) {
                $(this).hide();
            }
        }
    });
});

