$.fn.ajaxSubmit = function(e) { 
	this.submit(function(){
		var params = {}; 
		var formID = $(this).attr('id');
		
		$(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; }); 

			$("body").addClass("curWait");
			$.post(this.getAttribute("action"), params, function(xml){ 
				$("body").removeClass("curWait");
				if (xml.search('error:') != -1) {
					alert(xml.replace('error:', ''));
				} else {
					$("#" + formID + "-whiteboard").html(xml);
					if(formID == 'patient' || formID == 'account') {
						$("#TB_window").css('height', '250px');	
					}
				}
			});
		return false;
	});
 return this; 
}
