
 function NewUserValidate(theForm){
//  --------- Login Name ---------------
  if (theForm.loginName.value == "")
  	{
    alert("You must enter your Login Name.");
    theForm.loginName.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (theForm.loginName.value.length < 3)
  {
    alert("You must enter at least 3 Characters in the \"Login Name\" field.");
    theForm.loginName.focus();
    return (false);
  }
    // only allow numbers to be entered
		var checkNOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
		var checkNStr = theForm.loginName.value;
		var allNValid = true;
		var allNNum = "";
		for (i = 0;  i < checkNStr.length;  i++)
		{
		ch = checkNStr.charAt(i);
		for (j = 0;  j < checkNOK.length;  j++)
		if (ch == checkNOK.charAt(j))
		break;
		if (j == checkNOK.length)
		{
		allNValid = false;
		break;
		}
		if (ch != ",")
		allNNum += ch;
		}
		if (!allNValid)
		{
		alert("Login Name must contain only Alphanumerics.");
		theForm.loginName.focus();
		theForm.loginName.select();
		return (false);
		}	
	
// ----------------- Password ------------------
  if (theForm.password.value == "")
  {
    alert("You must enter your Password.");
    theForm.password.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (theForm.password.value.length < 3)
  {
    alert("You must enter at least 3 Characters in the \"Password\" field.");
    theForm.password.focus();
    return (false);
  }
    // only allow numbers to be entered
		var checkNOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
		var checkNStr = theForm.password.value;
		var allNValid = true;
		var allNNum = "";
		for (i = 0;  i < checkNStr.length;  i++)
		{
			ch = checkNStr.charAt(i);
			for (j = 0;  j < checkNOK.length;  j++)
			if (ch == checkNOK.charAt(j))
			break;
			if (j == checkNOK.length)
			{
			 allNValid = false;
			 break;
			}
			 if (ch != ",")
			 allNNum += ch;
		}
		if (!allNValid)
		{
			alert("Password must contain only Alphanumerics.");
			theForm.password.focus();
			theForm.password.select();
			return (false);
		}	
// ------------ Password Match ----------------------------	
	if (theForm.password.value != theForm.confirm_password.value) 
		{
		alert("Both Passwords are not same. Please type the Password again.");
		theForm.confirm_password.focus();
		theForm.confirm_password.select();
		return (false);
	}

// ------------ Name of the Center -------------------
	if (theForm.company.value == 0)
  	{
    alert("You must select your Company Name.");
    theForm.company.focus();
    return (false);
	}
	
// ------------ First Name -------------------
  if (theForm.firstName.value == "")
  {
    alert("You must enter your First Name.");
    theForm.firstName.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (theForm.firstName.value.length < 3)
  {
    alert("You must enter at least 3 Characters in the \"First Name\" field.");
    theForm.firstName.focus();
    return (false);
  }
   // this can be altered for any "checkOK" string you desire
	  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	  var checkStr = theForm.firstName.value;
	  var allValid = true;
	  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 (!allValid)
	  {
		alert("You must enter only alphabets in the \" First Name\" field.");
		theForm.firstName.focus();
		theForm.firstName.select();
		return (false);
	  }
// ------------ Last Name -------------------
	if (theForm.lastName.value == "")
  {
    alert("You must enter your Last Name.");
    theForm.lastName.focus();
    return (false);
  }
// ------------ Email -------------------
	//Testing Email
		var illegalChars = /\W/;
		var emailFilter=/^.+@.+\..{2,3}$/;
		var illegalChars2= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
		var emailFilter=/^.+@.+\..{2,3}$/;
			
		if (!(emailFilter.test(theForm.email.value))) 
		{ 
		alert("You must enter a valid Email address.\n");
		theForm.email.focus();
		return (false); 
		}
		
		if (theForm.email.value.match(illegalChars2)) {
		alert("The Email address contains illegal characters.\n");
		theForm.email.focus();
		return (false); }

		if (theForm.email.value != theForm.confirm_email.value) {
		alert("Both Emails are not same.  Please type the Email again");
		theForm.confirm_email.focus();
		theForm.confirm_email.select();
		return (false); }
 // ------------ Address -------------------
	if (theForm.address.value == "")
  {
    alert("You must enter your Address.");
    theForm.address.focus();
    return (false);
	}
// ------------ Country -------------------
	if (theForm.Country.value == 0)
  {
    alert("You must enter your Country.");
    theForm.Country.focus();
    return (false);
  }  
// ------------ City -------------------
	if (theForm.city.value == 0)
  {
    alert("You must select your City.");
    theForm.city.focus();
    return (false);
  }

// ------------ Day Phone -------------------
  if (theForm.dayphone.value == "")
  {
    alert("You must enter your Phone No.");
    theForm.dayphone.focus();
    return (false);
  }

  // require at least 3 characters be entered
  if (theForm.dayphone.value.length < 3)
  {
    alert("You must enter at least 3 Digits in the \"Day Phone\" field.");
    theForm.dayphone.focus();
    return (false);
  }
    // only allow numbers to be entered
		var checkNOK = "0123456789+-";
		var checkNStr = theForm.dayphone.value;
		var allNValid = true;
		var allNNum = "";
		for (i = 0;  i < checkNStr.length;  i++)
		{
			ch = checkNStr.charAt(i);
			for (j = 0;  j < checkNOK.length;  j++)
			if (ch == checkNOK.charAt(j))
			break;
			if (j == checkNOK.length)
			{
			 allNValid = false;
			 break;
			}
			 if (ch != ",")
			 allNNum += ch;
		}
		if (!allNValid)
		{
			alert("Phone field must contain only Numerics, + and Hyphens.");
			theForm.dayphone.focus();
			theForm.dayphone.select();
			return (false);
		}	
 if(!theForm.condition.checked) {
   alert("You must agree to the privacy policy to register")
   theForm.condition.focus()
   return(false)
 }

 }




