
//******************************************************************
// mem_scripts.js : Scripts for Member Section...
//
// 09/05/2006:   Added 7-digit phone # validation (mwp)
// Phone#  validation

function ParseUSNumber(PhoneNumberInitialString)
  {
    var FmtStr="";
    var index = 0;
    var LimitCheck;

    LimitCheck = PhoneNumberInitialString.length;
    while (index != LimitCheck)
      {
        if (isNaN(parseInt(PhoneNumberInitialString.charAt(index))))
          { }
        else
          { FmtStr = FmtStr + PhoneNumberInitialString.charAt(index); }
        index = index + 1;
      }
    if (FmtStr.length == 7)
      {
        FmtStr =  FmtStr.substring(0,3) + "-" + FmtStr.substring(3,7) ;
      }
    else
      {
        FmtStr=PhoneNumberInitialString;
        alert("The phone number you entered is not 7 digits. \n\nPlease enter the 7-digit portion of your phone number which DOES NOT include your area code.");
        FmtStr = "";
      }
    return FmtStr;
  }

  function formatPhone(obj){
  	//alert("Here in format phone");
  	var n = ParseUSNumber(obj.value, obj);
  	//alert("n = " + n);
  	obj.value = n;
  	try{obj.focus(); } catch(ee){}
  	
  }
//  End -->