
function form_contact_submit( ){
	
	var error_txt = '';
	
	// check last name
	var contact_lastname = document.getElementById('contact_lastname').value;
	if( contact_lastname == '' ){
		error_txt = 'De achternaam ontbreekt.<br/>';
	}else if( ( contact_lastname != '' ) && ( contact_lastname.length < 2 ) ){
		error_txt = 'De achternaam is ongeldig.<br/>';	
	}
	
	// check emailaddress
	var contact_email = document.getElementById('contact_email').value;
	if( contact_email == '' ){
		error_txt += 'Het emailadres ontbreekt.<br/>';		
		
	}else if( form_input_is_emailaddress( contact_email ) == false ){
		error_txt += 'Het emailadres is ongeldig.<br/>';	
	}
	
	// check message	
	/*
	var contact_message = document.getElementById('contact_message').value;
	if( contact_message == '' ){
		error_txt += 'Stel uw vraag of geef een opmerking in het veld <i>bericht</i>.<br/>';
	}else if( ( contact_message != '' ) && ( contact_message.length < 10 ) ){
		error_txt += 'Vul een geldige bericht in.<br/>';	
	}
	*/
	
	
	
	// show notification
	document.getElementById('contact_form_notification').innerHTML = error_txt;
	
	if( error_txt == '' ){
		document.getElementById('form_contact').submit();	
	}
}



// COMMON FUNCTIONS
function form_input_is_emailaddress( emailaddress ){
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if( !filter.test( emailaddress ) ) {
		// not a valid email address		return false;	}
	
	return true;
}





function create_emailaddress(){
	document.write('<a href="mailto:' + String.fromCharCode(105,110,102,111,114,109,97,116,105,101,64,97,108,122,104,101,105,109,101,114,99,101,110,116,114,117,109,110,105,106,109,101,103,101,110,46,110,108) + '">' + String.fromCharCode(105,110,102,111,114,109,97,116,105,101,64,97,108,122,104,101,105,109,101,114,99,101,110,116,114,117,109,110,105,106,109,101,103,101,110,46,110,108) + '</a>');
}
