<!--

// ========================== make it so you can only type numbers or letters in a text box
var validNums = '0123456789()-';  // allows numbers, period and comma
var validInt = '0123456789';     // allows numbers only
var validLetters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';  // allows letters only

function validateKeyPress(e, validSet) 
{ 
    var key; 
    var keychar; 
         
    if(window.event || !e.which) // IE 
        key = e.keyCode; // IE 
    else if(e) 
        key = e.which;   // Netscape 
    else 
        return true;     // no validation 

    keychar = String.fromCharCode(key); 
    validSet += String.fromCharCode(8); 

    if (validSet.indexOf(keychar) < 0) 
      return false; 

    return true; 
} 

function showContactOpt() //if phone radio is selected, show phone field, else if email is selected show email field
{
	var myForm = document.contactForm;
	var contactMethodSelected;
	for (i=0; i<document.contactForm.cheContactMethod.length; i++) 
	{
		if (myForm.cheContactMethod[i].checked)
		{	contactMethodSelected = myForm.cheContactMethod[i].value;
			break;
		}	
	}
	if (contactMethodSelected == "Phone")
	{
		document.getElementById('byPhone').style.display = 'block';
		document.getElementById('byEmail').style.display = 'none';
	}
	else if (contactMethodSelected == "Email")
		{
			document.getElementById('byEmail').style.display = 'block';
			document.getElementById('byPhone').style.display = 'none';
		}
}

function showSendOpt(selectedType) //if by Mail radio is selected, show address fields, else if fax is selected show fax field
{
	var myForm = document.contactForm;
	var sendMethodSelected;
	for (i=0; i<document.contactForm.cheSendBy.length; i++) 
	{
		if (myForm.cheSendBy[i].checked)
		{	sendMethodSelected = myForm.cheSendBy[i].value;
			break;
		}	
	}
	if (sendMethodSelected == "Mail")
	{
		document.getElementById('byMail').style.display = 'block';
		document.getElementById('byMail2').style.display = 'block';
		document.getElementById('byFax').style.display = 'none';
	}
	else if (sendMethodSelected == "Fax")
		{
			document.getElementById('byFax').style.display = 'block';
			document.getElementById('byMail').style.display = 'none';
			document.getElementById('byMail2').style.display = 'none';
		}
}

function validateForm()
{
	var cForm = document.contactForm;
	var cMethodChecked;
	var cSendByChecked;

	for (i=0; i<document.contactForm.cheContactMethod.length; i++) 
	{
		if (cForm.cheContactMethod[i].checked)
		{	cMethodChecked = cForm.cheContactMethod[i].value;
			break;
		}	
	}
	for (i=0; i<document.contactForm.cheSendBy.length; i++) 
	{
		if (cForm.cheSendBy[i].checked)
		{	cSendByChecked = cForm.cheSendBy[i].value;
			break;
		}	
	}

		
	if (cForm.cheName.value=="")
	{	
		alert("Please type your name in the Name text box.");
			cForm.cheName.focus();
			return false;
	}
		else if (cForm.cheDegree.value=="")
		{
			alert("Please fill-in the degree field.");
			cForm.cheDegree.focus();
			return false;
		}
			else if (cMethodChecked == "Phone" && (cForm.chePhone.value == "" || cForm.chePhone.value.length <= 8))
			{
				alert("You've indicated you want to be contacted by phone.\nPlease fill-in your phone number - including area code.");
				cForm.chePhone.focus();
				return false;
			} 
			else if (cMethodChecked == "Email" && cForm.cheEmail.value == "")
			{
				alert("You've indicated you want to be contacted by email.\nPlease fill-in your email address.");
				cForm.cheEmail.focus();
				return false;
			}
			else if (cMethodChecked == null)
			{	alert("Please select a preferred method of contact.");
				return false;
			}
				else if (cSendByChecked == null && cForm.cheConfTitle.value != "")
				{	alert("How would you like the brochure sent to you?\nPlease indicate by mail or fax and fill-in the appropriate fields.");
					return false;
				}
				else if (cSendByChecked != null && cForm.cheConfTitle.value == "")
				{	alert("Please indicate what conference you'd like a brochure on\n or enter ANY to be sent all current brochures.");
					return false;
				}
				else if (cSendByChecked == "Mail" && (cForm.cheAddress.value == "" || cForm.cheCity.value == ""))
				{
					alert("You've indicated you want information mailed to you.\nPlease fill-in your complete address in the fields provided.");
					cForm.cheAddress.focus();
					return false;
				} 
				else if (cSendByChecked == "Fax" && (cForm.cheFax.value == "" || cForm.cheFax.value.length <= 8))
				{
					alert("You've indicated you want information faxed to you.\nPlease fill-in your fax number - including area code.");
					cForm.cheFax.focus();
					return false;
				}

}

//-->
