jQuery.fn.jaiformat = function(obj){
	var defaults = {
		_control: '',
		_source: '',
		_params: '',
		callback: ''
	};
	


	return this.each(function() {
		defaults._control=this;
		jQuery.extend(defaults, obj);
		
		if($(this).attr("format")=="numeric"){
			$(this).bind("keypress",function(i, name){return chekOnlyNumbers(i)});
		}
		if($(this).attr("format")=="date"){
			$(this).mask($(this).attr("mask"));

			//$(this).bind("keypress",function(i, name){return chekOnlyNumbers(i)});
		}
		if($(this).attr("format")=="autonumeric"){
			$(this).attr("readonly","true");
			$(this).attr("value","Autonumerico");
		}
		
		
		
		function chekOnlyNumbers(evt){
			var charCode = evt.which;
			if (charCode > 31 && (charCode < 48 || charCode > 57)) {
				/*alert("Por favor digiet solo numeros.")*/
				return false;
			}
				return true;
		}
	
		
	});
	
};