<!--
window.addEvent('domready', function() {
	$('fullname').getParent().adopt( new Element('div', {'id':'er-fullname', 'class':'error-message'}) );
	$('email').getParent().adopt( new Element('div', {'id':'er-email', 'class':'error-message'}) );
	$('message').getParent().adopt( new Element('div', {'id':'er-message', 'class':'error-message'}) );
	$('contactForm').addEvent('submit', function() {
		var isSubmit = true;
		$('er-fullname').innerHTML = "";
		$('er-email').innerHTML = "";
		$('er-message').innerHTML = "";	
		
		if ( $('fullname').value == "" ) {
			$('er-fullname').innerHTML = "Please enter the full name";
			isSubmit = false;
		}
		if ( $('email').value == "" ) {
			$('er-email').innerHTML = "Please enter the email address";
			isSubmit = false;
		}
		if ( $('email').value != "" ) {
			if (!isValidEmailFormat( $('email').value )) {
				$('er-email').innerHTML = "Please enter a valid email address";
				isSubmit = false;
			}
		}
		if ( $('message').value == "" ) {
			$('er-message').innerHTML = "Please enter the message";
			isSubmit = false;
		}
		
		return isSubmit;
	});
});

function isValidEmailFormat(str) {
		
	var re = /^\S+\@\S+\.\S+$/;	
	return re.test(str);
}
//-->