function handleFormlabel(o)
{
    var input = $(o).parent().find("#" + $(o).attr("for"));
    var label = $(o);
    
    if (input.val() != "") $(o).hide();
    
    input.bind('hastext', function() {
        label.hide();
    });
    
    input.bind('notext', function() {
        label.show();
    });
}

$(function() {
    $(".form-label").each(function() {
        handleFormlabel(this);
    }); 
    
    $("form .label").click(function() {
        $(this).parent().find("[name=" + $(this).attr("for") + "]").focus();
    });
    
});
