<!--
function runVerification(formName) {

   // first make sure they even entered all the shtuff
   if (formName.cctype.selectedIndex == 0) {
      alert("You didn't select a Credit Card.");
      formName.cctype.focus();
      return false;
   }
   if (!formName.ccnum.value) {
      alert("You didn't enter a credit card number.");
      formName.ccnum.focus();
      return false;
   }
   if ((formName.ccexpmo.selectedIndex == 0) || (formName.ccexpyr.selectedIndex == 0)) {
      alert("You didn't enter a valid expiration date.");
      formName.ccexpmo.focus();
      return false;
   }

   // nacho returns a true if the cc format is good
   // burrito return a true if the cc expiration date is good (and not
   //      already past)
   nacho=ccformatValidate(formName);
   if (nacho) {
      burrito=ccexpdateValidate(formName);
      if (burrito)
         return true;
      alert("Warning! Your credit card has expired.");
      formName.ccnum.focus();
      return false;
   } else
   {
      alert("Warning! Credit card is invalid!");
      formName.ccnum.focus();
      return false;
   }
}

function ccformatValidate(formName) {

   if (formName.cctype.selectedIndex == 1) cctype="visa";
   if (formName.cctype.selectedIndex == 2) cctype="mastercard";
   if (formName.cctype.selectedIndex == 3) cctype="amex";
   if (formName.cctype.selectedIndex == 4) cctype="discover";

   // get the "clean" version of the cc number, only numbers
   var ccnum=GimmeNumbers(formName.ccnum.value);

   // check for correct card number length
   if (ccnum.length<13) return false;

   if (ccnum.length!=16 && cctype=="discover") return false;
   if (ccnum.length!=16 && cctype=="mastercard") return false;
   if (ccnum.length!=15 && cctype=="amex") return false;
   if (ccnum.length!=13 && ccnum.length!=16 && cctype=="visa") return false;

   // check first number to verify card type
   var ccdigit=ccnum.substring(0,1);
   if (cctype=="amex" && ccdigit!="3") return false;
   if (cctype=="visa" && ccdigit!="4") return false;
   if (cctype=="mastercard" && ccdigit!="5") return false;
   if (cctype=="discover" && ccdigit!="6") return false;

   // make an array and fill it with the individual digits of the cc number
   ccnumchk=new Array;
   for (splits=0; splits<ccnum.length; splits++) {
      ccnumchk[splits]=ccnum.substring(splits, splits+1);
   }

   // perform the weird mathematical method (some base 10 stuff) to
   //      convert the number to a two digit number
   //      for those of you who aren't as familiar with the js operators
   //      i'll comment some of the math lines...well, really just one
   var skemp=0;
   for (splits=0; splits<ccnum.length; splits++) {
      if (splits%2==0) {      // if splits is an even number...
                              //      more specifically, if splits
                              //      divided by two has no
                              //      remainder (ya' know, remainder
                              //      one of those math things :),
                              //      then perform this block
         ccnumchk[splits]=ccnumchk[splits]*2;
         if (ccnumchk[splits]>=10) ccnumchk[splits]=ccnumchk[splits]-9;
      }
      // play a js trick to switch ccnumchk[splits] to a number
      //      variable instead of a string
      ccnumchk[splits]++; ccnumchk[splits]--;
      skemp=skemp + ccnumchk[splits].valueOf();
   }

   if (skemp%10!=0) {return false;} // if the resulting number isn't base
                                    //     10, they're lying to ya...
                                    //     or they mistyped...same thing
   else {
      formName.ccnum.value=ccnum;
      return true;
   }
}

function ccexpdateValidate(formName) {
   // clean up the expiration date...becuase invariably people will not
   //      follow directions and put some weird delimeter in there
   var ccexp=GimmeNumbers(formName.ccexp.value);
   var expmonth=0;
   var expyear=0;
   var realmonth=0;
   var realyear=0;

   // start with the intuitive - length
   //      since dates have to be between 3 chars long (399) and 6 chars
   //      long (121998) anything else needs to be tossed
   if (ccexp.length<3 || ccexp.length>6) return false;
   if (ccexp.length==3) {
      expmonth=ccexp.substring(0,1);
      expyear=ccexp.substring(1,3);
   }
   if (ccexp.length==4) {
      // this bit here is for those people who put a zero in front
      //      of a single number (like 04 instead of 4)
      if (ccexp.substring(0,1)=="0") {
         expmonth=ccexp.substring(1,2);
         expyear=ccexp.substring(2,4);
      } else {
         expmonth=ccexp.substring(0,2);
         expyear=ccexp.substring(2,4);
      }
   }
   if (ccexp.length==5) {
      expmonth=ccexp.substring(0,1);
      expyear=ccexp.substring(1,5);
   }
   if (ccexp.length==6) {
      expmonth=ccexp.substring(0,2);
      expyear=ccexp.substring(2,6);
   }

   // make sure month is a valid value
   if (expmonth<1 || expmonth>12) return false;

   // make sure months and years are numbers and not a strings
   expmonth++; expmonth--;
   expyear++; expyear--;

   // convert years to a standard 4 digit format
   if (ccexp.length==3 || ccexp.length==4) expyear=expyear+1900;

   // check the date
   timeisit=new Date();
   realmonth=timeisit.getMonth();
   realmonth++;
   realyear=timeisit.getYear();

   // because of the way js works with dating, every year until 2000 is
   //      represented by the year minus 1900, but at 2000 and on, is
   //      represented as is...weird...2000 "bug" shtuff...
   if (realyear<2000) realyear=realyear+1900;

   // compare expiration values with current ones
   if (expyear==realyear) {
      if (expmonth<realmonth) return false;
   }
   if (expyear<realyear) return false;

   // make expmonth and expyear strings again so we can make a string
   //      to pass to a cgi to process authorization
   expmonth+=""; expyear+="";
   if (expmonth.length==1) expmonth="0"+expmonth;
   ccexp=expmonth.substring(0,expmonth.length);
   ccexp+=expyear.substring(0,4);
   formName.ccexp.value=ccexp;

   return true;
}

function GimmeNumbers(loadedText) {     // this function removes everything but numbers
   var cleanText="";

   // make sure input is a string
   loadedText+="";

   for (skimp=0; skimp<loadedText.length; skimp++) {
      if (loadedText.substring(skimp,skimp+1)>="0" && loadedText.substring(skimp, skimp+1)<="9") cleanText+=loadedText.substring(skimp, skimp+1);
   }
   return cleanText;
}

function validateform(form) {

   var domain = "";
   var url = "";
   var illegal = "";

   domain = form.domain.value;
   url = form.url.value;
   illegal = domain.match(/[^a-zA-Z0-9-]/g);
   if ((domain.length == 0) && (url.length == 0)) {
      alert ("A domain name or URL is required to identify your account!");
      form.domain.focus();
      return (false);
   } else if (domain.length > 63) {
      alert ("Your domain name is too long.\nMaximum length is 63 characters.");
      form.domain.focus();
      return (false);
   } else if ((domain.indexOf(".com") != -1) ||
              (domain.indexOf(".net") != -1) ||
              (domain.indexOf(".org") != -1)) {
      alert ("Do not include the top level domains .com, .net and .org in your domain name.");
      form.domain.focus();
      return (false);
   } else if (illegal != null) {
      alert ("Your domain name can only contain letters, numbers and/or dash (-) characters.");
      form.domain.focus();
      return (false);
   }
   if (form.firstname.value.length == 0) {
      alert ("Your first name is required.");
      form.firstname.focus();
      return (false);
   }
   if (form.lastname.value.length == 0) {
      alert ("Your last name is required.");
      form.lastname.focus();
      return (false);
   }
   if (form.address.value.length == 0) {
      alert ("Your street address is required.");
      form.address.focus();
      return (false);
   }
   if (form.city.value.length == 0) {
      alert ("Your city is required.");
      form.city.focus();
      return (false);
   }
   if (form.state.selectedIndex == 0) {
      alert ("Your state is required.");
      form.state.focus();
      return (false);
   }
   if (form.zipcode.value.length == 0) {
      alert ("Your zip code is required.");
      form.zipcode.focus();
      return (false);
   }
   if (form.phone.value.length == 0) {
      alert ("Your phone number is required.");
      form.phone.focus();
      return (false);
   }
   if (form.emailto.value.length == 0) {
      alert ("Your email address is required.");
      form.emailto.focus();
      return (false);
   }
   if (form.emailtoconfirm.value.length == 0) {
      alert ("Your email address confirmation.");
      form.emailtoconfirm.focus();
      return (false);
   }
   if (form.emailto.value != form.emailtoconfirm.value) {
      alert ("Your email addresses don't match!");
      form.emailto.focus();
      return (false);
   }
   if (form.cctype.selectedIndex == 0) {
      alert ("Your credit card type is required.");
      form.cctype.focus();
      return (false);
   }

   //
   // Require and validate CC information If payment is by CC
   //
   if (form.cctype.selectedIndex != 3) {
      if (form.ccnum.value.length == 0) {
         alert ("Your credit card number is required.");
         form.ccnum.focus();
         return (false);
      }
      if (form.ccexpmo.selectedIndex == 0) {
         alert ("Your credit card expiration month is required.");
         form.ccexpmo.focus();
         return (false);
      }
      if (form.ccexpyr.selectedIndex == 0) {
         alert ("Your credit card expiration year is required.");
         form.ccexpyr.focus();
         return (false);
      }
   }
   if (form.signature.value.length == 0) {
      alert ("Your electronic signature is required.");
      form.signature.focus();
      return (false);
   }
   d = new Date();
   form.signdate.value = d.toGMTString();
   return (true);
}
//-->

