﻿// JScript File

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var alertMessage = 'For your protection, please do not send any personal information (i.e. social security number, account number, date of birth, etc.). We do not respond to account related or personal information requests through unsecured email. If you have any questions regarding an existing account, please contact a Banker at a number referenced on our website. VisionBank does not collect your email address to use for any marketing purposes.';


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_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_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];}
}


function ResetBGColor(){
     document.forms[0].elements['nmUID'].style.backgroundColor = "white";
     if (document.forms[0].elements['optBusiness'].checked)
     {
        //document.forms[0].elements['nmPWD'].style.backgroundColor = "white";
     }
}
function RedirectUser() {
    switch (true)
            {
            case document.forms[0].elements['optBusiness'].checked:
                document.AccountLogin.method = 'post';
                document.AccountLogin.action = 'https://www.fiservdmecorp1.net/EBC_EBC1961/EBC1961.ASP?WCI=Process&WCE=RemoteLogon&IRL=T';
                return true;
                break
            case document.forms[0].elements['optPersonal'].checked:
                document.AccountLogin.AccessID.value = document.AccountLogin.nmUID.value;
                //document.AccountLogin.Password.value = document.AccountLogin.nmPWD.value;
                document.AccountLogin.nmUID.value = '';
                //document.AccountLogin.nmPWD.value = '';
                document.AccountLogin.method = 'post';
                document.AccountLogin.action = 'https://www.fiservdmecom1.net/PBI_PBI1961/pbi1961.asp?WCI=RemoteLogin&Rt=091017484&LogonBy=Connect3';
                return true;
                break
           /* case document.forms[0].elements['optRD'].checked:
                document.AccountLogin.username.value = document.AccountLogin.nmUID.value;
                document.AccountLogin.Password.name = 'password';
                document.AccountLogin.Password.id = 'password';
                document.AccountLogin.Password.value = document.AccountLogin.nmPWD.value;
                document.AccountLogin.method = 'post';
                document.AccountLogin.action = 'https://www.evisionbank.blilk.com/processLogin.asp';
                return true;
                break*/
             }
           }
function HideDivs()
{
    //Hide both divs:
    toggleBox('divBoth',0);
    //toggleBox('divPassword',0);
    
}
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
function ShowBusinessDiv()
{
    toggleBox('divBoth',1);
    toggleBox('divAccessID',1);
    toggleBox('divUserCode',0);
    //toggleBox('divPassword',1);
}
function ShowPersonalDiv()
{
    toggleBox('divBoth',1);
    toggleBox('divAccessID',0);
    toggleBox('divUserCode',1);
    //toggleBox('divPassword',0);
}
function optBusinessClick()
{

    HideDivs();
    ResetBGColor();
    ShowBusinessDiv();
    document.forms[0].elements['optBusiness'].checked=true;
    document.forms[0].elements['optPersonal'].checked=false;
    document.forms[0].elements['nmUID'].value = '';
    //document.forms[0].elements['nmPWD'].value = '';
}
function optPersonalClick()
{
    HideDivs();
    ResetBGColor();
    ShowPersonalDiv();
    document.forms[0].elements['optBusiness'].checked=false;
    document.forms[0].elements['optPersonal'].checked=true;
    document.forms[0].elements['nmUID'].value = '';
}
function ValidateLogin() {
    ResetBGColor();
    if ((!document.forms[0].elements['optBusiness'].checked) && (!document.forms[0].elements['optPersonal'].checked))
        {
            alert('Please select an Account Type');
            return false;
        }
    else if (document.forms[0].elements['nmUID'].value == '')
        {
            document.forms[0].elements['nmUID'].style.backgroundColor = "#FFFF00";
            document.forms[0].elements['nmUID'].focus();
            alert('Please enter your Username');
            return false;
        }
   /*else if ((document.forms[0].elements['nmPWD'].value == '') && (document.forms[0].elements['optBusiness'].checked))
        {
            document.forms[0].elements['nmPWD'].style.backgroundColor = "#FFFF00";
            document.forms[0].elements['nmPWD'].focus();
            alert('Please enter your Password');  
            return false;
        }*/
    else
        {
            RedirectUser();
        }
}
function linkAlert(openlink) {
	alert("You are now leaving the VisionBank website.  Views or opinions on the linked website do not necessarily represent those of VisionBank.  The linked website has its own privacy and security policies and they may be different than the policies of VisionBank.");
	window.open(openlink,'affiliate');
	return false;
}