window.addEvent('domready', function() {
	$('contactForm').addEvent('submit', function(e) {

		//Prevents the default submit event from loading a new page.
		e.stop();

		//Empty the log and show the spinning indicator.
		var log = $('log').empty().addClass('loading');
		log.innerHTML = 'Please wait...';

		//Set the options of the form's Request handler.
		//("this" refers to the $('contactForm') element).
		this.set('send', {onComplete: function(response) { 
			log.removeClass('loading');
			log.set('html', response);
		}});

		//Send the form.
		this.send();
	});
});
