
function validateEmail(email) {
	var matches = email.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
	return (matches != null && email == matches[0]);
}
function strTrim(str){
  str=str.replace(/(^\s*)|(\s*$)/g, "");
  if (str.length==0){
    return false;
  }
  return true;
}  
function validateTelepnone(Number){
    var stripped = Number.replace(/[\(\)\.\-\ ]/g, '');
//strip out acceptable non-numeric characters
//   if (isNaN(parseInt(stripped))){ 
	for (var i = 0; i< stripped.length; i++)
	{
		if (isNaN(parseInt(stripped.substr(i,1)))) 
		     return false;
    }	 
	var maxlength=9
	if (Number.length<maxlength){
	return false;
	}
	return true;
}
 
// function checkchars(cur){
//change max length to determine below
//var maxlength=9
//if (cur.chars.value.length<maxlength){
//return false
//}
//}

   

function checkForm(){
  if( !strTrim(document.all['first_name'].value)) {
    alert('First Name required');
	document.all['first_name'].focus();
    return false;
  }
  
  if( !strTrim(document.all['last_name'].value)) {
    alert('Last Name required');
	document.all['last_name'].focus();
    return false;
  }
  if(!validateEmail(document.all['email'].value)) {
    alert('Email Field required');
	document.all['email'].focus();
    return false;
  }
  if(!strTrim(document.all['Nationality'].value)) {
    alert('Nationality Field required');
	document.all['Nationality'].focus();
    return false;
  }
  document.ContactFormREG.submit();
  return true;
}
