<!--
//determine checked radio button's value
function getRadioValue(radiobtn){

 var value = null;
 for (var i=0; i<radiobtn.length; i++)
 {
   if (radiobtn[i].checked) 
	{value = radiobtn[i].value;}
 }
    return value;
}  
function MarkDadio(radiobtn)
{
    if(getRadioValue(radiobtn)==null)
      {radiobtn[0].checked=true;}
}
function MarkOffDadio(radiobtn)
{
  if(getRadioValue(radiobtn)!=null)
    for (var i=0; i<radiobtn.length; i++)
   {
      if (radiobtn[i].checked) 
	{
       radiobtn[i].checked=false;
	   if(radiobtn[i].name=="FundsRequeuer")
		 {EntryForm.FundsReqDescription.value="Other, Please Describe";}
	   if(radiobtn[i].name=="SecuritiesRequeuer")
		 {EntryForm.SecuritiesReqDescription.value="Other, Please Describe";}
	}
   }
}
function MarkCheck(radiobtn){
if(radiobtn.checked!=true)
  {radiobtn.checked=true;}
}
function MarkCheckOff(radiobtn){
if(radiobtn.checked==true)

{radiobtn.checked=false;}
}
function clrtxt(fieldObject){//Clear Text box
   fieldObject.value="";}
function MaxChars(FieldName,FieldVal,CharLen)
{

if (FieldVal.length > CharLen)
  {alert("Your entry has exceeded the maximum allowable characters of "+ CharLen +" for this field! ");
   FieldName.select();
   return(false);
  }
}
function validateDate(fieldValue) {
	var month = fieldValue.substr(0,2);
	var day = fieldValue.substr(3,2);
	var year = fieldValue.substr(6,4);
	var date = new Date(year, month - 1, day);
//alert(month + '/' + day + '/' + year); alert(date); alert(date.getMonth());
	if (year != date.getFullYear() || month != date.getMonth()+1 || day != date.getDate())
		return false;
	else
		return true;
}

function validateTime(fieldValue) {
	var hour = fieldValue.substr(0,2);
	var minute = fieldValue.substr(3,2);
	if(hour < '01' || hour > '12' || minute < '00' || minute > '59')
		return false;
	else 
		return true;
}

function validateAMPM(apStart) {
// AM/PM Radio Object [array]
	var chck = false;
	for(i=0; i < apStart.length; i++)
		{
		if(apStart[i].checked == true)
			{chck = true;}
		}
	return chck;
}

function validateform(theForm){
//Validate form for required fields
if(theForm.BankName.value=="Bank Name")
    {
      alert("Please Enter Bank Name");
      theForm.BankName.focus();
      return (false);
    }
if(theForm.ABANumber.value=="ABA")
    {
      alert("Please Enter Bank ABA Number");
      theForm.ABANumber.focus();
      return (false);
    }
  // Check if ABA is all digit, and a valid ABA -- C.A.Solomon 1998.
  var checkOK = "0123456789";
  var checkStr = theForm.ABANumber.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  var multi= 0;
  var sumchek= 0;
  var counter=0;
  var checker=true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
   }
  
  if (!allValid)
  {
    alert("Please enter only numeric values in the \"ABA\" field.");
    theForm.ABANumber.focus();
    return (false);
  }
  if (allValid){
     for (i = 0;  i < 9;  i++)
     { if (i==0){
       ch = checkStr.charAt(0); multi=3*ch; sumchek=multi+sumchek; multi=0;}
       if (i==1){
       ch = checkStr.charAt(1); multi=7*ch; sumchek=multi+sumchek; multi=0;}
       if (i==2){
       ch = checkStr.charAt(2); multi=1*ch; sumchek=multi+sumchek; multi=0;}
       if (i==3){
       ch = checkStr.charAt(3); multi=3*ch; sumchek=multi+sumchek; multi=0;}
       if (i==4){
       ch = checkStr.charAt(4); multi=7*ch; sumchek=multi+sumchek; multi=0;}
       if (i==5){
       ch = checkStr.charAt(5); multi=1*ch; sumchek=multi+sumchek; multi=0;}
       if (i==6){
       ch = checkStr.charAt(6); multi=3*ch; sumchek=multi+sumchek; multi=0;}
       if (i==7){
       ch = checkStr.charAt(7); multi=7*ch; sumchek=multi+sumchek; multi=0;}
       if (i==8){
       ch = checkStr.charAt(8); multi=1*ch; sumchek=multi+sumchek; sumchek=sumchek%10;      
       if(sumchek!=0)
          {
            allValid = false;
            alert("Invalid ABA, please check your entry!")
            theForm.ABANumber.focus();
            return false
         }
       }
    }
}
// New
if(theForm.ContactFirstName.value=="First Name")
    {
      alert("Enter Contact First Name.");
      theForm.ContactFirstName.focus();
      return (false);
    }
if(theForm.ContactLastName.value=="Last Name")
    {
      alert("Enter Contact Last Name.");
      theForm.ContactLastName.focus();
      return (false);
    }
	
var PhoneOK = "0123456789-() ";
var PhoneString = theForm.ContactPhone.value;
var PhoneIsValid = true;
var PhoneNum = "";
  for (i = 0;  i < PhoneString.length;  i++)
  {
    ch = PhoneString.charAt(i);
    for (j = 0;  j < PhoneOK.length;  j++)
      if (ch == PhoneOK.charAt(j))
        break;
    if (j == PhoneOK.length)
    {
      PhoneIsValid = false;
      break;
    }
    PhoneNum += ch;
   }
  
  if (!PhoneIsValid)
  {
    alert("Only numeric value with area code is allowed in the \"Contact Phone\ field as \n(XXX)-XXX-XXXX or\n XXX-XXX-XXXX or\n XXX XXX XXXX or\n XXXXXXXXXX");
    theForm.ContactPhone.focus();
    return (false);
  }

if(theForm.ContactPhone.value=="Phone (Include area code)" || theForm.ContactPhone.value.length < 10)
    {
      alert("Enter Contact Phone Number with area code.");
      theForm.ContactPhone.focus();
      return (false);
    }
if(theForm.ContactEmail.value=="E-mail")
    {
      alert("Please Enter Your E-Mail Address");
      theForm.ContactEmail.focus();
      return (false);
    }
 
var Temp     = theForm.ContactEmail.value
var AtSym    = Temp.indexOf('@')
var Period   = Temp.lastIndexOf('.')
var Space    = Temp.indexOf(' ')
var Length   = Temp.length - 1   // Array is from 0 to length-1

if ((AtSym < 1) ||                     // '@' cannot be in first position
   (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
   (Period == Length ) ||             // Must be atleast one valid char after '.'
   (Space  != -1))                    // No empty spaces permitted
    { alert('Please enter a valid e-mail address!');
      theForm.ContactEmail.focus();
      return (false);
     }

if(theForm.FundsTest.checked == false && theForm.SecuritiesTest.checked == false)
	{
	alert("Please check application to be tested.");
	theForm.FundsTest.focus();
	return (false) ;
	}
if(theForm.FundsTest.checked == true)
  {

 if(getRadioValue(theForm.FundsRequeuer)=="Other" && (theForm.FundsReqDescription.value=="Other, Please Describe" || theForm.FundsReqDescription.value==""))
    {
     alert("You have selected \"Other \", please describe.");
     theForm.FundsReqDescription.focus();
     return (false);
    }
 
 if(getRadioValue(theForm.FundsRequeuer)=="Other" && 
   (theForm.FundsReqDescription.value!="Other, Please Describe" || theForm.FundsReqDescription.value!="") && 
   (theForm.FundsReqDescription.value.length > 25))
    {
     alert("Your entry has exceeded the maximum allowable characters of 25 for this field!");
     theForm.FundsReqDescription.select();
     return (false);
    }
if(getRadioValue(theForm.FundsRequeuer)!="Other")
  {theForm.FundsReqDescription.value=="";}
 }
 if(theForm.FundsTest.checked == false)
  {
   theForm.FundsReqDescription.value="";
  }
if(theForm.SecuritiesTest.checked == true){
  if(getRadioValue(theForm.SecuritiesRequeuer)=="Other" && (theForm.	 
  SecuritiesReqDescription.value=="Other, Please Describe" || theForm.
  SecuritiesReqDescription.value==""))
    {
     alert("You have selected \"Other \", please describe.");
     theForm.SecuritiesReqDescription.focus();
     return (false);
    }
if(getRadioValue(theForm.SecuritiesRequeuer)=="Other" && (theForm.	 
  SecuritiesReqDescription.value!="Other, Please Describe" || theForm.
  SecuritiesReqDescription.value!="") && (theForm.
  SecuritiesReqDescription.value.length > 25))
    {
     alert("Your entry has exceeded the maximum allowable characters of 25 for this field!");
     theForm.SecuritiesReqDescription.select();
     return (false);
    }

	
	if(getRadioValue(theForm.SecuritiesRequeuer)!="Other")
  	{theForm.SecuritiesReqDescription.value=="";
		}
 }


if(theForm.Comments.value!="" && theForm.Comments.value.length > 200)
    {
     alert("Your entry has exceeded the maximum allowable characters of 200 for this field!");
     theForm.Comments.select();
     return (false);
    }
if(!validateDate(theForm.TestingStartDate.value))
	{
	alert("Please Enter Start Testing Date.");
	theForm.TestingStartDate.focus();
	return (false);
	}

if(getRadioValue(theForm.FPMFundsInProd)==null)
  {
   alert("Please respond \"Yes\" or \"No\" to \n\"IS YOUR INSTITUTION USING  FEDLINE ADVANTAGE FOR FEDWIRE FUNDS IN PRODUCTION?\"");
	theForm.FPMFundsInProd[1].focus();
	return (false);
  }
if(getRadioValue(theForm.FPMSecuritiesInProd)==null)
  {
   alert("Please respond \"Yes\" or \"No\" to \n\"IS YOUR INSTITUTION USING  FEDLINE ADVANTAGE FOR FEDWIRE SECURITIES IN PRODUCTION?\"");
	theForm.FPMSecuritiesInProd[1].focus();
	return (false);
  }
return (true);
}
//-->
