window.addEvent('domready', addEventHandler);

function addEventHandler()
{
	$('myForm').addEvent('submit', function(e) {
		// prevent form submit on page load
		e.stop();
		var log = $('contact_res');
		// send form, clear data of 'contact_res', submit response into contact res
		// "this" refers to the $('myForm') element.
		this.set('send', {onComplete: function(response) { 
			log.empty();
			log.set('html', response);
			addEventHandler();
		}});
		// send form.
		this.send();
	});
}