/*
* jQuery valRep v1.1
* http://anfibic.com/
*
* Date: 2010-10-07 13:41:00 - (Jueves, 07 Oct 2010)
*
*/
(function($){	 	
	$.fn.valRep = function(options){
		var defaults = {
			required:false,
			title:'Error',
			description:'No has escrito nada.'
		};
		var options = $.extend(defaults, options);
		$(this).each(function(){
			var valororiginal = $(this).val();
			$(this).focus(function(){
				if($.trim($(this).val()) == valororiginal){
					$(this).val('');
				}
			});
			$(this).blur(function(){
				if($.trim($(this).val()) == ''){
					$(this).val(valororiginal);
				}
			});
			if (options.required == true) {
				var form = $(this).parents();
				$(form).submit(function(){
					if($.trim($(this).val()) == ''){
						jAlert(options.description,options.title,'',1);
						return false;
					}
				});
			}
		});
	};
})(jQuery);
