// jQuery ajaxFormSubmit.js

jQuery.fn.ajaxSubmit = function(urlaction,myFunction) {
	/* Change a form's submission type to ajax */
	
	this.submit(function(){
		var params = {};
		jQuery(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;
		});
		
		jQuery.post(this.getAttribute("action") + urlaction, params, myFunction);
		
		return false;
	});
	return this;
}

