<!-- Hide from old browsers

function focusselect(o)
{ o.focus();o.select();
  }
  
function isEMailValid(EMailAddress){
  var c;  // counter
  var ch;  // character at specific index
  var isValid;  // is e-mail address valid?
  var msg;  // alert message
  var ampcount=0;  // number of "@"'s
  var ampfound;  // is "@" found

  // scan for any invalid character
  for(c=0;c<EMailAddress.length;c++){
    ch=EMailAddress.charAt(c);
    isValid=((ch=="@")||(ch==".")||(ch=="-")||(ch=="_")||((ch>="A")&&(ch<="Z"))||((ch>="a")&&(ch<="z"))||((ch>="0")&&(ch<="9")));
    if(ch=="@"){
    ampcount++;ampfound=true;
    // there may not be a "." right after an "@"
    // or the first character is an "@"
    if((EMailAddress.charAt(c+1)==".")||(c==0))
      isValid=false;
    }
    // there may not be a "." succeeding another "." after an "@"
    if((ch==".")&&(EMailAddress.charAt(c+1)==".")&&(ampfound))
      isValid=false;
    if(!isValid)
      break;
  }
  if(ampcount!=1)
    isValid=false;  // there may not be more than one "@"
  // so, is it valid or not?
  
  EMailAddress.toLowerCase();
  
  if(!isValid){
    msg=EMailAddress+" is an invalid e-mail address.";
    alert(msg);
  }
  return (isValid);
}

function isEmpty(field,caption)
{ if(field.value=="")
  { alert("Please enter a value for the \""+caption+"\" field.");
    field.focus();return(true);
    }
  else
  { return(false); }
  }

  
function submit_form(theForm)
{  
   if(validator(theForm) == true)
   {          
      theForm.submit();
   }
}

function validator(theForm)
{
  if(isEmpty(theForm.r_firstname, "First Name")){
    return (false);
  }
  
  if(isEmpty(theForm.re_email, "Email")){
    return (false);
  }
  
  if(!isEMailValid(theForm.re_email.value)){
    theForm.re_email.focus();
    theForm.re_email.select();
    return(false)
  }
  
    
return (true);
}

if(navigator.appName == 'Netscape')
{
   document.onkeyup=check_length;
   document.captureEvents(Event.KEYUP);
}

function check_length(theForm,max)
{
   if(theForm.value.length > max)
   {      
      theForm.value = theForm.value.substring(0,max);
      alert("(maximum " + max + " characters)");
   }
   
   return true;
}
//-->

