﻿$.fn.watermark = function (opts) {
    return this.each(function () {
        var sValue = "Text Here";
        if (typeof opts != "undefined")
            sValue = opts;
        var obj = $(this);

        obj.addClass("watermarkOn").val(sValue);
        obj.focus(function () {
            $(this).filter(function () {

                // We only want this to apply if there’s not
                // something actually entered
                return $(this).val() == "" || $(this).val() == sValue;

            }).removeClass("watermarkOn").val("");
        });
        obj.blur(function () {
            $(this).filter(function () {

                // We only want this to apply if there’s not
                // something actually entered
                return $(this).val() == ""
            }).addClass("watermarkOn").val(sValue);
        });

    });
};
