isValid = true;
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
if(isNN)
  document.captureEvents(Event.KEYPRESS);
function bolAutoTab(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();
    input.form[(getIndex(input)+1)%input.form.length].select();
  }
  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;
}

function bolEnableFields(form,field)
{
	if((field.value) == "yes")
	{		
		form.BoaPayeeDescription.value = "";		
		document.getElementById("BoaAcctNumLabel").style.color = "Black";
		document.getElementById("PAN").style.color = "Black";
		document.getElementById("BoaVerifyAcctNumLabel").style.color = "Black";						 
		form.BoaAccountNumber.style.backgroundColor = "White";
		form.BoaVerifyAccountNum.style.backgroundColor = "White";
		form.BoaAccountNumber.disabled = false;
		form.BoaVerifyAccountNum.disabled = false;
		form.BoaPayeeDescription.disabled = true;
		form.BoaPayeeDescription.style.backgroundColor = "Gray";
		document.getElementById("BoaPayeeDescLabel").style.color = "Gray";
		document.getElementById("paymsg").style.color = "Gray";
		document.getElementById("BoaPayeeDescriptionEg").style.color = "Gray";
		
		document.getElementById("messageReq").style.visibility = "hidden";
		document.getElementById("messageReq").style.display = "none";
		document.getElementById("acctReq").style.visibility = "visible";
		document.getElementById("acctReq").style.display = "inline";
		document.getElementById("acctReqVer").style.visibility = "visible";
		document.getElementById("acctReqVer").style.display = "inline";
	}
	if((field.value) == "no")
	{
		form.BoaAccountNumber.value = "";
		form.BoaVerifyAccountNum.value = "";
		form.BoaAccountNumber.disabled = true;
		form.BoaVerifyAccountNum.disabled = true;
		document.getElementById("BoaAcctNumLabel").style.color = "Gray";
		document.getElementById("PAN").style.color = "Gray";
		document.getElementById("BoaVerifyAcctNumLabel").style.color = "Gray";			
		form.BoaAccountNumber.style.backgroundColor = "Gray";
		form.BoaVerifyAccountNum.style.backgroundColor = "Gray";
		form.BoaPayeeDescription.disabled = false;
		form.BoaPayeeDescription.style.backgroundColor = "White";
		document.getElementById("BoaPayeeDescLabel").style.color = "Black";
		document.getElementById("BoaPayeeDescriptionEg").style.color = "Black";		
				document.getElementById("paymsg").style.color = "Black";
		
		document.getElementById("messageReq").style.visibility = "visible";
		document.getElementById("messageReq").style.display = "inline";
		document.getElementById("acctReq").style.visibility = "hidden";
		document.getElementById("acctReq").style.display = "none";
		document.getElementById("acctReqVer").style.visibility = "hidden";
		document.getElementById("acctReqVer").style.display = "none";
	}
}

function bolClearForm(form,url)
{
	isValid = true;
	form.action= url; 
	form.submit();
}
function bolPopupURL(aURL)
{
	var newWin = window.open(aURL,"bol","directories=0,height=400,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=yes,width=625");
}


