
jQuery.fn.labelInput = function(settings) {
    var elem = this;
    var lbl = $("label[for='"+elem.attr("id")+"']").text();
    $(this).val(lbl).addClass("label-input");
    $(this).bind("focus", function(e) {
            if ($(this).val() == lbl) {
                $(this).val("").removeClass("label-input");
            }
    }).bind("blur", function(e) {
            if ($(this).val() == "") {
                $(this).val(lbl).addClass("label-input");
            }
    });
    $(this).parents("form").bind("submit", function(e) {
            if (elem.val() == lbl || elem.val() == "") {
                elem.animate({backgroundColor: "red"}, 10).animate({backgroundColor: "white"}, 800, "swing");
                return false;
            }
            return true;
    });
}

