// submits a form using AJAX
jQuery.fn.submitWithAjax = function() {
	$(this).submit(function() {
											 //alert('test');
											 var parent = $(this).parent();
											 var data = $(this).serialize();
											 //alert(this.action);
											 // post(url, data, callback, type)
											 $.post(this.action, data, function(response) {
																																				 parent.slideUp("normal", function() {
																																																					 $(this).html(response).slideDown("slow");
																																																					 });
																																				 }, "html");
											 return false;
											 });
	return this;
};


$(document).ready(function() {
	$('#registerform').submitWithAjax();
});


// rset the form
function resetRegistrationForm() {
	$('#registerformbox').load('register-form.php');
	return false;
};