function get(name_control){
	if (eval("document.form1." + name_control + ".value") == "")
		return false;
	else
		return true;
}

function checkemail(str_email){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str_email))
		testresults=true
	else
		testresults=false
	return (testresults)
}

function check(){
if (get('name') == false){ 
	alert('Sorry, field Name is mandatory');
	document.form1.name.focus();
	return; 
}
if (get('surname') == false){ 
	alert('Sorry, field Surname is mandatory');
	document.form1.surname.focus();
	return; 
}
if (get('address') == false){ 
	alert('Sorry, field Address is mandatory');
	document.form1.address.focus();			
	return; 
}
if (get('postcode') == false){ 
	alert('Sorry, field Post Code is mandatory.');
	document.form1.postcode.focus();			
	return; 
}
if (get('city') == false){ 
	alert('Sorry, field City is mandatory.');
	document.form1.city.focus();			
	return; 
}
if (get('country')== false){ 
	alert('Sorry, field Country is mandatory.');
	document.form1.country.focus();			
	return; 
}
if (get('phone') == false){ 
	alert('Sorry, field Phone is mandatory.');
	document.form1.phone.focus();			
	return; 
}
if (get('istqb') == false){ 
	alert('Sorry, field ISTQB Certificate No. is mandatory.');
	document.form1.istqb.focus();			
	return; 
}

if (get('tprovider') == false){ 
	alert('Sorry, field Training provider is mandatory.');
	document.form1.tprovider.focus();			
	return; 
}

if (get('email') == false){ 
	alert('Sorry, field Email is mandatory.');
	document.form1.email.focus();			
	return; 
}
else{
	email=document.form1.email.value;
	if (checkemail(email) == false){
		alert('Please input a valid email address!')
		document.form1.email.focus();
		return;
	}
	else
		document.form1.submit();
} 

return;
}
