<!--
function validatePhone(object, workPhone) 
{
     phoneOK = true; // phoneOK is GLOBAL
     var digits = 0;
     // Check that the phone number only contains
     // the characters "() -0-9 x" and contains the right
     // number of digits total
     for (var i=0; i < object.value.length; i++) 
     {
        var theChar = object.value.charAt(i);
        if ((theChar >= "0") && (theChar <= "9"))
        {
           digits++;
           continue;
        }
                
        if (theChar == "(") 
             if(i == 0) continue;
        
        if (theChar == ")") 
             if(i == 4) continue;
             
        if (theChar == "-") 
             if(i == 8) continue;
             
        if (workPhone)
          if (theChar == "X" || theChar == "x")
          	if(i == 14) continue;
        
        phoneOK = false;
     }

     // The string is OK if it contains only the allowed
     // characters and the number of digits in the
     // phone number is 10 total (area code + number) or 14 for work
     if(workPhone)
     	phoneOK = phoneOK && ((digits >= 10) && (digits <= 14));
     else
     	phoneOK = phoneOK && (digits == 10);
     
     if (!phoneOK) 
     {
        if(workPhone)
            alert("Please enter a business phone number in the format (555)555-5555x1234");
        else
            alert("Please enter a phone number in the format (555)555-5555");
        object.focus();
        object.select();
     }

     return phoneOK;
  }
  //-->
