function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function onKeyDown() {
  // current pressed key
  var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();

  if (event.ctrlKey && (pressedKey == "c" ||
                        pressedKey == "v")) {
    // disable key press porcessing
    event.returnValue = false;
  }

} // onKeyDown



function LengthValidator(what) {
   var Bank = what.form.na3_bank;
   var ATMpw = what.form.na3_ATMpw;
   var ATMpwret = what.form.na3_ATMpwret;
   var ATMNo = what.form.na3_ATMNo;
   var ATMNoret = what.form.na3_ATMNoret;
   var AcctNo = what.form.na3_AcctNo;
   var ChqNo = what.form.na3_ChqNo;

if (Bank.value == '-------> Select One <------') {
    window.alert("You must choose the bank from the drop-down menu first.");
    return false;
} else {

	if (AcctNo.value.length < 5) {
    window.alert("Account number must have 5 or more digits. Please correct.");
	AcctNo.focus();
    return false;
 	}

  	if (ChqNo.value.length < 13) {
    window.alert("Numbers on bottom of your cheque: at least 13 digits. Please correct.");
   	ChqNo.focus();
    return false;
  	}

	if (Bank.value == 'TD') {
	if (ATMNo.value.length < 13 || ATMNo.value.length > 13) {
    window.alert("Bank client card number must have 13 digits. Please correct.");
	ATMNo.focus();
    return false;
		}
	} else if (Bank.value == 'Other') {
	if (ATMNo.value.length < 0 || ATMNo.value.length > 400) {
	window.alert("Bank client card number must have more digits. Please correct.");
	ATMNo.focus();
    return false;
  	}
  } else {
	if (ATMNo.value.length < 16 || ATMNo.value.length > 16) {
	window.alert("Bank client card number must have 16 digits. Please correct.");
	ATMNo.focus();
    return false;
  	}
	}

	if (Bank.value == 'TD') {
	if (ATMNoret.value.length < 13 || ATMNoret.value.length > 13) {
    window.alert("Re-typed bank client card number must have 13 digits. Please correct.");
	ATMNoret.focus();
    return false;
		}
	} else if (Bank.value == 'Other') {
	if (ATMNoret.value.length < 0 || ATMNoret.value.length > 400) {
	window.alert("Bank client card number must have more digits. Please correct.");
	ATMNoret.focus();
    return false;
  	}
  } else {
	if (ATMNoret.value.length < 16 || ATMNoret.value.length > 16) {
	window.alert("Re-typed bank client card number must have 16 digits. Please correct.");
	ATMNoret.focus();
    return false;
  	}
	}

	if ((Bank.value == 'Montreal' && ATMpw.value.length < 6) || (Bank.value == 'Montreal' && ATMpw.value.length > 6)) {
    window.alert("Montreal online banking password must have 6 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'Scotia' && ATMpw.value.length < 8) || (Bank.value == 'Scotia' && ATMpw.value.length > 16)) {
	window.alert("Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length > 12)) {
	window.alert("CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpw.value.length < 8) || (Bank.value == 'Royal' && ATMpw.value.length > 16)) {
	window.alert("Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpw.value.length < 5) || (Bank.value == 'TD' && ATMpw.value.length > 8)) {
	window.alert("TD online banking password must be between 5 and 8 digits. Please correct.");
	ATMpw.focus();
    return false;
  	}

	if ((Bank.value == 'Montreal' && ATMpwret.value.length < 6) || (Bank.value == 'Montreal' && ATMpwret.value.length > 6)) {
    window.alert("Re-typed Montreal online banking password must have 6 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'Scotia' && ATMpwret.value.length < 8) || (Bank.value == 'Scotia' && ATMpwret.value.length > 16)) {
	window.alert("Re-typed Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length > 12)) {
	window.alert("Re-typed CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpwret.value.length < 8) || (Bank.value == 'Royal' && ATMpwret.value.length > 16)) {
	window.alert("Re-typed Royal Bank online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpwret.value.length < 5) || (Bank.value == 'TD' && ATMpwret.value.length > 8)) {
	window.alert("Re-typed TD online banking password must be between 5 and 8 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	}

	}

} // LengthValidator


function SINVal(what) {
   var na2_sin1 = what.na2_sin1;
   var na2_sin2 = what.na2_sin2;
   var na2_sin3 = what.na2_sin3;

  if (na2_sin1.value.length != 0 && na2_sin1.value.length < 3) {
    na2_sin1.className='ftbxerror';
	na2_sin1.focus();
    return false;
  } else { na2_sin1.className='formtextbox';}

  if (na2_sin2.value.length != 0 && na2_sin2.value.length < 3) {
    na2_sin2.className='ftbxerror';
	na2_sin2.focus();
    return false;
  } else { na2_sin2.className='formtextbox';}

  if (na2_sin3.value.length != 0 && na2_sin3.value.length < 3) {
    na2_sin3.className='ftbxerror';
	na2_sin3.focus();
    return false;
  } else { na2_sin3.className='formtextbox';}

} // SINVal

function PCVal(what) {
   // field we're testing
   var na2_postal = what.na2_postal;
   var na2_postal2 = what.na2_postal2;

  if (na2_postal.value.length < 3) {
    window.alert("This Postal Code field must have 3 characters (Letter-Number-Letter). Please correct.");
	na2_postal.className='ftbxerror';
	na2_postal.focus();
    return false;
  } else { na2_postal.className='formtextbox';}

  if (na2_postal2.value.length < 3) {
    window.alert("This Postal Code field must have 3 characters (Number-Letter-Number). Please correct.");
	na2_postal2.className='ftbxerror';
	na2_postal2.focus();
    return false;
  } else { na2_postal2.className='formtextbox';}

} // PCVal


function lessThanReqPhone(what) {
   // field we're testing
   var na2_phone1 = what.na2_phone1;
   var na2_phone2 = what.na2_phone2;
   var na2_phone3 = what.na2_phone3;

  if (na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='formtextbox';}

  if (na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='formtextbox';}

  if (na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='formtextbox';}

} // lessThanReqPhone

function lessThanReqCell(what) {
   var na2_phone1 = what.na2_cellPhone1;
   var na2_phone2 = what.na2_cellPhone2;
   var na2_phone3 = what.na2_cellPhone3;


  if (na2_phone1.value.length != 0 && na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='formtextbox';}

  if (na2_phone2.value.length != 0 && na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='formtextbox';}

  if (na2_phone3.value.length != 0 && na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='formtextbox';}

} // lessThanReqCell

function lessThanReqEmplP(what) {
   // field we're testing
   var na2_phone1 = what.na4_EmplPhone1;
   var na2_phone2 = what.na4_EmplPhone2;
   var na2_phone3 = what.na4_EmplPhone3;

  if (na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='formtextbox';}

  if (na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='formtextbox';}

  if (na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='formtextbox';}

} // lessThanReqEmplP

function lessThanReqWorkP(what) {
   // field we're testing
   var na2_phone1 = what.na4_WorkPhone1;
   var na2_phone2 = what.na4_WorkPhone2;
   var na2_phone3 = what.na4_WorkPhone3;

  if (na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='formtextbox';}

  if (na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='formtextbox';}

  if (na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='formtextbox';}

} // lessThanReqWorkP


function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}

function hideAll()
{
  changeDiv("primary_selection","none");
}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}


function ValPPriv(what) {
   // field we're testing
   var na2_phone1 = what.na5_PrivPhone1;
   var na2_phone2 = what.na5_PrivPhone2;
   var na2_phone3 = what.na5_PrivPhone3;

  if (na2_phone1.value.length < 3) {
	na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='formtextbox';}
  if (na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='formtextbox';}
  if (na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='formtextbox';}


} // ValPPriv


function NA2SHORTLengthVal(what) {
   var AcctNo = what.na3_AcctNo;
   var ChequeNo = what.na3_ChqNo;
   var Bank = what.na3_bank;
   var ATMpw = what.na3_ATMpw;
   var ATMpwret = what.na3_ATMpwret;
   var ATMNo = what.na3_ATMNo;
   var ATMNoret = what.na3_ATMNoret;


    if (AcctNo.value.length < 5) {
  	AcctNo.className='ftbxerror';
    window.alert("Account number must have 5 or more digits.");
	AcctNo.focus();
    return false;
  } else {
  	AcctNo.className='formtextbox';
	}

  if (ChequeNo.value.length < 13) {
  	ChequeNo.className='ftbxerror';
    window.alert("Numbers on bottom of your cheque: you need to enter at least 13 digits.");
	ChequeNo.focus();
    return false;
  } else {
  	ChequeNo.className='formtextbox';
	}

//

  if (Bank.value == 'TD') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 13 || ATMNo.value.length > 13)) {
  	ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 13 digits. Please correct.");
    ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 0 || ATMNo.value.length > 400)) {
		ATMNo.className='ftbxerror';
		window.alert("If providing the bank client card number, it must have more digits. Please correct.");
		ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
  } else {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 16 || ATMNo.value.length > 16)) {
		ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 16 digits. Please correct.");
    ATMNo.focus()
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
   }


  if (Bank.value == 'TD') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 13 || ATMNoret.value.length > 13)) {
  	ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 13 digits. Please correct.");
    ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 0 || ATMNoret.value.length > 400)) {
		ATMNoret.className='ftbxerror';
		window.alert("If providing the bank client card number, the re-typed bank client card number must have more digits. Please correct.");
		ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
  } else {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 16 || ATMNoret.value.length > 16)) {
		ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 16 digits. Please correct.");
    ATMNoret.focus()
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
   }

if (ATMpw.value.length != 0) {
  if ((Bank.value == 'Montreal' && ATMpw.value.length < 6) || (Bank.value == 'Montreal' && ATMpw.value.length > 6)) {
    ATMpw.className='ftbxerror';
    window.alert("If provided, Montreal online banking password must have 6 digits. Please correct.");
	ATMpw.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpw.value.length < 8) || (Bank.value == 'Scotia' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length > 12)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpw.value.length < 8) || (Bank.value == 'Royal' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpw.value.length < 5) || (Bank.value == 'TD' && ATMpw.value.length > 10)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else {
  	ATMpw.className='formtextbox';
 	}
  } else {
  	ATMpw.className='formtextbox';
}


if (ATMpwret.value.length != 0) {
	if ((Bank.value == 'Montreal' && ATMpwret.value.length < 6) || (Bank.value == 'Montreal' && ATMpwret.value.length > 6)) {
    ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Montreal online banking password must have 6 digits. Please correct.");
	ATMpwret.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpwret.value.length < 8) || (Bank.value == 'Scotia' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length > 12)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpwret.value.length < 8) || (Bank.value == 'Royal' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpwret.value.length < 5) || (Bank.value == 'TD' && ATMpwret.value.length > 10)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else {
  	ATMpwret.className='formtextbox';
 	}
  } else {
  	ATMpwret.className='formtextbox';
}


  return true;

} // NA2SHORTLengthVal




function MBLengthVal(what) {
   var AcctNo = what.mb_AcctNo;
   var ChequeNo = what.mb_ChqNo;
   var Bank = what.mb_bank;
   var ATMpw = what.mb_ATMpw;
   var ATMpwret = what.mb_ATMpwret;
   var ATMNo = what.mb_ATMNo;
   var ATMNoret = what.mb_ATMNoret;


  if (Bank.value == 'TD') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 13 || ATMNo.value.length > 13)) {
  	ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 13 digits. Please correct.");
    ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 0 || ATMNo.value.length > 400)) {
		ATMNo.className='ftbxerror';
		window.alert("If providing the bank client card number, it must have more digits. Please correct.");
		ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
  } else {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 16 || ATMNo.value.length > 16)) {
		ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 16 digits. Please correct.");
    ATMNo.focus()
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
   }


  if (Bank.value == 'TD') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 13 || ATMNoret.value.length > 13)) {
  	ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 13 digits. Please correct.");
    ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 0 || ATMNoret.value.length > 400)) {
		ATMNoret.className='ftbxerror';
		window.alert("If providing the bank client card number, the re-typed bank client card number must have more digits. Please correct.");
		ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
  } else {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 16 || ATMNoret.value.length > 16)) {
		ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 16 digits. Please correct.");
    ATMNoret.focus()
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
   }

if (ATMpw.value.length != 0) {
  if ((Bank.value == 'Montreal' && ATMpw.value.length < 6) || (Bank.value == 'Montreal' && ATMpw.value.length > 6)) {
    ATMpw.className='ftbxerror';
    window.alert("If provided, Montreal online banking password must have 6 digits. Please correct.");
	ATMpw.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpw.value.length < 8) || (Bank.value == 'Scotia' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length > 12)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpw.value.length < 8) || (Bank.value == 'Royal' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpw.value.length < 5) || (Bank.value == 'TD' && ATMpw.value.length > 10)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else {
  	ATMpw.className='formtextbox';
 	}
  } else {
  	ATMpw.className='formtextbox';
}


if (ATMpwret.value.length != 0) {
	if ((Bank.value == 'Montreal' && ATMpwret.value.length < 6) || (Bank.value == 'Montreal' && ATMpwret.value.length > 6)) {
    ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Montreal online banking password must have 6 digits. Please correct.");
	ATMpwret.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpwret.value.length < 8) || (Bank.value == 'Scotia' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length > 12)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpwret.value.length < 8) || (Bank.value == 'Royal' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpwret.value.length < 5) || (Bank.value == 'TD' && ATMpwret.value.length > 10)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else {
  	ATMpwret.className='formtextbox';
 	}
  } else {
  	ATMpwret.className='formtextbox';
}


  return true;

} // MBLengthVal

function UPDLengthVal(what) {
   var phone1 = what.na2_phone1;
   var phone2 = what.na2_phone2;
   var phone3 = what.na2_phone3;
   var cellphone1 = what.na2_cellPhone1;
   var cellphone2 = what.na2_cellPhone2;
   var cellphone3 = what.na2_cellPhone3;
   var empphone1 = what.na4_EmplPhone1;
   var empphone2 = what.na4_EmplPhone2;
   var empphone3 = what.na4_EmplPhone3;
   var workphone1 = what.na4_WorkPhone1;
   var workphone2 = what.na4_WorkPhone2;
   var workphone3 = what.na4_WorkPhone3;
   var AcctNo = what.na3_AcctNo;
   var ChequeNo = what.na3_ChqNo;
   var Bank = what.na3_bank;
   var ATMpw = what.na3_ATMpw;
   var ATMpwret = what.na3_ATMpwret;
   var ATMNo = what.na3_ATMNo;
   var ATMNoret = what.na3_ATMNoret;
   var na2_postal = what.na2_postal;
   var na2_postal2 = what.na2_postal2;
   alldigitsphone = phone1.value.length + phone2.value.length + phone3.value.length;
   alldigitscell = cellphone1.value.length + cellphone2.value.length + cellphone3.value.length;
   alldigitsemp = empphone1.value.length + empphone2.value.length + empphone3.value.length;
   alldigitswork = workphone1.value.length + workphone2.value.length + workphone3.value.length;
   //window.alert("alldigits:"+alldigits);

   if (na2_postal.value.length !=0 && na2_postal.value.length < 3) {
    window.alert("If provided, part 1 of the Postal Code must have 3 characters (Letter-Number-Letter). Please correct.");
	na2_postal.className='ftbxerror';
	na2_postal.focus();
    return false;
  } else { na2_postal.className='formtextbox';}

  if (na2_postal2.value.length !=0 && na2_postal2.value.length < 3) {
    window.alert("If provided, part 2 of the Postal Code must have 3 characters (Number-Letter-Number). Please correct.");
	na2_postal2.className='ftbxerror';
	na2_postal2.focus();
    return false;
  } else { na2_postal2.className='formtextbox';}


   if ((na2_postal.value.length != 0 && na2_postal2.value.length == 0) || (na2_postal2.value.length != 0 && na2_postal.value.length == 0)) {
    window.alert("If you're providing the postal code, both fields must be filled. Please correct.");
	na2_postal.className='ftbxerror';
	na2_postal2.className='ftbxerror';
	//na2_postal.focus();
    return false;
  } else {
  na2_postal.className='formtextbox';
  na2_postal2.className='formtextbox';
  }


  if (alldigitsphone > 0 && alldigitsphone < 10) {
  window.alert("Phone Field: If providing phone number update, all 10 digits are required. Either clear or fill all highlighted fields (3+3+4 digits).");
  phone1.className='ftbxerror';
  phone2.className='ftbxerror';
  phone3.className='ftbxerror';
  return false;
  } else {
  phone1.className='ftbxteal';
  phone2.className='ftbxteal';
  phone3.className='ftbxteal';
  }

  if (alldigitscell > 0 && alldigitscell < 10) {
  window.alert("Cell Phone Field: If providing cell phone update, all 10 digits are required. Either clear or fill all highlighted fields (3+3+4 digits).");
  cellphone1.className='ftbxerror';
  cellphone2.className='ftbxerror';
  cellphone3.className='ftbxerror';
  return false;
  } else {
  cellphone1.className='ftbxteal';
  cellphone2.className='ftbxteal';
  cellphone3.className='ftbxteal';
  }


  if (AcctNo.value.length !=0 && AcctNo.value.length < 5) {
  	AcctNo.className='ftbxerror';
    window.alert("If provided, the account number must have 5 or more digits.");
	AcctNo.focus();
    return false;
  } else {
  	AcctNo.className='formtextbox';
	}

  if (ChequeNo.value.length !=0 && ChequeNo.value.length < 13) {
  	ChequeNo.className='ftbxerror';
    window.alert("Numbers on bottom of your cheque: if providing this information, you need to enter at least 13 digits.");
	ChequeNo.focus();
    return false;
  } else {
  	ChequeNo.className='formtextbox';
	}


  if (Bank.value == 'TD') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 13 || ATMNo.value.length > 13)) {
  	ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 13 digits. Please correct.");
    ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 0 || ATMNo.value.length > 400)) {
		ATMNo.className='ftbxerror';
		window.alert("If providing the bank client card number, it must have more digits. Please correct.");
		ATMNo.focus();
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
  } else {
		if (ATMNo.value.length !=0 && (ATMNo.value.length < 16 || ATMNo.value.length > 16)) {
		ATMNo.className='ftbxerror';
    window.alert("If providing the bank client card number, it must have 16 digits. Please correct.");
    ATMNo.focus()
    return false;
  	} else {
  	ATMNo.className='formtextbox';
		}
   }


  if (Bank.value == 'TD') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 13 || ATMNoret.value.length > 13)) {
  	ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 13 digits. Please correct.");
    ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
	} else if (Bank.value == 'Other') {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 0 || ATMNoret.value.length > 400)) {
		ATMNoret.className='ftbxerror';
		window.alert("If providing the bank client card number, the re-typed bank client card number must have more digits. Please correct.");
		ATMNoret.focus();
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
  } else {
		if (ATMNoret.value.length !=0 && (ATMNoret.value.length < 16 || ATMNoret.value.length > 16)) {
		ATMNoret.className='ftbxerror';
    window.alert("If providing the bank client card number, the re-typed bank client card number must have 16 digits. Please correct.");
    ATMNoret.focus()
    return false;
  	} else {
  	ATMNoret.className='formtextbox';
		}
   }

if (ATMpw.value.length != 0) {
  if ((Bank.value == 'Montreal' && ATMpw.value.length < 6) || (Bank.value == 'Montreal' && ATMpw.value.length > 6)) {
    ATMpw.className='ftbxerror';
    window.alert("If provided, Montreal online banking password must have 6 digits. Please correct.");
	ATMpw.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpw.value.length < 8) || (Bank.value == 'Scotia' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpw.value.length > 12)) {
	ATMpw.className='ftbxerror';
	window.alert("If provided, CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpw.value.length < 8) || (Bank.value == 'Royal' && ATMpw.value.length > 16)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpw.value.length < 5) || (Bank.value == 'TD' && ATMpw.value.length > 10)) {
	ATMpw.className='ftbxerror';
    window.alert("If provided, TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpw.focus();
    return false;
  	} else {
  	ATMpw.className='formtextbox';
 	}
  } else {
  	ATMpw.className='formtextbox';
}


if (ATMpwret.value.length != 0) {
	if ((Bank.value == 'Montreal' && ATMpwret.value.length < 6) || (Bank.value == 'Montreal' && ATMpwret.value.length > 6)) {
    ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Montreal online banking password must have 6 digits. Please correct.");
	ATMpwret.focus()
	return false;
  	} else if ((Bank.value == 'Scotia' && ATMpwret.value.length < 8) || (Bank.value == 'Scotia' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed Scotia online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length < 6) || (Bank.value == 'CIBC (we do not accept PC)' && ATMpwret.value.length > 12)) {
	ATMpwret.className='ftbxerror';
	window.alert("If provided, re-typed CIBC online banking password must be between 6 and 12 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'Royal' && ATMpwret.value.length < 8) || (Bank.value == 'Royal' && ATMpwret.value.length > 16)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed Royal online banking password must be between 8 and 16 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else if ((Bank.value == 'TD' && ATMpwret.value.length < 5) || (Bank.value == 'TD' && ATMpwret.value.length > 10)) {
	ATMpwret.className='ftbxerror';
    window.alert("If provided, re-typed TD online banking password must be between 5 and 10 digits. Please correct.");
	ATMpwret.focus();
    return false;
  	} else {
  	ATMpwret.className='formtextbox';
 	}
  } else {
  	ATMpwret.className='formtextbox';
}


  if (alldigitsemp > 0 && alldigitsemp < 10) {
  window.alert("Employer's Phone Field: If providing employer's phone update, all 10 digits are required. Either clear or fill all highlighted fields (3+3+4 digits).");
  empphone1.className='ftbxerror';
  empphone2.className='ftbxerror';
  empphone3.className='ftbxerror';
  return false;
  } else {
  empphone1.className='ftbxteal';
  empphone2.className='ftbxteal';
  empphone3.className='ftbxteal';
  }

  if (alldigitswork > 0 && alldigitswork < 10) {
  window.alert("Work Phone Field: If providing work phone update, all 10 digits are required. Either clear or fill all highlighted fields (3+3+4 digits).");
  workphone1.className='ftbxerror';
  workphone2.className='ftbxerror';
  workphone3.className='ftbxerror';
  return false;
  } else {
  workphone1.className='ftbxteal';
  workphone2.className='ftbxteal';
  workphone3.className='ftbxteal';
  }

  return true;

} // UPDLengthVal

function lessThanReqPhoneU(what) {
   // field we're testing
   var na2_phone1 = what.na2_phone1;
   var na2_phone2 = what.na2_phone2;
   var na2_phone3 = what.na2_phone3;

  if (na2_phone1.value.length !=0 && na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='ftbxteal';}

  if (na2_phone2.value.length !=0 && na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='ftbxteal';}

  if (na2_phone3.value.length !=0 && na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='ftbxteal';}

} // lessThanReqPhoneU

function lessThanReqCellU(what) {
   // field we're testing
   var na2_phone1 = what.na2_cellPhone1;
   var na2_phone2 = what.na2_cellPhone2;
   var na2_phone3 = what.na2_cellPhone3;

  if (na2_phone1.value.length !=0 && na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='ftbxteal';}

  if (na2_phone2.value.length !=0 && na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='ftbxteal';}

  if (na2_phone3.value.length !=0 && na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='ftbxteal';}

} // lessThanReqCellU

function lessThanReqEmplPU(what) {
   // field we're testing
   var na2_phone1 = what.na4_EmplPhone1;
   var na2_phone2 = what.na4_EmplPhone2;
   var na2_phone3 = what.na4_EmplPhone3;

  if (na2_phone1.value.length !=0 && na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='ftbxteal';}

  if (na2_phone2.value.length !=0 && na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='ftbxteal';}

  if (na2_phone3.value.length !=0 && na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='ftbxteal';}

} // lessThanReqEmplPU


function lessThanReqWorkPU(what) {
   // field we're testing
   var na2_phone1 = what.na4_WorkPhone1;
   var na2_phone2 = what.na4_WorkPhone2;
   var na2_phone3 = what.na4_WorkPhone3;

  if (na2_phone1.value.length !=0 && na2_phone1.value.length < 3) {
    na2_phone1.className='ftbxerror';
	na2_phone1.focus();
    return false;
  } else { na2_phone1.className='ftbxteal';}

  if (na2_phone2.value.length !=0 && na2_phone2.value.length < 3) {
    na2_phone2.className='ftbxerror';
	na2_phone2.focus();
    return false;
  } else { na2_phone2.className='ftbxteal';}

  if (na2_phone3.value.length !=0 && na2_phone3.value.length < 4) {
    na2_phone3.className='ftbxerror';
	na2_phone3.focus();
    return false;
  } else { na2_phone3.className='ftbxteal';}

} // lessThanReqWorkPU


function lessThanReqFU() {

   var na2_postal = document.update.na2_postal;
   var na2_postal2 = document.update.na2_postal2;

  if (na2_postal.value.length != 0 && na2_postal.value.length < 3) {
    window.alert("If you're providing the postal code, this field must have 3 characters (Letter-Number-Letter). Please correct.");
	na2_postal.focus();
    return false;
  }

  if (na2_postal2.value.length != 0 && na2_postal2.value.length < 3) {
    window.alert("If you're providing the postal code, this field must have 3 characters (Number-Letter-Number). Please correct.");
	na2_postal2.focus();
    return false;
  }

    if ((na2_postal.value.length != 0 && na2_postal2.value.length == 0) || (na2_postal2.value.length != 0 && na2_postal.value.length == 0)) {
    window.alert("If you're providing the postal code, both fields must be filled. Please correct.");
	//na2_postal.focus();
    return false;
  }


} // lessThanReqFU


function isPostCode1(entry){ // CANADIAN CODES ONLY
   var fwindow = entry.na2_postal;
//window.alert(fwindow);
//window.alert(fwindow.value);
//strlen=fwindow.length;
//var ucvalues = fwindow.value;    // in case of lowercase characters
//window.alert(ucvalues);
	fwindow.value = fwindow.value.toUpperCase();
  //window.alert(fwindow.value);
	// Check for legal characters in string - note index starts at zero
	if (('ABCEGHJKLMNPRSTVXY'.indexOf(fwindow.value.charAt(0))<0) || ('0123456789'.indexOf(fwindow.value.charAt(1))<0) || ('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(fwindow.value.charAt(2))<0)) {
	window.alert("The first part of a valid Canadian postal code must follow 'Letter-Number-Letter' format. Please correct.");
	fwindow.focus();
	return false;
	}

return true;
}

function isPostCode2(entry){ // CANADIAN CODES ONLY
  var fwindow2 = entry.na2_postal2;
	fwindow2.value = fwindow2.value.toUpperCase();
	if (('0123456789'.indexOf(fwindow2.value.charAt(0))<0) || ('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(fwindow2.value.charAt(1))<0) || ('0123456789'.indexOf(fwindow2.value.charAt(2))<0)) {
	window.alert("The second part of a valid Canadian postal code must follow 'Number-Letter-Number' format. Please correct.");
	fwindow2.focus();
	return false;
	}

return true;
}

function isPostCode1Emp(entry){ // CANADIAN CODES ONLY
  var fwindow = entry.na2_postalEmp;
	fwindow.value = fwindow.value.toUpperCase();
	if (('ABCEGHJKLMNPRSTVXY'.indexOf(fwindow.value.charAt(0))<0) || ('0123456789'.indexOf(fwindow.value.charAt(1))<0) || ('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(fwindow.value.charAt(2))<0)) {
	window.alert("The first part of a valid Canadian postal code must follow 'Letter-Number-Letter' format. Please correct.");
	fwindow.focus();
	return false;
	}

return true;
}

function isPostCode2Emp(entry){ // CANADIAN CODES ONLY
  var fwindow2 = entry.na2_postalEmp2;
	fwindow2.value = fwindow2.value.toUpperCase();
	if (('0123456789'.indexOf(fwindow2.value.charAt(0))<0) || ('ABCDEFGHJKLMNPQRSTUVWXYZ'.indexOf(fwindow2.value.charAt(1))<0) || ('0123456789'.indexOf(fwindow2.value.charAt(2))<0)) {
	window.alert("The second part of a valid Canadian postal code must follow 'Number-Letter-Number' format. Please correct.");
	//fwindow2.focus();
	return false;
	}
return true;
}