<!--

function isNum(value)
{ 
	for (i = 0; i < value.length; i++) 
	{
		c = value.charAt(i);
		if ( c < "0"  ||  c > "9" )
			return false;
	}
	return true;
}

function isEmail(string) 
{
   if (!string) return false;
   var iChars = "*|,\":<>[]{}`\';()&$#%";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}                      
function isProper(string) 
{
   if (!string) return false;
   var iChars = "*|\\:<>[]{}`/;()@&$#%+~^=";

   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}                      
					
function valid(theForm)
{
    
		if (document.theForm.Name.value=="" ||  (isProper(document.theForm.Name.value) == false))
  {
    alert("Please enter your name.  Characters only.");
    document.theForm.Name.focus();
    return (false);
  }
				
	 if (document.theForm.Company.value == "" || (isProper(document.theForm.Company.value) == false))

  {

    alert("Please enter the name of your Company.  Alphanumeric only.");

    document.theForm.Company.focus();

    return (false);

  }
		
		if (document.theForm.Address.value == "" || (isProper(document.theForm.Address.value) == false))

  {

    alert("Please enter your address.  Alphanumeric only.");

    document.theForm.Address.focus();

    return (false);

  }
		
if (document.theForm.City.value == "" || (isProper(document.theForm.City.value) == false))

  {

    alert("Please enter your city.  Alphanumeric only.");

    document.theForm.City.focus();

    return (false);

  }

 	if (document.theForm.State.selectedIndex == 0) 
   {
    alert('Please select your state.');
	document.theForm.State.focus();
    return false;
	}		
	
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
var checkStr = document.theForm.StateOther.value;
var check2 = document.theForm.Title.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("Please specify the state if selected other.  Alphanumeric only.");
document.theForm.StateOther.focus();
return (false);
}
for (i = 0;  i < check2.length;  i++)
{
ch = check2.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("Please use alphanumeric characters only for your title.");
document.theForm.Title.focus();
return (false);
}

if (document.theForm.Zip.value == "" || !isNum(document.theForm.Zip.value) || (document.theForm.Zip.value.length < 5)) 

  {
    alert("Please enter your zip code, numeric values only no dashes.");

    document.theForm.Zip.focus();

    return (false);

  }
		
if (document.theForm.Country.selectedIndex == 0) 
   {
    alert('Please select your country.');
	document.theForm.Country.focus();
    return false;
	}	
	
	if (document.theForm.Email.value=="" ||  (isEmail(document.theForm.Email.value) == false))
  {
    alert("Please verify your email address.  Please omit special characters.");
			
				document.theForm.Email.focus();

    return (false);
  } 
		
		if (document.theForm.Phonearea.value=="" || !isNum(document.theForm.Phonearea.value)) 
	{
		alert("Please only enter numeric values into this field.");
		document.theForm.Phonearea.focus();
		return false;
	}
	
		if (document.theForm.Phonearea.value.length < 3)
  {
    alert("Please enter your 3 digit area code.");
    document.theForm.Phonearea.focus();
    return (false);
  }
 
	if (document.theForm.phone.value=="" || !isNum(document.theForm.phone.value)) 
	{
		alert("Please only enter numeric values into this field.");
		document.theForm.phone.focus();
		return false;
	}
	
		if (document.theForm.phone.value.length < 3)
  {
    alert("Please enter the first 3 digits of your phone number.");
    document.theForm.phone.focus();
    return (false);
  }
				
				 if (document.theForm.phone2.value=="" || !isNum(document.theForm.phone2.value)) 
	{
		alert("Please only enter numeric values into this field.");
		document.theForm.phone2.focus();
		return false;
	}	
	
		if (document.theForm.phone2.value.length < 4)
  {
    alert("Please enter the last 4 digits of your phone number.");
    document.theForm.phone2.focus();
    return (false);
  }
		 
			if (((document.theForm.Faxarea.value / document.theForm.Faxarea.value) != 1) && (document.theForm.Faxarea.value != 0)) 
				{
				alert('Please only enter numeric values into this field.');
				document.theForm.Faxarea.focus();
				return (false);
				}
				
				if (((document.theForm.fax.value / document.theForm.fax.value) != 1) && (document.theForm.fax.value != 0)) 
				{
				alert('Please only enter numeric values into this field.');
				document.theForm.fax.focus();
				return (false);
				}
				
		 if (((document.theForm.fax2.value / document.theForm.fax2.value) != 1) && (document.theForm.fax2.value != 0)) 
				{
				alert('Please only enter numeric values into this field.');
				document.theForm.fax2.focus();
				return (false);
				}
				
 if (document.theForm.Subject.selectedIndex == 0) 
   {
    alert('Please select your area of interest.');
	document.theForm.Subject.focus();
    return false;
	}
		
		
		if (document.theForm.Comments.value == "")

  {

    alert("Please enter your comments before submitting this form.");
			
    document.theForm.Comments.focus();

    return (false);
				}
				
			if (isProper(document.theForm.Comments.value) == false)
			{

    alert("Please omit special characters.");
			
    document.theForm.Comments.focus();

    return (false);
				}
	
	var maxChar = 1000
    if (document.theForm.Comments.value.length > maxChar) {
        diff=document.theForm.Comments.value.length - maxChar;
        if (diff>1)
            diff = diff + " characters";
        else
            diff = diff + " character";
            
        alert("This field is limited to " + maxChar + " characters\n" + "Please reduce the text by " + diff);
        document.theForm.Comments.focus();
        return (false);
    }
				

	return true;
}

//-->
