//	This function prompts the user when leaving the site.  If the user clicks OK, the function returns true.  If the user clicks Cancel, the function returns false.
//	Known Calls to this function:
//		Reorder Checks link

function confirmSubmit()
{
	var agree = confirm("You are leaving the site managed by The Farmers Bank.  Do you wish to proceed?");
	if (agree)
		return true ;
	else
		return false ;
}

function ackInSecure()
{
	var agree = confirm("Warning.  Please note that e-mail is an insecure mode of communication.  Never send any sensitive information such as account numbers, social security numbers or balances to us through e-mail communications.  \n\nClick 'OK' to open your default e-mail application or 'Cancel' to return to the page.");
	if (agree)
		return true ;
	else
		return false ;
}


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_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//	This is code required to use the login functional of the online banking portal placed in the side_nav page
function setAction()
{
//Fill in the Routing number below.
var rtNum = "061102620";
var x = document.forms.Remote;

if(x.loginTo[0].checked) {
x.action = 'https://personsbankingco.com/pbi_pbi1961/pbi1961.asp?WCI=RemoteLogin&RT=061102620&LogonBy=connect3&PRMACCESS=Account';
} else {
x.nmUID.value = x.AccessID.value;
x.nmRTN.value = rtNum;
x.action = 'https://personsbankingco.com/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T&RT=107006994&MFA=2';
}
}

function doLoginRefresh()
{
var x = document.forms.Remote;

if (x.AccessIDVisible.value != "") {
x.AccessID.value = x.AccessIDVisible.value;
x.AccessIDVisible.value = "";

setAction();
return true;
} else {
alert("Please Enter a valid Access ID.  Thank you!");
return false;
}
}

//	This is a function to replace the inactive image link of the navigation panel with an active image link

function getImage()  {
    var i, Id, Image;
    var x = window.location.pathname;
    var myRegExp;
    myRegExp = new RegExp("/[a-zA-Z0-9_]+.asp", "gi");
    var y = myRegExp.exec(x).toString();
    y = y.substring(1, y.length - 4);
    
    var arrImageSwapByPage = new Array();
//    arrImageSwapByPage[""] = new Array( "", "Image", "images/.jpg" );
    arrImageSwapByPage["0"] = new Array( "index", "Image1", "images/home_active.jpg" );
    arrImageSwapByPage["1"] = new Array( "banking_services", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["2"] = new Array( "personal_checking", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["3"] = new Array( "personal_savings", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["4"] = new Array( "cod_ira", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["5"] = new Array( "business_checking", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["6"] = new Array( "business_savings", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["7"] = new Array( "loans", "Image3", "images/loans_active.jpg" );
    arrImageSwapByPage["8"] = new Array( "other_services", "Image4", "images/otherservices_active.jpg" );
    arrImageSwapByPage["9"] = new Array( "online_banking", "Image5", "images/onlinebanking_active.jpg" );
    arrImageSwapByPage["10"] = new Array( "credit_cards", "Image11", "images/creditcards_active.jpg" );
    arrImageSwapByPage["11"] = new Array( "consumer_credit", "Image7", "images/consumercredit_active.jpg" );
    arrImageSwapByPage["12"] = new Array( "locations", "Image8", "images/locations_active.jpg" );
    arrImageSwapByPage["13"] = new Array( "about_us", "Image9", "images/aboutus_active.jpg" );
    arrImageSwapByPage["14"] = new Array( "contact_us", "Image10", "images/contactus_active.jpg" );
    arrImageSwapByPage["15"] = new Array( "rates", "Image2", "images/bankingservices_active.jpg" );
    arrImageSwapByPage["16"] = new Array( "privacy", "Image5", "images/onlinebanking_active.jpg" );
    
    for (i = 0; i < arrImageSwapByPage.length; i++)  {
        if (arrImageSwapByPage[i][0] == y)  {
                Id = arrImageSwapByPage[i][1].toString();
                Image = arrImageSwapByPage[i][2].toString();
        }
    }
    
	if (Id != undefined & Image != undefined) {
	    MM_swapImage(Id,'',Image,1);
	}
}