﻿
function isEmpty(Field,Name) {
    
    var strfield1 = document.getElementById(Field).value

    if (strfield1 == "")
    {
    alert(Name +  " is a mandatory field.\n")
    return false;
    }
    
    return true;
}



//function to check valid email address
function isValidEmail(Field){
    
    var strEmail = document.getElementById(Field).value
    var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;  

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      alert('A valid e-mail address is required.');
      return false;
    } 
    return true; 
}


//function that performs all functions, defined in the onsubmit event handler

function check() {

    if (isEmpty("ctl00_name", "Name")) {
        if (isEmpty("ctl00_email", "Email")) {
            if (isValidEmail("ctl00_email")) {
		  return true;		
	  }
  }
}
return false;
}

