﻿(function($)
{
	$.fn.watermark = function(options)
	{

		var defaults = {
			watermarkclass: "",
			text: "text"

		};
		var options = $.extend(defaults, options);

		return this.each(function()
		{
			if ($(this).val() == "" || $(this).val() == options.text)
			{
				$(this).val(options.text);
				$(this).addClass(options.watermarkclass);

			}

			$(this).focus(function()
			{
				if ($(this).val() == options.text)
					$(this).val("");
				$(this).removeClass(options.watermarkclass);
			});

			$(this).blur(function()
			{
				if ($(this).val() == "")
				{
					$(this).addClass(options.watermarkclass);
					$(this).val(options.text);
				}
			});

		});
	};
})(jQuery);
