function validCC(cc){
// verifies the validity of a credit card number using the 
// LUHN Formula (mod 10). Returns true upon valid, false otherwise

  // strip out all non-numerics
  creditcard='';
  for(var i=0;i<cc.length;i++){
    c = cc.charAt(i);
    if(c>'9' || c<'0'){}
    else 
      creditcard+= c;
  }
  
  if(creditcard.length<13) return false; // VISA cards can be 13 digits
  if(creditcard.length>16) return false; // 16 numbers is the maximum

  // do not complete the following test as per EG. However
  // if you want to reactivate this LUHN test just comment
  // out the next line:
  return true;  

  var doubledigit = creditcard.length % 2 == 1 ? false : true;
  var checkdigit = 0;
  var tempdigit;
  
  for (i = 0; i < creditcard.length ; i++){
    tempdigit = eval(creditcard.charAt(i));
    if (doubledigit){
      tempdigit *= 2;
      checkdigit += (tempdigit % 10);
      if ((tempdigit / 10) >= 1.0) checkdigit++;
      doubledigit = false;
    }
    else {
      checkdigit += tempdigit;
      doubledigit = true;
    }
  }
  return (checkdigit % 10) == 0 ? true : false;
  
}

function validEmail(s){
// VERY rudimentary routine to check the validity of an email address
// We don't want to be overly strict here, but do want to avoid obvious errors.
   
   if(!s) return false;
   
   // advanced browsers = advanced checking
   // regexp from http://javascriptkit.com
   if(document.layers||document.getElementById||document.all){
     var filter=/^\s*([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)\s*$/i
     if (filter.test(s)) return true;
     else return false;
   }

   // simple browsers = simple checking
   if(s.indexOf('@')<1) {return false; }   // at least one @
   if(s.indexOf('.')<1) {return false; }   // at least one dot
   return true;

}