 $.fn.ajaxSubmit = function() {
	this.submit(function(){
		var params = {};
		$(this)
			.find("input[@checked], input[@type='text'], input[@type='hidden'], input[@type='password'], input[@type='submit'], option[@selected], textarea")
			.filter(":enabled")
			.each(function() {
				params[this.name || this.id || this.parentNode.name || this.parentNode.id] = this.value;
			});
		$.ajax({
			data: params,
			type: this.getAttribute("method") || "POST",
			url: this.getAttribute("action") || window.location,
			contentType: this.getAttribute("enctype") || "application/x-www-form-urlencoded",
			// colocar no atributo loader do formulário o nome da função javascript que vai mostrar imagem carregando
			beforeSend: eval(this.getAttribute("class")),
			// colocar no atributo target do formulário o nome da função javascript que vai processar o html de retorno
			success: eval(this.getAttribute("target")),
			error: function(obj, msg, expt) { alert(expt.description || msg) }
		});
		return false;
	});
	return this;
}
