;(function($) {
	
	$.fn.placeholder = function(opts)
	{
		return this.filter('[placeholder]').each(function()
		{
			var $this = $(this);

			var focus = function()
			{
				if ($(this).val() == $(this).attr("placeholder")) 
				{
					$(this).val("").removeClass('placeholder');
				}
			};

			var blur = function()
			{
				if ($(this).val() == "")
				{
					$(this).val($(this).attr("placeholder")).addClass('placeholder');
				}
			};

			var submit = function()
			{
				$('[placeholder]').each(function()
				{
					if ($(this).val() == $(this).attr("placeholder")) 
					{
						$(this).val("");
					}
				});
			};

			// Attach handlers
			$this
				.focus(focus)
				.blur(blur);

			// Empty value on submit
			$this
				.parents('form')
				.submit(submit);

			// Add default value
			$this.val($this.attr('placeholder')).addClass('placeholder');
		});
	};
	
	
})(jQuery);
