(function($) {

    $.prefill = {
    };

    $.fn.extend({
        prefill: function(message, normalColor, prefillColor) {
            if (!message) {
                message = $(this).val();
            } else {
                $(this).val(message);
            }
            
            if (prefillColor) {
                $(this).css("color", prefillColor)
            }
            
            $(this).focus(function() {
                if ($(this).val() == message) {
                    $(this).val("");
                    if (normalColor) {
                        $(this).css("color", normalColor);
                    }
                } else {
                    if (normalColor) {
                        $(this).css("color", normalColor);
                    }
                }
            });

            $(this).focusout(function() {
                if ($(this).val() == "") {
                    $(this).val(message);
                    if (prefillColor) {
                        $(this).css("color", prefillColor)
                    }
                }
            });
            return this;
        }
    });

})(jQuery);
