
function contactOK(o)
{
	//Note this call expect some standard form control names. IMPORTANT!!!
	iFilled = false;
	if (o.mailFrom.value.length > 0)
	{
		iFilled = true;
		if (! emailOK(o.mailFrom.value))
		{
			alert("The Email address you entered does not meet our specifications. Please check it.");
			o.mailFrom.focus();
			return(false);
		}
	}
	if (o.Phone.value.length > 9)	iFilled = true;
	//if (o.fax.value.length > 9)	iFilled = true;
	if (! iFilled)
	{
		alert("A contact method must be supplied to continue: either a valid Email address, or a phone number using area code and full phone number.");
		o.mailFrom.focus();
	}
	return(iFilled);
}

function emailOK(s)
{
	if (s.length == 0) 		return(false);
	i = s.lastIndexOf(".");
	//There should be a .xx at the string end...
	if (s.length - i < 2)	return(false);
	i = s.indexOf("@");
	if (i < 2)				return(false);
	return(true);
}

function spaceOK(s)
{
	i = s.length;
	if((s.substring(0, 1) == " ") || (s.substring(i-1, i) == " "))	return(false);
	return(true);
}

function checkCtrl(theCtrl, userStr, noNull, iLen)
{
	if (noNull && (theCtrl.value.length < iLen))
	{
		alert ("You must type " + iLen + " or more characters into " + userStr);
		theCtrl.focus();
		return(false);
	}
	for (i = 0;  i < theCtrl.value.length;  i++)
	{
		ch = theCtrl.value.charAt(i);
		if (ch == "\"")
		{
		alert("Please enter only letters and / or numbers in " + userStr + ", please change your text there.");
		theCtrl.focus();
		return(false);
		}
	}
	return(true);
}
