var idelement_focused='';

jQuery.fn.aForm = function(options) {
	options = options || {};
	
	$(this).bind("submit", function() {
		if(options.in_progress==1) return false;
		post_form(this);
		return false;
	});


	function post_form(forma) {
		options.in_progress=1;

		$.ajax({
			url: 'includes/forms.php?SID='+$('#SID').val()+'&form_name='+$(forma).attr('id'),
			data: $(forma).serialize(),
			type: 'post',
			dataType: 'script',
			cache: false,
			error: function(request) { alert('AJAX: Server connection error!'); },
			success: function(response) { options.in_progress=0; }
		});
	}
}
