// JavaScript Document
<!--
function openWin(webpage){
	window.open(webpage,'','width=700,height=450,scrollbars,resizable');
}

function validate_required(field,alerttxt) {
    with (field) {
      if (value==null||value=="") {
          field.focus();
          return alerttxt;
      }
      else {
        return "";
      }
    }
}

function validate_email(field,alerttxt) {
    with (field) {
      apos=value.indexOf("@");
      dotpos=value.lastIndexOf(".");
      if (apos<1||dotpos-apos<2) {
        field.focus();
        return alerttxt;
      }
      else {
        return "";
      }
    }
}
  
function validate_form(thisform) {
    var emailFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

    var sErr = "";
    if (thisform.fullname.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Full Name";
    }
    
    if (thisform.company.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Company Name";
    }

    if (thisform.email.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Email Address";
    } else {
      if (!emailFilter.test(thisform.email.value)) {
        if (sErr) sErr += "\r\n";
        sErr += "- A Valid Email Address";
      }
    }

    if (thisform.tel.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Telephone Number";
    }

    if (thisform.atv.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Average value of transactions";
    }

    if (thisform.capcode.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Security Check Code";
    }

    if (sErr) {
        sErr = "In order to provide you with a quick and accurate service,\r\nplease ensure you have supplied the following information:\r\n" + sErr;
        alert(sErr);
        return false;
    } else {
        return true;
    }
}

function validate(F) {

    var facility = 0;
    var emailFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

    var sErr = "";
    if (F.txtFullName.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Full Name";
    }
    
    if (F.txtID.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- ID Number";
    }
    
    if (F.txtPhone.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Phone Number";
    }

    if (F.txtEmail.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Email Address";
    } else {
      if (!emailFilter.test(F.txtEmail.value)) {
        if (sErr) sErr += "\r\n";
        sErr += "- A Valid Email Address";
      }
    }

    if (F.txtReferName.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Referred By";
    }

    if (F.txtBusName.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Business Name";
    }

    if (F.txtBusNature.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Nature of Business";
    }

    if (F.txtPostalAddress1.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Postal Address";
    }

    if (F.txtPhysicalAddress1.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Physical Address";
    }

    if (F.selBank.selectedIndex == 5 && F.txtBank.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Bank Name";
    }

    if (F.txtBranch.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Branch Name";
    }

    if (F.txtAccountName.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Account Name";
    }

    if (F.txtAccountNumber.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Account Number";
    }

    if (F.txtPeriod.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Period with Bank";
    }

    if (F.txtTurnover.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Monthly Turnover";
    }

    for (i = 0;i<F.elements["chkFacility[]"].length;i++) {
        if (F.elements["chkFacility[]"][i].checked) facility += parseInt(F.elements["chkFacility[]"][i].value);
    }
    if (facility == 0) {
        if (sErr) sErr += "\r\n";
        sErr += "- Facility Required";
    }

    if (F.txtWebEmail.value != '' && !emailFilter.test(F.txtWebEmail.value)) {
      if (sErr) sErr += "\r\n";
      sErr += "- A Valid Web Developer Email Address";
    }

    if (F.capcode.value == '') {
        if (sErr) sErr += "\r\n";
        sErr += "- Security Check Code";
    }

    if (sErr) {
        sErr = "In order to provide you with a quick and accurate service,\r\nplease ensure you have supplied the following information:\r\n" + sErr;
        alert(sErr);
        return false;
    } else {
        return true;
    }
}

function showBankBox() {
  if (document.getElementById("selBank").selectedIndex == 5) {
    document.getElementById("txtBank").disabled = false;
    document.getElementById("bankName").style.display = '';
    document.getElementById("txtBank").style.backgroundColor = '';
    document.getElementById("txtBank").focus();
  } else {
    document.getElementById("txtBank").value = '';
    document.getElementById("txtBank").disabled = true;
    document.getElementById("bankName").style.display = 'none';
    document.getElementById("txtBank").style.backgroundColor = 'silver';
  }
}

function showPaySubsOptions(thisform) {
  if (document.getElementById("chkFacilityPaySubs").checked) {
    thisform.opPaySubs[0].disabled = false;
    thisform.opPaySubs[1].disabled = false;
    thisform.opPaySubs[0].checked = true;
  } else {
    thisform.opPaySubs[0].checked = false;
    thisform.opPaySubs[0].disabled = true;
    thisform.opPaySubs[1].checked = false;
    thisform.opPaySubs[1].disabled = true;
  }
}

function ContentDisplay(d) {
    if (d == 'PAYPOINT') {
        document.getElementById("PAYPOINT_link").style.display = "none";
        document.getElementById("PAYPOINT_demo").style.display = "block";
        document.getElementById("PAYBILL_link").style.display = "block";
        document.getElementById("PAYBILL_demo").style.display = "none";
        document.getElementById("PAYWEB_link").style.display = "block";
        document.getElementById("PAYWEB_demo").style.display = "none";
    } else if (d == 'PAYBILL') {
        document.getElementById("PAYPOINT_link").style.display = "block";
        document.getElementById("PAYPOINT_demo").style.display = "none";
        document.getElementById("PAYBILL_link").style.display = "none";
        document.getElementById("PAYBILL_demo").style.display = "block";
        document.getElementById("PAYWEB_link").style.display = "block";
        document.getElementById("PAYWEB_demo").style.display = "none";
    } else if (d == 'PAYWEB') {
        document.getElementById("PAYPOINT_link").style.display = "block";
        document.getElementById("PAYPOINT_demo").style.display = "none";
        document.getElementById("PAYBILL_link").style.display = "block";
        document.getElementById("PAYBILL_demo").style.display = "none";
        document.getElementById("PAYWEB_link").style.display = "none";
        document.getElementById("PAYWEB_demo").style.display = "block";
    }
}
//-->
