<!--

function Registration_ChkNumeric(field, event, content, name){
		var checkOK = "0123456789";
		var checkStr = content;
		var allValid = true;
		var allNum = "";
		for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
		allValid = false;
		break;
		}
		if (ch != ",")
		allNum += ch;
		}
		if (!allValid)
		{			
			if (name == "YrsExp"){
				alert("Enter only digits in the \"Years of Experience\" fields.");
				document.form1.YrsExp.value="";
				document.form1.YrsExp.focus();
			}
			if (name == "MthExp"){
				alert("Enter only digits in the \"Years of Experience\" fields");
				document.form1.MthExp.value="";
				document.form1.MthExp.focus();
			}
			if (name == "CPhone"){
				alert("Enter only digits in the \"Telephone No\" fields.");
				document.form1.CPhone.value="";
				document.form1.CPhone.focus();
			}
			if (name == "CPhonePre"){
				alert("Enter only digits in the \"Telephone No\" fields.");
				document.form1.CPhonePre.value="";
				document.form1.CPhonePre.focus();
			}			
			if (name == "CMobile"){
				alert("Enter only digits in the \"Mobile No\" fields.");
				document.form1.CMobile.value="";
				document.form1.CMobile.focus();
			}
			if (name == "CMobilePre"){
				alert("Enter only digits in the \"Mobile No\" fields.");
				document.form1.CMobilePre.value="";
				document.form1.CMobilePre.focus();
			}
		return (false);
		}
	}

function Registration_isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! Registration_allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.lastIndexOf("@") == email.length-1) {  // @ must not be the last character
        return false;
    } else if (email.lastIndexOf(".") == email.length-1) {  // . must not be the last character
        return false;
    }

	
    return true;
}

function Registration_allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}

function Registration_Validator(theForm)
{
  
  if (theForm.FName.value == "")
  {
    alert("First name field required!");
    theForm.FName.focus();
    return (false);
  }

  if (theForm.LName.value == "")
  {
    alert("Last name field required!");
    theForm.LName.focus();
    return (false);
  }
  
  if (theForm.UserName.value == "")
  {
    alert("User name field required!");
    theForm.UserName.focus();
    return (false);
  }
  
  if (theForm.Email.value == "")
  {
   	alert("Email address field required!");
    theForm.Email.focus();
    return (false);
  }
  
  if (! Registration_isValidEmail(theForm.Email.value)) {
    alert("Please enter a valid email address in Email Address field.");
	theForm.Email.value="";
	theForm.Email.focus();
  	return (false);
  }
  
   if (theForm.Confirm_Email.value == "")
  {
    alert("Confirm email address field required!");
    theForm.Confirm_Email.focus();
    return (false);
  }
  
  if (! Registration_isValidEmail(theForm.Confirm_Email.value)) {
    alert("Please enter a valid email address in Confirm Email Address Field.");
	theForm.Confirm_Email.value="";
	theForm.Confirm_Email.focus();
  	return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Password field required!");
    theForm.Password.focus();
    return (false);
  }

  if (theForm.Confirm_Password.value == "")
  {
   	alert("Confirm password field required!");
    theForm.Confirm_Password.focus();
    return (false);
  }
  
   if (theForm.Email.value != theForm.Confirm_Email.value)
  {
   	alert("Confirm email address mismatched");
	theForm.Email.value = "";
	theForm.Confirm_Email.value = "";
    theForm.Email.focus();
    return (false);
  }
  
  if (theForm.Password.value != theForm.Confirm_Password.value)
  {
   	alert("Confirm password mismatched");
	theForm.Password.value = "";
	theForm.Confirm_Password.value = "";
    theForm.Password.focus();
    return (false);
  }
  
  if (theForm.CPhone.value == "")
  {
    alert("Telephone No field required!");
    theForm.CPhone.focus();
    return (false);
  }

  if (theForm.Nationality.value == "")
  {	
	alert("Please Select Your Nationality");
	theForm.Nationality.focus();
	return (false);
  }

  if (theForm.Country.value == "")
  {
   	alert("Country field required!");
    theForm.Country.focus();
    return (false);
  }
  
  if (theForm.Availability.value == "")
  {
    alert("Availability field required!");
    theForm.Availability.focus();
    return (false);
  }

  if (theForm.Discipline.value == "")
  {
   	alert("Discipline field required!");
    theForm.Discipline.focus();
    return (false);
  }
  
  if (theForm.GenCat1.value == "")
  {
    alert("Specialization Type fields required!");
    theForm.GenCat1.focus();
    return (false);
  }

  if (theForm.GenCat2.value == "")
  {
   	alert("Specialization Type fields required!");
    theForm.GenCat2.focus();
    return (false);
  }
    
  return (true);
  
}
//-->