
function ValidatRadioButtons(objButton) {
var radioSelected = false;
  for (i = 0;  i < objButton.length;  i++)
  {
    if (objButton[i].checked)
        radioSelected = true;
  }
  return radioSelected;
}

function RadioValue(objButton){
var retValue;
  for (i = 0;  i < objButton.length;  i++)
  {
    if (objButton[i].checked)
        retValue = objButton[i].value;
  }
	return retValue;
}

function ValidateInput() {

	if (!ValidatRadioButtons(document.Form1.existing)) {
    	alert("Please select YES if you are an existing customer or NO if you are new.");
    	document.Form1.existing[0].focus();
   	 return false;
    }
    if (!ValidatRadioButtons(document.Form1.giantAccount)) {
    	alert("Please select an account type.");
    	document.Form1.giantAccount[0].focus();
    	return false;
    }
	if (document.Form1.amtEnclosed.value == "") {
    	alert("Please enter the amount enclosed for this application ONLY.");
    	document.Form1.amtEnclosed.focus();
    	return false;
    }
	if (document.Form1.sourceOfAppDeposit.value == "") {
    	alert("Please enter the source of deposit.");
    	document.Form1.sourceOfAppDeposit.focus();
    	return false;
    }
  if ((RadioValue(document.Form1.giantAccount) == "giantInterestChecking") || (RadioValue(document.Form1.giantAccount) == "giantMoneyMarket")) {
		   if (document.Form1.avgMonDeposit.value == "") {
	    		alert("Please enter the average monthly deposit.");
	    		document.Form1.avgMonDeposit.focus();
	    		return false;
	    	}
			if (document.Form1.avgMonWith.value == "") {
	    		alert("Please enter the average monthly withdrawal.");
	    		document.Form1.avgMonWith.focus();
	    		return false;
	   		}
			if (document.Form1.sourceOfDeposit.value == "") {
	    		alert("Please indicate the source of the deposits.");
	    		document.Form1.sourceOfDeposit.focus();
	    		return false;
	   		}
		if (!ValidatRadioButtons(document.Form1.receiveWire)) {
	    	alert("Please indicate whether you anticipate sending or receiving Wire Transfers.");
	    	document.Form1.receiveWire[0].focus();
	    	return false;
	    }
	}

    if (RadioValue(document.Form1.receiveWire) == "Yes") {
	  	if (!ValidatRadioButtons(document.Form1.withinUS)) {
	    	alert("Please select if you are sending or receiving wire transfers within the US.");
	    	document.Form1.withinUS[0].focus();
	    	return false;
	    }
	  	if (!ValidatRadioButtons(document.Form1.outsideUS)) {
	    	alert("Please select if you are sending or receiving wire transfers outside the US.");
	    	document.Form1.outsideUS[0].focus();
	    	return false;
	    }
		if (document.Form1.antWireAmt.value == "") {
    		alert("Please enter the anticipated wire transfer amount.");
    		document.Form1.antWireAmt.focus();
    		return false;
    	}
		if (document.Form1.wireHowOften.value == "") {
    		alert("Please enter how often you intend to perform a wire transfer.");
    		document.Form1.wireHowOften.focus();
    		return false;
   		 }
	}//end wire transfers

	//begin cashiers
  if ((RadioValue(document.Form1.giantAccount) == "giantInterestChecking") || (RadioValue(document.Form1.giantAccount) == "giantMoneyMarket")) {
	  	if (!ValidatRadioButtons(document.Form1.purCashiersChecks)) {
	    	alert("Please select if you anticipate purchasing cashier's checks.");
	    	document.Form1.purCashiersChecks[0].focus();
	    	return false;
	    }
		 if (RadioValue(document.Form1.purCashiersChecks) == "Yes") {
			if (document.Form1.cashiersCheckAmt.value == "") {
	    		alert("Please enter the anticipated amount of the cashiers checks.");
	    		document.Form1.cashiersCheckAmt.focus();
	    		return false;
	    	}
			if (document.Form1.cashiersHowOften.value == "") {
	    		alert("Please enter how often you plan on purchasing cashiers checks.");
	    		document.Form1.cashiersHowOften.focus();
	    		return false;
	   		 }
		 }
	}//end cashiers
	
  if (document.Form1.firstname.value == 0) {
    alert("Please enter your first name.");
    document.Form1.firstname.focus();
    return false;
    }
  if (document.Form1.lastname.value == 0) {
    alert("Please enter your last name.");
    document.Form1.lastname.focus();
    return false;
    } 
	if (!ValidatRadioButtons(document.Form1.seniorPol1)) {
	    	alert("Please select if the applicant is a senior foreign political figure or an immediate\nfamily member or close associate of a senior foreign political figure.");
	    	document.Form1.seniorPol1[0].focus();
	    	return false;
	 }
  if (document.Form1.street.value == 0) {
    alert("Please enter your street address.");
    document.Form1.street.focus();
    return false;
    }
  if (document.Form1.city.value == 0) {
    alert("Please enter your city.");
    document.Form1.city.focus();
    return false;
    }
  if (document.Form1.county.value == 0) {
    alert("Please enter your county.");
    document.Form1.county.focus();
    return false;
    }
  if (document.Form1.state.selectedIndex == 0) {
    alert("Please enter your state.");
    document.Form1.state.focus();
    return false;
    }
  if (document.Form1.zip.value == 0) {
    alert("Please enter your zip.");
    document.Form1.zip.focus();
    return false;
    }
  if (document.Form1.homephone.value == 0) {
    alert("Please enter your home phone number.");
    document.Form1.homephone.focus();
    return false;
    }
  if (document.Form1.email.value == 0) {
    alert("Please enter your email address.");
    document.Form1.email.focus();
    return false;
    }
  	if (document.Form1.email.value.indexOf("@") == -1) {
		alert("Please enter email in the name@domain format.");
		document.Form1.email.focus();
		return false;
	}

	if (document.Form1.email.value.indexOf(".", document.Form1.email.value.indexOf("@")) == -1) {
		alert("Please enter email in the name@domain format.");
		document.Form1.email.focus();
		return false;
	}
  
  if (!ValidatRadioButtons(document.Form1.addresslived)) {
    alert("Please enter your current address status.");
    document.Form1.addresslived[0].focus();
    return false;
    }
   if (RadioValue(document.Form1.addresslived) == "Yes"){
		if (document.Form1.prevstreet.value == 0) {
		  alert("Please enter your previous street.");
		  document.Form1.prevstreet.focus();
		  return false;
		}
		if (document.Form1.prevcity.value == 0) {
			alert("Please enter your previous city.");
			document.Form1.prevcity.focus();
			return false;
		}
		if (document.Form1.prevcounty.value == 0) {
			alert("Please enter your previous county.");
			document.Form1.prevcounty.focus();
			return false;
		}
		if (document.Form1.prevstate.selectedIndex == 0) {
			alert("Please enter your previous state.");
			document.Form1.prevstate.focus();
			return false;
		}
		if (document.Form1.prevzip.value == 0) {
			alert("Please enter your previous zip.");
			document.Form1.prevzip.focus();
			return false;
		}
	}
  if (document.Form1.dobmm.selectedIndex == 0){
    alert ("Please enter your birth month");
    document.Form1.dobmm.focus();
    return false;
  }
  if (document.Form1.dobdd.selectedIndex == 0){
    alert ("Please enter the day of your birth");
    document.Form1.dobdd.focus();
    return false;
  }
  if (document.Form1.dobyyyy.value == 0){
    alert ("Please enter the year of your birth");
    document.Form1.dobyyyy.focus();
    return false;
  }
  
  if (document.Form1.dobyyyy.value.length != 4)
  {
    alert("Please enter 4 digit year.");
    document.Form1.dobyyyy.focus();
    return false;
  }


  var numcheck = "0123456789";
  var loccheck = Form1.dobyyyy.value;
  var numValid = true;
  for (i = 0;  i < loccheck.length;  i++)
  {
    ch = loccheck.charAt(i);
    for (j = 0;  j < numcheck.length;  j++)
      if (ch == numcheck.charAt(j))
        break;
    if (j == numcheck.length)
    {
      numValid = false;
      break;
    }
  }
  if (!numValid)
  {
    alert("Please enter only numbers for the year.");
     document.Form1.dobyyyy.focus();
    return false;
  }
   if (document.Form1.socialsecuritynumber.value == 0){
    alert ("Please enter social security number");
    document.Form1.socialsecuritynumber.focus();
    return false;
  }
  
   if (document.Form1.socialsecuritynumber.value.length != 11)
  {
    alert("Please enter social security number in XXX-XX-XXXX format.");
    document.Form1.socialsecuritynumber.focus();
    return false;
  }


  var numcheck = "0123456789-";
  var loccheck = Form1.socialsecuritynumber.value;
  var numValid = true;
  for (i = 0;  i < loccheck.length;  i++)
  {
    ch = loccheck.charAt(i);
    for (j = 0;  j < numcheck.length;  j++)
      if (ch == numcheck.charAt(j))
        break;
    if (j == numcheck.length)
    {
      numValid = false;
      break;
    }
  }
  if (!numValid)
  {
    alert("Please enter only numbers and dashs for social security number.");
    document.Form1.socialsecuritynumber.focus();
    return false;
  }
   if (document.Form1.mothersname.value == 0){
    alert ("Please enter mother's maiden name.");
    document.Form1.mothersname.focus();
    return false;
  }
   if (document.Form1.maritalstatus.value == 0){
    alert ("Please select your marital status.");
    document.Form1.maritalstatus.focus();
    return false;
  }
   if (document.Form1.dependents.value.length == 0){
    alert ("Please enter number of dependents.");
    document.Form1.dependents.focus();
    return false;
  }
  var numcheck = "0123456789";
  var loccheck = Form1.dependents.value;
  var numValid = true;
  for (i = 0;  i < loccheck.length;  i++)
  {
    ch = loccheck.charAt(i);
    for (j = 0;  j < numcheck.length;  j++)
      if (ch == numcheck.charAt(j))
        break;
    if (j == numcheck.length)
    {
      numValid = false;
      break;
    }
  }
  if (!numValid)
  {
    alert("Please enter only numbers for the number of dependents.");
    document.Form1.dependents.focus();
    return false;
  }
 
   	   if (document.Form1.otherstreet.value != "") {
		    if (document.Form1.othercity.value == 0) {
		      alert("Please enter your mailing city.");
		      document.Form1.othercity.focus();
		      return false;
		     }
		    if (document.Form1.othercounty.value == 0) {
		      alert("Please enter your mailing county.");
		      document.Form1.othercounty.focus();
		      return false;
		     }
		    if (document.Form1.otherstate.value == 0) {
		      alert("Please enter your mailing state.");
		      document.Form1.otherstate.focus();
		      return false;
		     }
		    if (document.Form1.otherzip.value == 0) {
		      alert("Please enter your mailing zip.");
		      document.Form1.otherzip.focus();
		      return false;
		     }
		}
  

  
   if (document.Form1.applicantdriverid.value == "") {
    alert ("Please provide the driver's license or passport number.");
    document.Form1.applicantdriverid.focus();
    return false;
  }
  
   if (document.Form1.applicantdriveridSt.value == "") {
     alert ("Please provide the driver's license or passport state or country of issue.");
    document.Form1.applicantdriveridSt.focus();
    return false;
  }
  
   if (document.Form1.dlExpMonth1.selectedIndex == 0) {
    alert ("Please select the DL /passport expiration month.");
    document.Form1.dlExpMonth1.focus();
    return false;
  }
  
   if (document.Form1.dlExpDay1.selectedIndex == 0) {
    alert ("Please select the DL /passport expiration day.");
    document.Form1.dlExpDay1.focus();
    return false;
  }
   if (document.Form1.dlExpYear1.value == "") {
    alert ("Please provide the DL /passport expiration year.");
    document.Form1.dlExpYear1.focus();
    return false;
  }
  
  
	if (!ValidatRadioButtons(document.Form1.employstat)) {
			alert("Please indicate your employment status.");
			document.Form1.employstat[0].focus();
			return false;
		}
  if (RadioValue(document.Form1.employstat) == "Employed"){
    if (document.Form1.employername.value == "") {
  		alert("Please indicate your employer's name.");
  		document.Form1.employername.focus();
  		return false;
	  	}
    if (document.Form1.employeraddress.value == "") {
      alert("Please enter your employer's street address.");
      document.Form1.employeraddress.focus();
      return false;
      }
    if (document.Form1.employercity.value == "") {
      alert("Please enter your employer's city.");
      document.Form1.employercity.focus();
      return false;
      }
    if (document.Form1.employercounty.value == "") {
      alert("Please enter your employer's county.");
      document.Form1.employercounty.focus();
      return false;
      }
    if (document.Form1.employerstate.selectedIndex == 0) {
      alert("Please enter your employer's state.");
      document.Form1.employerstate.focus();
      return false;
      }
    if (document.Form1.employerzip.value == "") {
      alert("Please enter your employer's zip.");
      document.Form1.employerzip.focus();
      return false;
      }
    if (document.Form1.employerphone.value == "") {
      alert("Please enter your employer's phone number.");
      document.Form1.employerphone.focus();
      return false;
      }
      
     if (document.Form1.employercurrentjobyears.value.length == ""){
      	alert ("Please enter years / months at your current job.");
      	document.Form1.employercurrentjobyears.focus();
     	 return false;
    	}
    if (document.Form1.employeroccupation.value == "") {
      alert("Please enter your occupation.");
      document.Form1.employeroccupation.focus();
      return false;
      }
    } 
	
	if (!ValidatRadioButtons(document.Form1.curanninc)) {
    alert("Please select your annual income range.");
    document.Form1.curanninc[0].focus();
    return false;
    }

  if (!ValidatRadioButtons(document.Form1.addcoapp)) {
    alert("Please indicate if you would like a coapplicant.");
    document.Form1.addcoapp[0].focus();
    return false;
    }
    
    //Starting the Co applicant
  if (RadioValue(document.Form1.addcoapp) == "Yes"){//begin co-app
    if (document.Form1.cofirstname.value == 0) {
     	alert("Please enter your co-applicant first name.");
     	document.Form1.cofirstname.focus();
     	 return false;
    }
    if (document.Form1.colastname.value == 0) {
	      alert("Please enter your co-applicant last name.");
	      document.Form1.colastname.focus();
	      return false;
	      }
	 if (!ValidatRadioButtons(document.Form1.seniorPol2)) {
	    	alert("Please select if the co-applicant is a senior foreign political figure or an immediate\nfamily member or close associate of a senior foreign political figure.");
	    	document.Form1.seniorPol2[0].focus();
	    	return false;
	 }
	 if (document.Form1.costreet.value != "") {
	     	//alert("Please enter your co-applicant street address.");
	     	//document.Form1.costreet.focus();
	    	 //return false;
	   	 //}
	  	if (document.Form1.cocity.value == "") {
	    	alert("Please enter your co-applicant city.");
	    	document.Form1.cocity.focus();
	    	return false;
	    }
	  	if (document.Form1.cocounty.value == "") {
	    	alert("Please enter your co-applicant county.");
	    	document.Form1.cocounty.focus();
	    	return false;
	    }
	  	if (document.Form1.costate.selectedIndex == 0) {
	   		alert("Please enter your co-applicant state.");
	   	 	document.Form1.costate.focus();
	    	return false;
	    }
	  	if (document.Form1.cozip.value == "") {
	    	alert("Please enter your co-applicant zip.");
	    	document.Form1.cozip.focus();
	    	return false;
	    }

	}
	 if (document.Form1.cohomephone.value == "") {
	    	alert("Please enter your co-applicant home phone number.");
	    	document.Form1.cohomephone.focus();
	    	return false;
	    }
		
    if (document.Form1.coemail.value == "") {
    	alert("Please enter your co-applicant email address.");
    	document.Form1.coemail.focus();
    	return false;
    }
    if (document.Form1.coemail.value != 0) {
      if (document.Form1.coemail.value.indexOf("@") == -1) {
		    alert("Please enter co-applicant email in the name@domain format.");
		    document.Form1.coemail.focus();
        	return false;
	    }

	    if (document.Form1.coemail.value.indexOf(".", document.Form1.coemail.value.indexOf("@")) == -1) {
		    alert("Please enter co-applicant email in the name@domain format.");
		    document.Form1.coemail.focus();
		    return false;
	      }
	   }//end coapp email
 	 if (document.Form1.codobmm.selectedIndex == 0){
    	alert ("Please enter co-applicant birth month.");
    	document.Form1.codobmm.focus();
    	return false;
  	}
  	if (document.Form1.codobdd.selectedIndex == 0){
    	alert ("Please enter co-applicant birth month.");
    	document.Form1.codobdd.focus();
    	return false;
  	}
    if (document.Form1.codobyyyy.value == 0){
      	alert ("Please enter co-applicant birth year.");
      	document.Form1.codobyyyy.focus();
      	return false;
    }
    if (document.Form1.codobyyyy.value.length != 4)
    {
      alert("Please enter 4 digit year.");
      document.Form1.codobyyyy.focus();
      return false;
    }
    var numcheck = "0123456789";
    var loccheck = Form1.codobyyyy.value;
    var numValid = true;
    for (i = 0;  i < loccheck.length;  i++)
    {
      ch = loccheck.charAt(i);
      for (j = 0;  j < numcheck.length;  j++)
        if (ch == numcheck.charAt(j))
          break;
      if (j == numcheck.length)
      {
        numValid = false;
        break;
      }
    }
    if (!numValid){
      alert("Please enter only numbers for the year.");
      document.Form1.codobyyyy.focus();
      return false;
    }
     if (document.Form1.cosocialsecuritynumber.value.length != 11){
      alert("Please enter co-applicant social security number in XXX-XX-XXXX format.");
      document.Form1.cosocialsecuritynumber.focus();
      return false;
    }
    var numcheck = "0123456789-";
    var loccheck = Form1.cosocialsecuritynumber.value;
    var numValid = true;
    for (i = 0;  i < loccheck.length;  i++)
    {
      ch = loccheck.charAt(i);
      for (j = 0;  j < numcheck.length;  j++)
        if (ch == numcheck.charAt(j))
          break;
      if (j == numcheck.length)
      {
        numValid = false;
        break;
      }
    }
    if (!numValid) {
      	alert("Please enter only numbers and dashs for social security number.");
      	document.Form1.cosocialsecuritynumber.focus();
     	 return false;
     }
     if (document.Form1.comothersname.value == 0){
      	alert ("Please enter co-applicant mother's maiden name.");
      	document.Form1.comothersname.focus();
      	return false;
     }
     if (document.Form1.comaritalstatus.value == 0){
      	 alert ("Please select co-applicant marital status.");
      	 document.Form1.comaritalstatus.focus();
     	 return false;
      }
	  if (document.Form1.codependents.value.length == 0){
	    alert ("Please enter co-applicant number of dependents.");
      	document.Form1.codependents.focus();
      	return false;
   	   }
	    var numcheck = "0123456789";
	    var loccheck = Form1.codependents.value;
	    var numValid = true;
	    for (i = 0;  i < loccheck.length;  i++)
	    {
	      ch = loccheck.charAt(i);
	      for (j = 0;  j < numcheck.length;  j++)
	        if (ch == numcheck.charAt(j))
	          break;
	      if (j == numcheck.length)
	      {
	        numValid = false;
	        break;
	      }
	    }
	    if (!numValid){
        	alert("Please enter only numbers for the number of dependents.");
      		document.Form1.codependents.focus();
      		return false;
    	}
	   	  if (document.Form1.cootherstreet.value != "") {
		    if (document.Form1.coothercity.value == "") {
			      alert("Please enter your co-applicant mailing city.");
			      document.Form1.coothercity.focus();
			      return false;
		     }
		    if (document.Form1.coothercounty.value == "") {
		      alert("Please enter your co-applicant mailing county.");
		      document.Form1.coothercounty.focus();
		      return false;
		     }
		    if (document.Form1.cootherstate.value == "") {
		      alert("Please enter your co-applicant mailing state.");
		      document.Form1.cootherstate.focus();
		      return false;
		     }
		    if (document.Form1.cootherzip.value == "") {
		      alert("Please enter your co-applicant mailing zip.");
		      document.Form1.cootherzip.focus();
		      return false;
		     }
		  }//end other street coapp
		
		   if (document.Form1.coapplicantdriverid.value == ""){
		    alert ("Please provide the co-applicant's driver's license or passport number.");
		    document.Form1.coapplicantdriverid.focus();
		    return false;
		  }
		   if (document.Form1.coapplicantdriveridSt.value == "") {
		     alert ("Please provide the co-applicant's driver's license or passport state or country of issue.");
		    document.Form1.coapplicantdriveridSt.focus();
		    return false;
		  }
		   if (document.Form1.dlExpMonth2.selectedIndex == 0) {
		    alert ("Please select the co-applicant's DL/passport expiration month.");
		    document.Form1.dlExpMonth2.focus();
		    return false;
		  }
		   if (document.Form1.dlExpDay2.selectedIndex == 0) {
		    	alert ("Please select the co-applicant's DL/passport expiration day.");
		    	document.Form1.dlExpDay2.focus();
		    	return false;
		    }
		   if (document.Form1.dlExpYear2.value == "") {
		    alert ("Please provide the co-applicant's DL/passport expiration year.");
		    document.Form1.dlExpYear2.focus();
		    return false;
		  }
		  if (!ValidatRadioButtons(document.Form1.coemploystat)) {
			alert("Please indicate co-applicant employment status.");
			document.Form1.coemploystat[0].focus();
			return false;
		   } 
		  if (RadioValue(document.Form1.coemploystat) == "Employed"){//begin co-app employed
		    	if (document.Form1.coemployername.value == 0) {
					alert("Please indicate co-applicant employer's name.");
					document.Form1.coemployername.focus();
					return false;
					}
				if (document.Form1.coemployeraddress.value == "") {
				  alert("Please enter co-applicant employer's street address.");
				  document.Form1.coemployeraddress.focus();
				  return false;
				  }
				if (document.Form1.coemployercity.value == "") {
				  alert("Please enter co-applicant employer's city.");
				  document.Form1.coemployercity.focus();
				  return false;
				  }
				if (document.Form1.coemployercounty.value == "") {
				  alert("Please enter co-applicant employer's county.");
				  document.Form1.coemployercounty.focus();
				  return false;
				  }
				if (document.Form1.coemployerstate.selectedIndex == 0) {
				  alert("Please enter co-applicant employer's state.");
				  document.Form1.coemployerstate.focus();
				  return false;
				  }
				if (document.Form1.coemployerzip.value == "") {
				  alert("Please enter co-applicant employer's zip.");
				  document.Form1.coemployerzip.focus();
				  return false;
				  }
					
				if (document.Form1.coemployerphone.value == "") {
				  alert("Please enter co-applicant employer's phone number.");
				  document.Form1.coemployerphone.focus();
				  return false;
				  }
				 if (document.Form1.coemployercurrentjobyears.value.length == 0){
				  alert ("Please enter years / months co-applicant at current job.");
				  document.Form1.coemployercurrentjobyears.focus();
				  return false;
				  }
				 if (document.Form1.coemployeroccupation.value.length == 0){
				  alert ("Please enter co-applicant occupation.");
				  document.Form1.coemployeroccupation.focus();
				  return false;
				  }

			}//end co-app employed
							if (!ValidatRadioButtons(document.Form1.cocuranninc)) {
				 alert("Please select co-applicant's annual income range.");
				 document.Form1.cocuranninc[0].focus();
				 return false;
				 }
			}// end coapp

  if ((RadioValue(document.Form1.giantAccount) == "giantInterestChecking") || (RadioValue(document.Form1.giantAccount) == "giantMoneyMarket")) {
	  	if (!ValidatRadioButtons(document.Form1.atm)) {
	    alert("Please indicate if you would like an ATM card.");
	    document.Form1.atm[0].focus();
	    return false;
	    }
	}
	
	if (RadioValue(document.Form1.atm) == "Yes"){
	    	if (!ValidatRadioButtons(document.Form1.additionalatm)) {
	    	alert("Please indicate if you would like an additional ATM card.");
	    	document.Form1.additionalatm[0].focus();
	    	return false;
	    }
	}
					
if (RadioValue(document.Form1.giantAccount) == "giantInterestChecking") {
  	if (!ValidatRadioButtons(document.Form1.checkcardapply)) {
    	alert("Please indicate if you would like a check card.");
    	document.Form1.checkcardapply[0].focus();
    	return false;
    }
}
		 // if (RadioValue(document.Form1.checkcardapply) == "Yes") {
		    ///if (document.Form1.chkcardpinnumber.value.length == 0) {
					//alert("Please indicate your pin number for your check card.");
					//document.Form1.chkcardpinnumber.focus();
					//return false;
				// }
			//if (document.Form1.chkcardpinnumber.value.length != 4){
		     // alert("Please enter 4 digit PIN number.");
		    //  document.Form1.chkcardpinnumber.focus();
		    //  return false;
		    //}
		
		
		    //var numcheck = "0123456789";
		    //var loccheck = Form1.chkcardpinnumber.value;
		    //var numValid = true;
		    //for (i = 0;  i < loccheck.length;  i++)
		    //{
		      //ch = loccheck.charAt(i);
		      //for (j = 0;  j < numcheck.length;  j++)
		       // if (ch == numcheck.charAt(j))
		        //  break;
		      //if (j == numcheck.length)
		      //{
		       // numValid = false;
		      //  break;
		      //}
		    //}
		    //if (!numValid)
		   // {
		    //  alert("Please enter only numbers.");
		     // document.Form1.chkcardpinnumber.focus();
		     // return false;
		   // }
			//	 
		  // }
		  
if ((RadioValue(document.Form1.giantAccount) == "giantInterestChecking") || (RadioValue(document.Form1.giantAccount) == "giantMoneyMarket")) {
  if (!ValidatRadioButtons(document.Form1.overdraftapply)) {
    alert("Please indicate if you would like overdraft protection.");
    document.Form1.overdraftapply[0].focus();
    return false;
    }
}

if (RadioValue(document.Form1.giantAccount) == "giantInterestChecking") {
  if (!ValidatRadioButtons(document.Form1.onlinebillpayapply)) {
    alert("Please indicate if you would like online bill payment.");
    document.Form1.onlinebillpayapply[0].focus();
    return false;
  }
}

  if ((RadioValue(document.Form1.giantAccount) == "giantInterestChecking") || (RadioValue(document.Form1.giantAccount) == "giantMoneyMarket")) {
	if ((!document.Form1.checkordernameapplicant.checked) &&  (!document.Form1.cocheckordernameco.checked)){
	 	 alert("Please select which name you would like to appear on your checks.");
	  	document.Form1.checkordernameapplicant.focus();
	 	 return false;
	  }
	if (!ValidatRadioButtons(document.Form1.addcoapp)){
	   if (document.Form1.cocheckordernameco.checked){
	    	alert("You have selected co-applicant to appear on checks but have not indicated that there is a co-applicant");
	    	document.Form1.checkordernameapplicant.focus();
	   	 return false;
	    }
	  }
	
	if (!ValidatRadioButtons(document.Form1.checkorderaddress)){
	  alert("Please select which address you would like to appear on your checks.");
	  document.Form1.checkorderaddress[0].focus();
	  return false;
	  }
	if (RadioValue(document.Form1.checkorderaddress) == "Mailing"){
	    if (document.Form1.otherstreet.value == "") {
	      alert("Please enter your mailing street address.");
	      document.Form1.otherstreet.focus();
	      return false;
	      }
	    if (document.Form1.othercity.value == "") {
	      alert("Please enter your mailing city.");
	      document.Form1.othercity.focus();
	      return false;
	      }
	    if (document.Form1.othercounty.value == "") {
	      alert("Please enter your mailing county.");
	      document.Form1.othercounty.focus();
	      return false;
	      }
	    if (document.Form1.otherstate.value == "") {
	      alert("Please enter your mailing state.");
	      document.Form1.otherstate.focus();
	      return false;
	      }
	    if (document.Form1.otherzip.value == "") {
	      alert("Please enter your mailing zip.");
	      document.Form1.otherzip.focus();
	      return false;
	      }
     }
     
  if (!ValidatRadioButtons(document.Form1.phonenumber)){
    alert("Please indicate if you would like your phone number to appear on your checks.");
    document.Form1.phonenumber[0].focus();
    return false;
    }
  if (!ValidatRadioButtons(document.Form1.license)){
    alert("Please indicate if you would like your driver license number to appear on your checks.");
    document.Form1.license[0].focus();
    return false;
    }
  if (!ValidatRadioButtons(document.Form1.dateopend)){
    alert("Please indicate if you would like date account opened to appear on your checks.");
    document.Form1.dateopend[0].focus();
    return false;
    }
  } //end check order
  
  if (!ValidatRadioButtons(document.Form1.signaturecard)){
    alert("Please select an account title");
    document.Form1.signaturecard[0].focus();
    return false;
    }
	
  if (RadioValue(document.Form1.signaturecard) == "Trust"){
    if (document.Form1.signaturetrustname.value == ""){
      alert("Please enter a trust name.");
      document.Form1.signaturetrustname.focus();
      return false;
     } 
    }
  if (RadioValue(document.Form1.signaturecard) == "Separate Agreement"){
    if (document.Form1.signaturecardseparatename.value == ""){
      alert("Please enter a seperate agreement name.");
      document.Form1.signaturecardseparatename.focus();
      return false;
     } 
    }
  if (RadioValue(document.Form1.signaturecard) == "Power of Attorney"){
    if (document.Form1.powerofattorneyname.value == ""){
      alert("Please enter a power of attorney name.");
      document.Form1.powerofattorneyname.focus();
      return false;
     } 
    }
  if (RadioValue(document.Form1.signaturecard) == "Custodial Account"){//start custodial
	    if (document.Form1.custodialaccountname.value == ""){
	      alert("Please enter a custodial account name.");
	      document.Form1.custodialaccountname.focus();
	      return false;
	     } 
		    if (document.Form1.minorname.value == 0){
		      alert("Please enter a minor account name.");
		      document.Form1.minorname.focus();
		      return false;
		     } 
		     if (document.Form1.mindobmm.selectedIndex == 0){
		       alert ("Please enter minor birth month");
		      document.Form1.mindobmm.focus();
		      return false;
		      }
		      if (document.Form1.mindobdd.selectedIndex == 0){
		        alert ("Please enter the day of minor birth");
		        document.Form1.mindobdd.focus();
		        return false;
		      }
		      if (document.Form1.mindobyyyy.value == 0){
		        alert ("Please enter the year of minor birth");
		        document.Form1.mindobyyyy.focus();
		        return false;
		      }
	      if (document.Form1.mindobyyyy.value.length != 4) {
	        alert("Please enter 4 digit year.");
	        document.Form1.mindobyyyy.focus();
	        return false;
	      }
	      var numcheck = "0123456789";
	      var loccheck = Form1.mindobyyyy.value;
	      var numValid = true;
	      for (i = 0;  i < loccheck.length;  i++)
	      {
	        ch = loccheck.charAt(i);
	        for (j = 0;  j < numcheck.length;  j++)
	          if (ch == numcheck.charAt(j))
	            break;
	        if (j == numcheck.length)
	        {
	          numValid = false;
	          break;
	        }
	      }
	      if (!numValid){
	        alert("Please enter only numbers for the year.");
	        document.Form1.mindobyyyy.focus();
	        return false;
	      }
		  if (document.Form1.minornameSSN.value == ""){
	        alert ("Please enter the Minor's SSN.");
	        document.Form1.minornameSSN.focus();
	        return false;
	      }
	    }//end custodial
		
  if ((RadioValue(document.Form1.signaturecard) == "Pay On Death (P.O.D.)")||(RadioValue(document.Form1.signaturecard) == "In Trust For")||(RadioValue(document.Form1.signaturecard) == "Joint-With Right of Survivorship")) {
	  if (document.Form1.primarybeneficiary.value == "") {
	    alert("Please enter primary beneficiary name.");
	    document.Form1.primarybeneficiary.focus();
	    return false;
	    }
	  if (document.Form1.primarybeneficiaryrelation.value == "") {
	    alert("Please enter primary beneficiary relationship.");
	    document.Form1.primarybeneficiaryrelation.focus();
	    return false;
	    }
	   if (document.Form1.primaryssno.value == ""){
	    alert ("Please enter primary beneficiary's SSN.");
	    document.Form1.primaryssno.focus();
	    return false;
	  }
	   if (document.Form1.primaryssno.value.length != 11){
	    alert("Please enter social security number in XXX-XX-XXXX format.");
	    document.Form1.primaryssno.focus();
	    return false;
	  }
	  var numcheck = "0123456789-";
	  var loccheck = Form1.primaryssno.value;
	  var numValid = true;
	  for (i = 0;  i < loccheck.length;  i++)
	  {
	    ch = loccheck.charAt(i);
	    for (j = 0;  j < numcheck.length;  j++)
	      if (ch == numcheck.charAt(j))
	        break;
	    if (j == numcheck.length)
	    {
	      numValid = false;
	      break;
	    }
	  }
	  if (!numValid) {
	    alert("Please enter only numbers and dashs for SSN.");
	    document.Form1.primaryssno.focus();
	    return false;
		}
	}
	
	  if (document.Form1.secondarybeneficiary.value != "") {
		  if (document.Form1.secondarybeneficiaryrelation.value == "") {
		    alert("Please enter secondary beneficiary relationship.");
		    document.Form1.secondarybeneficiaryrelation.focus();
		    return false;
		    }
		   if (document.Form1.secssno.value == ""){
		    alert ("Please enter secondary beneficiary's social security number");
		    document.Form1.secssno.focus();
		    return false;
		  }
		   if (document.Form1.secssno.value.length != 11){
		    alert("Please enter social security number in XXX-XX-XXXX format.");
		    document.Form1.secssno.focus();
		    return false;
		  }
	  }


	  var numcheck1 = "0123456789-";
	  var loccheck1 = Form1.secssno.value;
	  var numValid1 = true;
	  for (i = 0;  i < loccheck1.length;  i++)
	  {
	    ch = loccheck1.charAt(i);
	    for (j = 0;  j < numcheck1.length;  j++)
	      if (ch == numcheck1.charAt(j))
	        break;
	    if (j == numcheck1.length)
	    {
	      numValid1 = false;
	      break;
	    }
	  }
	  if (!numValid1){
	    alert("Please enter only numbers and dashs for social security number.");
	    document.Form1.secssno.focus();
	    return false;
	}

  		//return (true);
	if (ValidateInput) {
		document.Form1.Option.value = "Next";
		document.Form1.submit();
	}
	else {
		return false;
	}
	
}

function gotoNext() {
	if (ValidateInput() == true) {
		document.Form1.Option.value = "Next";
		//document.Form1.submit();
	}
}

//------------------------------------------------------------------------------------------------------------------------
// menu functions
function toggleMenu(varMenu, varShow) {
	closeSubMenu();
	closeMenu();
	if (varShow) {toggleDisplay(String(varMenu), true);} else {toggleDisplay(String(varMenu), false);}
}

function closeMenu() {for (i=0; i<eval(MenuList.length);i++) {toggleDisplay(String(MenuList[i]), false);}}
function closeSubMenu() {for (i=0; i<eval(SubMenuList.length);i++) {toggleDisplay(String(SubMenuList[i]), false);}}
function closeAllMenu() {closeSubMenu();closeMenu();}

//------------------------------------------------------------------------------------------------------------------------
// shows or hides a designated DOM object
function toggleDisplay(varObj, varShow) {
	objDom = $(String(varObj));
	if (varShow) {objDom.style.display = "block";} else {objDom.style.display = "none";}
}

//------------------------------------------------------------------------------------------------------------------------
// grab rates via ajax call (replace rates.htm with dynamic file to get actual rates)
function getRates() {
	var url = "/resources/fragments/rates.htm?="+Math.random()*1000000;
	var ajax = new Ajax.Updater('ratesContainer', url, {method:'get'});
}

//------------------------------------------------------------------------------------------------------------------------
// determines if a string passed to the function is a number
function isInteger(s) {
	var i;
    for (i = 0; i < s.length; i++){
		var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}

//------------------------------------------------------------------------------------------------------------------------
// launches a new window with the desired properties
function newWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=no,status=no,scrollbars='+scroll+',resizable=yes'
	win = window.open(mypage, myname, winprops)
	win.window.focus();
}

//------------------------------------------------------------------------------------------------------------------------
// correctly handle PNG transparency in Win IE 5.5 & 6.
function correctPNG() {
   var arVersion = navigator.appVersion.split("MSIE");
   var version = parseFloat(arVersion[1]);
   
   if ((version >= 5.5) && (document.body.filters)) {
      for(var i=0;i<document.images.length;i++) {
         var img = document.images[i];
         var imgName = img.src.toUpperCase();
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" ;
            img.outerHTML = strNewHTML;
            i = i-1;
         }
      }
   }    
}

function floor(number)
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}

function dosum()
{
  var mi = document.forms["temps"].IR.value / 1200;
  var base = 1;
  var mbase = 1 + mi;
  for (i=0; i<document.temps.YR.value * 12; i++)
  {
    base = base * mbase
  }
  document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
  document.temps.MT.value = floor(document.temps.AT.value / 12)
  document.temps.MI.value = floor(document.temps.AI.value / 12)
  var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) +
        document.temps.AT.value / 12 + 
        document.temps.AI.value / 12;
  document.temps.MP.value = floor(dasum);
}


function checkNumber(input, min, max, msg) {
msg = msg + " field has invalid data: " + input.value;
var str = input.value;
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1)
if ((ch < "0" || "9" < ch) && ch != '.') {
alert(msg);
return false;
      }
   }
var num = parseFloat(str)
if (num < min || max < num) {
alert(msg + " not in range [" + min + ".." + max + "]");
return false;
   }
input.value = str;
return true;
}
function computeField(input) {
if (input.value != null && input.value.length != 0)
input.value = "" + eval(input.value);
computeForm(input.form);
}
function computeForm(form) {
if ((form.payments.value == null || form.payments.value.length == 0) ||
(form.interest.value == null || form.interest.value.length == 0) ||
(form.principal.value == null || form.principal.value.length == 0)) {
return;
}
if (!checkNumber(form.payments, 1, 480, "# of payments") ||
!checkNumber(form.interest, .001, 99, "Interest") ||
!checkNumber(form.principal, 100, 10000000, "Principal")) {
form.payment.value = "Invalid";
return;
}
var i = form.interest.value;
if (i > 1.0) {
i = i / 100.0;
form.interest.value = i;
}
i /= 12;
var pow = 1;
for (var j = 0; j < form.payments.value; j++)
pow = pow * (1 + i);
money = "" + .01* Math.round(100*(form.principal.value * pow * i) / (pow - 1));
dec = money.indexOf(".");
dollars = money.substring(0,dec); 
cents = money.substring(dec+1,dec+3);
cents = (cents.length < 2) ? cents + "0" : cents;
money = dollars + "." + cents;
form.payment.value = money;
}
function clearForm(form) {
form.payments.value = "";
form.interest.value = "";
form.principal.value = "";
}


function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function round(num) {
amount = Math.round(num*Math.pow(10,2))/Math.pow(10,2);
amount -= 0;
// .99 cent format courtsey of Martin Webb
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function dectable() {
windowprops = 'personalbar=no,toolbar=no,' +
'status=no,scrollbars=yes,location=no,' +
'resizable=yes,menubar=no,width=340,height=400';
decimalWin=window.open('', 'table', windowprops);

text = "<html><body><table width=300 cellpadding=0 cellspacing=1>";
text += "<tr><td bgcolor='#333366' align=center><font face='arial";
text += ",helvetica' size=2 color='#ffffff'><b>Fractional Price</";
text += "b></font></td><td bgcolor='#333366' align=center><font f";
text += "ace='arial,helvetica' size=2 color='#ffffff'><b>Dollar E";
text += "quivalent</b></font></td></tr><tr align=center><td align";
text += "=center><font face='arial,helvetica' size=2>1/32<br>1/16";
text += "<br>3/32<br>1/8<br>5/32<br>3/16<br>7/32<br>1/4<br>9/32<b";
text += "r>5/16<br>11/32<br>3/8<br>13/32<br>7/16<br>15/32<br>1/2<";
text += "br>17/32<br>9/16<br>19/32<br>5/8<br>21/32<br>11/16<br>23";
text += "/32<br>3/4<br>25/32<br>13/16<br>27/32<br>7/8<br>29/32<br";
text += ">15/16<br>31/32<br>1</td><td align=center><font face='ar";
text += "ial,helvetica' size=2>$0.03125<br>$0.06250<br>$0.09375<b";
text += "r>$0.12500<br>$0.15625<br>$0.18750<br>$0.21875<br>$0.250";
text += "00<br>$0.28125<br>$0.31250<br>$0.34375<br>$0.37500<br>$0";
text += ".40625<br>$0.43750<br>$0.46875<br>$0.50000<br>$0.53125<b";
text += "r>$0.56250<br>$0.59375<br>$0.62500<br>$0.65625<br>$0.687";
text += "50<br>$0.71875<br>$0.75000<br>$0.78125<br>$0.81250<br>$0";
text += ".84375<br>$0.87500<br>$0.90625<br>$0.93750<br>$0.96875<b";
text += "r>$1.00000</td></tr></table></body></html>";

decimalWin.document.open();
decimalWin.document.writeln(text);
decimalWin.document.close();
}

function stocks(form) {
shares = form.shares.value * 1;

buyprice = form.buyprice.value * 1;
buycomm = form.buycomm.value * 1;

sellprice = form.sellprice.value * 1;
sellcomm = form.sellcomm.value * 1;

bought = round(parseFloat(shares * buyprice) + buycomm); // price for purchase
sold = round(parseFloat(shares * sellprice) - sellcomm); // price sold for
result = round(sold - bought);

form.buycost.value  = "$ " + bought;
form.sellcost.value = "$ " + sold;
form.result.value = "$ " + result;
}

function dosum()
{
  var mi = document.temps.IR.value / 1200;
  var base = 1;
  var mbase = 1 + mi;
  for (i=0; i<document.temps.YR.value * 12; i++)
  {
    base = base * mbase
  }
  document.temps.PI.value = floor(document.temps.LA.value * mi / ( 1 - (1/base)))
  document.temps.MT.value = floor(document.temps.AT.value / 12)
  document.temps.MI.value = floor(document.temps.AI.value / 12)
  var dasum = document.temps.LA.value * mi / ( 1 - (1/base)) +
        document.temps.AT.value / 12 + 
        document.temps.AI.value / 12;
  document.temps.MP.value = floor(dasum);
}


function checkNumber(input, min, max, msg) {
msg = msg + " field has invalid data: " + input.value;
var str = input.value;
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1)
if ((ch < "0" || "9" < ch) && ch != '.') {
alert(msg);
return false;
      }
   }
var num = parseFloat(str)
if (num < min || max < num) {
alert(msg + " not in range [" + min + ".." + max + "]");
return false;
   }
input.value = str;
return true;
}
function computeField(input) {
if (input.value != null && input.value.length != 0)
input.value = "" + eval(input.value);
computeForm(input.form);
}
function computeForm(form) {
if ((form.payments.value == null || form.payments.value.length == 0) ||
(form.interest.value == null || form.interest.value.length == 0) ||
(form.principal.value == null || form.principal.value.length == 0)) {
return;
}
if (!checkNumber(form.payments, 1, 480, "# of payments") ||
!checkNumber(form.interest, .001, 99, "Interest") ||
!checkNumber(form.principal, 100, 10000000, "Principal")) {
form.payment.value = "Invalid";
return;
}
var i = form.interest.value;
if (i > 1.0) {
i = i / 100.0;
form.interest.value = i;
}
i /= 12;
var pow = 1;
for (var j = 0; j < form.payments.value; j++)
pow = pow * (1 + i);
money = "" + .01* Math.round(100*(form.principal.value * pow * i) / (pow - 1));
dec = money.indexOf(".");
dollars = money.substring(0,dec); 
cents = money.substring(dec+1,dec+3);
cents = (cents.length < 2) ? cents + "0" : cents;
money = dollars + "." + cents;
form.payment.value = money;
}
function clearForm(form) {
form.payments.value = "";
form.interest.value = "";
form.principal.value = "";
}

<!-- Begin
var i = 0; // interest
var m = 0; // months
var f = 0; // factor
var den = 0; 
var s = "0"; // string
var d = 0; // decimal place
function CalcA() {
if(document.calform.interest.value=="" || document.calform.months.value=="" || document.calform.payment.value=="") {
alert("Please fill in all of the required fields.");
}
else { 
if(document.calform.period.options[1].selected == true) {
m = document.calform.months.value * 12;
}
else {
m = document.calform.months.value;
} 
i = Math.pow(((document.calform.interest.value/100)+1),.0833333)-1;
den = i / (i+1);
f = Math.pow((i+1),m)-1;
f /= den;
f *= document.calform.payment.value;
d = String(f).indexOf(".");
s = String(f).substring(0,(d+3));
document.calform.total.value = "$" + s;  
   }
}
//  End -->

//----------------------------------------------------------------------------------------------------------------------------------------------
// run time code 
var MenuList = new Array("personal","business");
var SubMenuList = new Array("persServices", "persDemos", "busServices","busDemos");

window.attachEvent("onload", correctPNG);