
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
//  End -->

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}


function validate_equal(field,field2,alerttxt)
{
with (field,field2)
  {
  if (value!=value)
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}
  }
  
 with (thisform)
  {
  if (validate_required(name,"First name must be filled out!")==false)
  {email.focus();return false;}
  }
    
  
  }
function validate_form1(thisform)
{
 with (thisform)
  {
  if (validate_required(name,"First name must be filled out!")==false)
  {email.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}
  }  
  
  with (thisform)
  {
  if (validate_required(phone,"Phone number must be filled out!")==false)
  {phone.focus();return false;}
  }  
  }


function validate_form2(thisform)
{
 with (thisform)
  {
  if (validate_required(name,"First name must be filled out!")==false)
  {name.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(lname,"Last name must be filled out!")==false)
  {lname.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(city,"City name must be filled out!")==false)
  {city.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(email,"Email must be filled out!")==false)
  {email.focus();return false;}
  }  
  with (thisform)
  {
  if (validate_required(remail,"Re-enter Email must be filled out!")==false)
  {remail.focus();return false;}
  }  
  
   with (thisform)
  {
  if (validate_equal(remail,email,"Your Email & Re-enter Email must be same!")==false)
  {remail.focus();return false;}
  } 
      
  }
  
  
  
  function validate_formcr(thisform)
{
 with (thisform)
  {
  if (validate_required(cnumber,"Card number must be filled out!")==false)
  {cnumber.focus();return false;}
  }
  
  with (thisform)
  {
  if (validate_required(cvnumber,"Card verification number must be filled out!")==false)
  {cvnumber.focus();return false;}
  }  
  with (thisform)
  {
  if (validate_required(month1,"Birth Month must be filled out!")==false)
  {month1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(date,"Birth date must be filled out!")==false)
  {date.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(year1,"Birth year must be filled out!")==false)
  {year1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(ss1,"Social Security Number must be filled out!")==false)
  {ss1.focus();return false;}
  }  
  with (thisform)
	{
if (agrement.checked == false){
alert("You must check the electronic signature box before moving on.");
agrement.focus();
return false;

}

}  
  
  }
  
  
  function validate_formelec(thisform)
{
 with (thisform)
  {
  if (validate_required(bank,"Bank Name must be filled out!")==false)
  {bank.focus();return false;}
  }  
  with (thisform)
  {
  if (validate_required(btype,"Account type must be filled out!")==false)
  {btype.focus();return false;}
  }  
  with (thisform)
  {
  if (validate_required(routing,"ABA routing number must be filled out!")==false)
  {routing.focus();return false;}
  }  
  with (thisform)
  {
  if (validate_required(checkno,"Check Number must be filled out!")==false)
  {checkno.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(account,"Account Number must be filled out!")==false)
  {account.focus();return false;}
  }  
 
  
 with (thisform)
  {
  if (validate_required(month1,"Birth Month must be filled out!")==false)
  {month1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(date,"Birth date must be filled out!")==false)
  {date.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(year1,"Birth year must be filled out!")==false)
  {year1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(ss1,"Social Security Number must be filled out!")==false)
  {ss1.focus();return false;}
  }  
  with (thisform)
	{
if (aggrement.checked == false){
alert("You must check the electronic signature box before moving on.");
aggrement.focus();
return false;

}

} 
}
  
  
  
  function validate_formper(thisform)
{
  with (thisform)
  {
  if (validate_required(month1,"Birth Month must be filled out!")==false)
  {month1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(date,"Birth date must be filled out!")==false)
  {date.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(year1,"Birth year must be filled out!")==false)
  {year1.focus();return false;}
  } 
  with (thisform)
  {
  if (validate_required(ss1,"Social Security Number must be filled out!")==false)
  {ss1.focus();return false;}
  }  
  with (thisform)
	{
if (aggrement.checked == false){
alert("You must check the electronic signature box before moving on.");
aggrement.focus();
return false;

}

} 
  with (thisform)
  {
  if (validate_required(ss1,"Social Security Number must be filled out!")==false)
  {ss1.focus();return false;}
  }  
  
  }
  function validate_formsig(thisform)
{
 
  with (thisform)
  {
  if (validate_required(file1,"Upload Your Check Signiture!")==false)
  {file1.focus();return false;}
  }  
  
  }
