// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
  function validateOnSubmit() {
    var elem;
    var errs=0;
    // execute all element validations in reverse order, so focus gets
    // set to the first one in error.
  
    if (!validatePresent(document.forms.reg.txtImei,  'infImei')) errs += 2;    
    if (!validatePresent(document.forms.reg.txt_country,  'inf_country')) errs += 2;       
    if (!validatePresent(document.forms.reg.txtContactphone,  'infContactphone')) errs += 2;     
    if (!validateEmail(document.forms.reg.txtUserEmail,  'infUserEmail', true)) errs += 2; 
    if (!validatePresent(document.forms.reg.txtUserEmail,  'infUserEmail')) errs += 2;         
    if (!validatePresent(document.forms.reg.txt_lastname,  'inf_lastname')) errs += 2; 
    if (!validatePresent(document.forms.reg.txt_firstname,  'inf_firstname')) errs += 2;     
    
	if ((errs<2) && (document.forms.reg.txt_age.value == '12')){
		window.location.href="error_a.html"; 
		return false;
	} else	if (errs>2) {
		alert('There are fields which need correction before sending.');
	} else if (errs==2) {
		alert('There is a field which needs correction before sending.');
	}		
    return (errs==0);
  };
 
 
 
 