(function($){

	var methods = {
		createPlaceholder: function(el,opts)
		{
			var ph = opts.before + el.attr("placeholder") + opts.after;

			el.addClass(opts.cl);
			el.val(ph);

			el.focus(function()
				{
					var val = el.val();
					if( (val == ph) && (el.hasClass(opts.cl)) )
					{
						el.val('');
						el.removeClass(opts.cl);
					}
				}
			);

			el.blur(function()
				{
					var val = el.val();
					if( (val == '') && (!el.hasClass(opts.cl)) )
					{
						el.val(ph);
						el.addClass(opts.cl);
					}
				}
			);
		}
	};

	$.fn.tehPlaceholder = function(opts)
	{

		var _opts = $.extend( {}, $.fn.tehPlaceholder.defaults, opts );

		return this.each(function(i,e) {
			methods.createPlaceholder( $(e), _opts);
		});

	}

	$.fn.tehPlaceholder.defaults = {
		before: '',
		after: '',
		cl: 'tehph'
	};

})(jQuery);

