$.fn.aigAjaxForm = function(target, post_cb, pre_cb) {
	return this.each(function(){
		$("input[@type=submit],input[@type=image]", this).click(function(ev){
			this.form.clicked = this;
			if (ev.offsetX != undefined) {
				this.form.clicked_x = ev.offsetX;
				this.form.clicked_y = ev.offsetY;
			} else {
				this.form.clicked_x = ev.pageX - this.offsetLeft;
				this.form.clicked_y = ev.pageY - this.offsetTop;
			}
		});
	}).submit(function(e) {
		if (pre_cb && pre_cb.constructor == Function && pre_cb(this.vars) === false) return;

		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; });
			$.post(this.getAttribute("action"), params, function(xml) {
				//$(target).load("/productShots/include/shot_settings.inc.php?shot_id=<?php print $printProduct['shot_id']; ?>", loadSettings );
				$(target).html(xml);
				if (post_cb && post_cb.constructor == Function) post_cb(xml);
			});
		return false;
	});
};
