<!-- 
// add onload=loadDefaults(document.theCreditCardForm); to body tag
var objForm=null;
function loadDefaults(theForm){
  objForm = theForm;  // objForm is now global
  //objForm.reset();  // will reset the form if user clicks back button after submitting
  if(typeof objForm !== 'undefined' && objForm.name !== "form1"){
    objForm.pan.style.backgroundColor = "#d3d3d3";
    objForm.expdate.style.backgroundColor = "#d3d3d3";
    objForm.pan.value = "  Select Method First";
    objForm.pan.disabled = true;
    objForm.expdate.value = "";
    objForm.cc_type.value = "null";
    objForm.domain_name.focus();
    if(objForm.name == "hostingForm"){
      objForm.autobillCB.item(0).disabled = true;
      objForm.autobillCB.item(1).disabled = true;
    }
    // don't show the note if users javascript is enabled
    document.getElementById("ccNameNote").firstChild.nodeValue = "";
    document.getElementById("ccNumNote").firstChild.nodeValue = "";
  }
}

/* functions applicable to cc forms */
function CheckCC(){
  // Feb 7, 2007 modified and added to NewCAregistrationAccount.php (objForm.name == "form1")
  // The forms input names are different in the Registration form
  var retVal = true, fieldErr = "", nameMsg, result, canHosting, i;
  var payMethod = "";
  if(objForm.name == "form1") payMethod = objForm.CC_type.value.toLowerCase();
  else payMethod = objForm.cc_type.value.toLowerCase();
  var isCreditCard = (payMethod == "visa" || payMethod == "master card")? true : false ;
  if(objForm.name == "hostingForm"){
    //objForm.stats.value = (objForm.statsCB.checked == true)? "yes" : "no";
    //objForm.anti_spam.value = (objForm.anti_spamCB.checked == true)? "yes" : "no";
    objForm.sslx.value = (objForm.sslxCB.checked == true)? "yes" : "no";
    i=0; while(objForm.basicBtn[i].checked==false) i++;
    canHosting = (objForm.basicBtn[i].value.toLowerCase() == "cancel")? true : false ;
  }
  if(objForm.name == "form1"){
    if(objForm.user_name.value == ""){ fieldErr += "Missing a User Name.\n" };
    if(objForm.user_pwd.value == ""){ fieldErr += "Missing a Password.\n" };
    if(objForm.user_pwd.value != "" && objForm.user_pwd.value != objForm.user_pwd_confirm.value){ fieldErr += "Passwords do not match.\n" };
  }
  if(objForm.name != "form1" && zeroStr(objForm.domain_name.value)){ fieldErr += "Missing Domain Name.\n" };
  if(objForm.name != "form1" && zeroStr(objForm.admin_email.value)){ fieldErr += "Missing Admin Email Address.\n" };
  if(objForm.name == "form1"){
    if(objForm.CC_type.value == "null"){ fieldErr += "Missing Payment Method.\n" };
  }else if(objForm.cc_type.value == "null" && !canHosting){ fieldErr += "Missing Payment Method.\n" };
  nameMsg = (isCreditCard)? "Name on Credit Card" : "Cantact Person's Name" ;
  if(objForm.name == "form1"){
    nameMsg = "Name on Credit Card"; // instead of isCreditCard because registrations don't allow for any other.
    if(zeroStr(objForm.CC_name.value)){ fieldErr += "Missing " + nameMsg +".\t\n" };
  }else if(zeroStr(objForm.name_on_cc.value) && !canHosting){ fieldErr += "Missing " + nameMsg +".\t\n" };
  if(objForm.name == "hostingForm" && !canHosting){
    i=0; while(objForm.autobillCB[i].checked==false) i++;
    if((isCreditCard || payMethod == "fax form") && objForm.autobillCB[i].value == "n/a"){
      fieldErr += "Missing Auto-Billing.\n";
    }
  }
  if(payMethod == "interac email" && zeroStr(objForm.pan.value) && !canHosting){
    fieldErr += "Missing the Security Responce Passphrase.\t\n";
  }
  if(fieldErr != "") fieldErr = "The Following Errors Occured:\n\n" + fieldErr;
  /**** Checking the Credit Card *****/
  //alert("validating cc " + objForm.name);
  if(isCreditCard && !canHosting){
    if(objForm.name == "form1") result = Mod10(objForm.CC_number, objForm.CC_expiry, sTime);
    else result = Mod10(objForm.pan, objForm.expdate, sTime);
    if(result){
      fieldErr += "\nCredit Card Error:\n" + result;
    }//alert(cc_type_id); could check the cc type and correct the field if neccessary
  }
  if(fieldErr != ""){
    alert( fieldErr ); retVal=false;
  }else{// enable fields if no errors or we get undefined php variables
    if(canHosting) retVal=confirmCancel();
    if(retVal) objForm.pan.disabled = false; objForm.expdate.disabled = false;
  }
  return retVal;
}

// dimm out the cc fields if the method is not visa or mc
function checkMethod(){
  var ccMethod = objForm.cc_type.value.toLowerCase();
  var disabledColor = "#d3d3d3";
  if(ccMethod == "visa" || ccMethod == "master card" || ccMethod == "interac email" ){
    objForm.pan.style.backgroundColor = "";
    objForm.pan.disabled = false;
    objForm.pan.value = "";
    if(ccMethod == "interac email"){
      objForm.expdate.value = "  n/a";
      objForm.expdate.disabled = true;
      objForm.expdate.style.backgroundColor = disabledColor;
      document.getElementById("ccName").firstChild.nodeValue = "The Contact Person's Name:";
      document.getElementById("ccNum").firstChild.nodeValue = "Security Responce:";
      document.getElementById("ccNumNote").firstChild.nodeValue = "( The password or pass phrase you entered when creating the Interac Email. )";
    }else{
      objForm.expdate.value = "";
      objForm.expdate.disabled = false;
      objForm.expdate.style.backgroundColor = "";
      document.getElementById("ccName").firstChild.nodeValue = "Name as it appears on Credit Card:";
      document.getElementById("ccNum").firstChild.nodeValue = "Credit Card Number:";
      document.getElementById("ccNumNote").firstChild.nodeValue = "";
    }
  }else{
    objForm.pan.style.backgroundColor = disabledColor;
    objForm.expdate.style.backgroundColor = disabledColor;
    objForm.pan.disabled = true;
    objForm.expdate.disabled = true;
    if(ccMethod == "null") objForm.pan.value = "  Select Method First";
    else objForm.pan.value = "  n/a";
    objForm.expdate.value = "  n/a";
    document.getElementById("ccName").firstChild.nodeValue = "The Contact Person's Name:";
    document.getElementById("ccNum").firstChild.nodeValue = "Credit Card Number:";
    document.getElementById("ccNumNote").firstChild.nodeValue = "";
  }
  
  if(objForm.name == "hostingForm"){  // Auto billing for Hosting Only...
    if(ccMethod == "visa" || ccMethod == "master card" || ccMethod == "fax form"){
      objForm.autobillCB.item(0).disabled = false;
      objForm.autobillCB.item(1).disabled = false;
      objForm.autobillCB.item(2).disabled = true; 
    } else {
      objForm.autobillCB.item(0).disabled = true;
      objForm.autobillCB.item(1).disabled = true;
      objForm.autobillCB.item(2).disabled = false;
      objForm.autobillCB.item(2).checked = true;
    }
  }
}

function paymentMethod(){
  var ccMethod = objForm.cc_type.value.toLowerCase();
  if(ccMethod == "null"){
    objForm.cc_type.focus();
    alert("Please select the credit card in the \"Payment Method\"\t \nbefore entering credit card information.");
  }
}

/* page specific functions */

// funtions used in hosting form
function minOption(objField){
  //objForm.statsCB.checked == false && 
  if(objForm.sslxCB.checked == false){
    if(objField.name == "frequency" && objField.value == "monthly"){
      alert("Minimum billing for a \"Basic Hosting Plan\" is \"Quarterly\".\t");
    }
    if(objForm.frequency.value == "monthly") objForm.frequency.value = "quarterly";
  }
}

function showCancel(){
  alert("        ******** Cancel ITI Hosting ********\n\n" + 
        "As a security precaution a confirmation email will be sent \n" +
        "to the administrative contact of the domain name.\n\n" + 
        "Once the admin contact has replied and acknowledged \n" +
        "all files and directories will be deleted.");
}

function confirmCancel(){
  return confirm( "   *** Canceling Hosting Services with ITI. ***\t\n\n" +
                  "All files and directories will be deleted.\n\n" +
                  "Click OK to proceed, or click Cancel to abort...");
}

function autoBilling(){
  // not sure what I had in mind for this
}

// functions used in Renewal form

// functions used in Registration form

// -->
