function validate_pFld()
{
	if (document.AdmitForm.pFld01.value != document.AdmitForm.pFld02.value)
	{
		alert ("Sorry, passwords dont match. Please " +
		"re-enter them. Remember that passwords are case sensitive!");
		document.AdmitForm.pFld01.value = "";
		document.AdmitForm.pFld02.value = "";
		document.AdmitForm.pFld01.focus();
	}
	else
	{
	 	if (!valid_chrs_only(document.AdmitForm.pFld01.value)) 
		{
			alert("Sorry, password contains invalid characters. Please re-select!");
			document.AdmitForm.pFld01.value = "";
			document.AdmitForm.pFld02.value = "";
			document.AdmitForm.pFld01.focus();
		}
	}			
}

function validate_search_fields()	 
{
	var c = document.SearchForm.fCountry;
	var p = document.SearchForm.fProduct;

	if ((c.value == "") && (p.value == ""))
	{
		alert ("Please fill in at least one of the two text boxes.");
		document.SearchForm.fCountry.focus();

		return false;
	}
	else
	{	
		return true;
	}
}

function validate_member_profile_fields()	 
{
	var u = document.member_profileForm.fUser;
	var w = document.member_profileForm.fPassword;

	if ((u.value == "") && (w.value == ""))
	{
		alert ("Please fill in both of the two text boxes.");
		document.member_profileForm.fUser.focus();

		return false;
	}
	else
	{	
		return true;
	}
}

function check_fields()
{	
	if (document.AdmitForm.Company_Name.value == "")
	{
		alert ("Please enter your business name! " +
		"This is an idexed field in our database.");
		document.AdmitForm.Company_Name.focus();
		return false;
	}
	else
	{
		if (document.AdmitForm.Email.value == "")
		{
			alert ("We need your email address to communicate with you. " + 
			"Please supply us with this address.");
			document.AdmitForm.Email.focus();
			return false;
		}
		else
		{
			if (document.AdmitForm.State.value == "")
			{
				alert ("Please enter the name of your State or County! " +
				"This is a database search field and will be needed.");
				document.AdmitForm.State.focus();
				return false;
			}
			else
			{
				if (document.AdmitForm.City.value == "")
				{
					alert ("Please enter the name of your City or Town! " +
					"This is a search field and will be needed.");
					document.AdmitForm.City.focus();
					return false;
				}
				else
				{
					if (document.AdmitForm.Country.value == "")
					{
						alert ("Please enter the name of your Country! " +
						"This is a database search field and will be needed.");
						document.AdmitForm.Country.focus();
						return false;
					}
					else
					{
						if (document.AdmitForm.Username.value == "")
						{
							alert ("Please enter your proposed User Name! " +
							"This code is essential to identify you on our database.");
							document.AdmitForm.Username.focus();
							return false;
						}
						else
						{
							if (document.AdmitForm.pFld01.value == "")
							{
								alert ("Please enter a password! " +
								"This is required to protect your privacy.");
								document.AdmitForm.pFld01.focus();
								return false;
							}
							else
							{
								if (document.AdmitForm.pFld02.value == "")
								{
									alert ("You will need to repeat entry of your password. " +
									"This is to confirm your selection. If the two password " +
									"fields don't match, you will be exhorted to re-enter " +
									"them.");
									document.AdmitForm.pFld02.focus();
									return false;
								}
								else
								{
									return true;
								}
							}
						}
					}
				}
			}	
		}
	}
}

function valid_chrs_only (word_str)
{
	var len = word_str.length;	 		
	var ok = true; 
	for (var i = 0; i <= len; i++) 
	{		
		if (word_str.substring(i, i + 1) == ',')  return false;	
		if (word_str.substring(i, i + 1) == ':')  return false;
		if (word_str.substring(i, i + 1) == '"')  return false;
		if (word_str.substring(i, i + 1) == ',')  return false;	
	}
	return true;
}


