// JScript File
var Showme=0
function getwhichlogin() {
    var Combo = document.getElementById("loginONdefault");
	var val = Combo.options[Combo.selectedIndex].value;
return val;}

function ToploginSelection() {
    var Combo1 = document.getElementById("login");
	var val1 = Combo1.options[Combo1.selectedIndex].value;
return val1;}

function showIBUnavailableMsg() {
    var content = new Array();
    var index = 0;
    content[index++] = "<br />";
    content[index++] = "<div align=\"center\"><span style=\"font-size: 9pt; font-weight: bold;\">e-BankPlus is currently unavailable for access due to an unexpected service interruption. We apologize for the inconvenience.</span><br /><br /><a href=\"javascript:void('0');\" onclick=\"document.getElementById('unavail_msg_dis').style.display = 'none'\">[ Close ]</a></div>";
    document.getElementById("unavail_msg_dis").innerHTML = content.join("");
    document.getElementById("unavail_msg_dis").style.display = "block";
    scrollTo(0, 0);
}

function showBBUnavailableMsg() {
    var content = new Array();
    var index = 0;
    content[index++] = "<br />";
    content[index++] = "<div align=\"center\"><span style=\"font-size: 9pt; font-weight: bold;\">e-BankPlus for Business is currently unavailable for access due to an unexpected service interruption. We apologize for the inconvenience.</span><br /><br /><a href=\"javascript:void('0');\" onclick=\"document.getElementById('unavail_msg_dis').style.display = 'none'\">[ Close ]</a></div>";
    document.getElementById("unavail_msg_dis").innerHTML = content.join("");
    document.getElementById("unavail_msg_dis").style.display = "block";
    scrollTo(0, 0);
}

function LoginwEnterKey(e) {
    var keyNum;
    
    if (window.event)
        keyNum = e.keyCode;
    else if (e.which)
        keyNum = e.which;

    if (keyNum == 13) {
        //__doPostBack('imgSearch','');
        //if (document.getElementById("txtSearch").focus) {
	//return HidePanel();            
	return GoTo();	
        //}
    }
}

function LoginwEnterKey1(e) {
    var keyNum;
    
    if (window.event)
        keyNum = e.keyCode;
    else if (e.which)
        keyNum = e.which;
	//alert(keyNum);
    if (keyNum == 13) {
        //__doPostBack('imgSearch','');
        //if (document.getElementById("txtSearch").focus) {
	//return HidePanel();            
	
	//showHideModalPopup();
	return GoTo();		
        //}
    }
}

function GetLoginType(){
	var x = navigator;
	var Name = x.appName;
	var UA = x.userAgent;
	var val = getwhichlogin();
	if (val == "0")	{
		//alert('Please select Account login type')
	        
	}
	if (val == "1") {
	    if ((document.getElementById("ctl00_hfPersonalUnavailMsg")) && (document.getElementById("ctl00_hfPersonalUnavailMsg").value == 1)) {
	        showIBUnavailableMsg();
	        document.getElementById("loginONdefault").selectedIndex = 0;
	    }
	    if (UA.search("afarixxx") > 0) {window.location = 'BankPlus_safariLogin3.aspx'}
        //document.eLogin.action="https://www.e-bankplus.net/onlineserv/HB/Login.cgi";	
		//document.eLogin.password.value = document.getElementById("etxtPassword").value;
	    //document.eLogin.userNumber.value = document.getElementById("etxtUsername").value;
		//document.getElementById("etxtUsername").value
		//document.eLogin.btn.click();
	    //document.eLogin.submit();					
  }
	
	if (val == "2")	{
	    if ((document.getElementById("ctl00_hfBusinessUnavailMsg")) && (document.getElementById("ctl00_hfBusinessUnavailMsg").value == 1)) {
	        showBBUnavailableMsg();
	        document.getElementById("loginONdefault").selectedIndex = 0;
	    } else {
	        window.location = 'https://www.e-bankplus.net/onlineserv/CM/';
	    }	
  }
  

if (val == "5")	{window.location = 'https://www.consumercardaccess.com/main/payrollplus/home';}
if (val == "6") {window.location = 'https://www.paycardsolutions.com/pcs/payrollplus/payroll';}
if (val == "7")	{window.location = 'https://xpress.epaysol.com/ct/?bid=098112115';}
if (val == "8")	{window.location = 'https://trustreporter.com/TRv3/?bankabvr=BANKPLUS';}
if (val == "9")	{window.location = 'https://lockbox.banktel.com';}

  if (val == "3")	{
//	document.formParticipant.ssn.value=document.getElementById("etxtUsername").value;
//	document.formParticipant.pin.value=document.getElementById("etxtPassword").value;
//	document.formParticipant.submit();
  }     
  
  if (val == "4")	{				    
//	document.formParticipant1.username.value=document.getElementById("etxtUsername").value;;
//	document.formParticipant1.password.value=document.getElementById("etxtPassword").value;
//	document.formParticipant1.lp.value="BKP";
//	document.formParticipant1.action="https://www.dailyaccess.com/ssl/participant/control/login"; 
//	document.formParticipant1.submit();
  }     
}
			
			
function GoTo()
{
    var val = getwhichlogin();
if (val =="0")
{
	alert('Please select Account Login type');
}
   

 if (val == "1")	
 {

		if (document.getElementById("etxtPassword").value =='' || document.getElementById("etxtUsername").value =='')
		{

			
			if (document.getElementById("etxtUsername").value=='') 
			{
				alert('Please Enter Username');
				document.getElementById("etxtUsername").focus();
				return false
	       		}
			if (document.getElementById("etxtPassword").value =='')
			{
				alert('Please Enter Password');
				document.getElementById("etxtPassword").focus();
				return false
			}
			
		}
		else				
		{	 	
            document.Login.password.value = document.getElementById("etxtPassword").value;
			document.Login.userNumber.value = document.getElementById("etxtUsername").value;

			if ((document.getElementById("ctl00_hfPersonalUnavailMsg")) && (document.getElementById("ctl00_hfPersonalUnavailMsg").value == 1)) {
				showIBUnavailableMsg();
				document.getElementById("loginONdefault").selectedIndex = 0;
			} else {
				document.Login.btn.click();
				document.Login.submit();
			}  			
	 	}
}

if (val == "2") {
    if ((document.getElementById("ctl00_hfBusinessUnavailMsg")) && (document.getElementById("ctl00_hfBusinessUnavailMsg").value == 1)) {
        showBBUnavailableMsg();
        document.getElementById("loginONdefault").selectedIndex = 0;
    }
}

     if (val == "4")	{				
    	
if (document.getElementById("etxtPassword").value =='' || document.getElementById("etxtUsername").value=='')
		{
			if (document.getElementById("etxtUsername").value=='') 
			{
				alert('Please Enter Username');
				document.getElementById("etxtUsername").focus();
				return false
	       		}
			if (document.getElementById("etxtPassword").value =='')
			{
				alert('Please Enter Password');
				document.getElementById("etxtPassword").focus();
				return false
			}
       		}else
		{
			document.formParticipant1.username.value=document.getElementById("etxtUsername").value;;
			document.formParticipant1.password.value=document.getElementById("etxtPassword").value;
			document.formParticipant1.lp.value="BKP";
			document.formParticipant1.action="https://www.dailyaccess.com/ssl/participant/control/login"; 
			document.formParticipant1.submit();
		}
  }     
    
 if (val == "3")	{				
    	
if (document.getElementById("etxtPassword").value =='' || document.getElementById("etxtUsername").value=='')
		{
			if (document.getElementById("etxtUsername").value=='') 
			{
				alert('Please Enter Username');
				document.getElementById("etxtUsername").focus();
				return false
	       		}
			if (document.getElementById("etxtPassword").value =='')
			{
				alert('Please Enter Password');
				document.getElementById("etxtPassword").focus();
				return false
			}
       		}else
		{
			document.formParticipant.ssn.value=document.getElementById("etxtUsername").value;;
			document.formParticipant.pin.value=document.getElementById("etxtPassword").value;
			document.formParticipant.submit();
		}
  }        
} 

            function IntToHex(n)
			{
			var result = n.toString(16);
			if (result.length==1) result = "0"+result;
			return result;
			}
			 
			function safeEncode(strToEncode) 
			{
			var outStr = "";
			for(i = 0; i < strToEncode.length; i++)
			{
			outStr = outStr + IntToHex(strToEncode.charCodeAt(i));
			}
			return outStr;
			}

			function validate(form)
			{
			form.safeencpwd.value = safeEncode(form.pin.value)
			form.submit.disabled = true
			return true;
			}
			
			////document.formParticipant.submit();			
			
function chkenroll() {
	var val = getwhichlogin();
	//var val = Combo.options[Combo.selectedIndex].value;
	//If (val == 4 ) {window.location="https://www.dailyaccess.com/ssl/onlineenroll/action/enroll";}
	//if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/STDReg.cgi?runmode=REGISTRATION";}
	if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/STDReg.cgi";}
	if (val==4)
	{
		window.location="https://www.dailyaccess.com/ssl/onlineenroll";
	}
	if (val == 0)	{
		alert('Please Select Account Type');
	        
	}

}			
function chkTopenroll() {

	var val=document.getElementById("ctl00_ddlLogin").selectedIndex	
	
	if (val == 4 ) {window.location="https://www.dailyaccess.com/ssl/onlineenroll";}
	//if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/STDReg.cgi?runmode=REGISTRATION"}
if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/STDReg.cgi";}
	
}	
function chkTopForget() {
	var val=document.getElementById("ctl00_ddlLogin").selectedIndex
	if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/ForgottenPW.html";}
	if (val == 4 ) {window.location="contactus.aspx"}
	if (val == 3 ) {window.location="contactus.aspx"}
}

 function chkSideForgot() {
	var val = getwhichlogin();
	if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/ForgottenPW.html";}
	if (val == 4 ) {window.location="contactus.aspx"}
	if (val == 3 ) {window.location="contactus.aspx"}
	if (val == 0)	{
		alert('Please Select Account Type');
	        
	}
}

function chkForgetUserId(){
	var val = getwhichlogin();
	if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/HelpLogin.cgi?loginHelpId=forgotuseridhelp#forgotuseridhelp";}
	//if (val == 1 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
	if (val == 4 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
	if (val == 3 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
}

function chkTopForgetUserId(){
	var val=document.getElementById("ctl00_ddlLogin").selectedIndex
	if (val == 1 ) {window.location="https://www.e-bankplus.net/onlineserv/HB/HelpLogin.cgi?loginHelpId=forgotuseridhelp#forgotuseridhelp";}
	//if (val == 1 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
	if (val == 4 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
	if (val == 3 ) {window.open('popuptemplate.aspx?id=568','ForgotUsername','width=300,height=350')}
}
function chkTopForgetUser() {
	var val=document.getElementById("ctl00_ddlLogin").selectedIndex
	if (val == 1 ) {window.location="contactus.aspx";}
	if (val == 4 ) {window.location="contactus.aspx"}
	if (val == 3 ) {window.location="contactus.aspx"}
}

function onOk() {
	
	if (TopLoginCheck() == false)
	{	
			showHideModalPopup()	
	}
else
	{
    
    val=document.getElementById("ctl00_ddlLogin").selectedIndex
   
    if (val == "1")	
    {		
			document.Login.password.value = document.getElementById("TopLoginUserPassword").value;
	    		document.Login.userNumber.value = document.getElementById("TopLoginUserName").value;
			document.Login.btn.click();
	    		document.Login.submit();				
		    }
  
  	if (val == "2")	{
	 window.location = 'https://www.e-bankplus.net/onlineserv/CM/';
	}

	if (val == "3")	{						
			document.formParticipant.ssn.value=document.getElementById("TopLoginUserName").value;;
			document.formParticipant.pin.value=document.getElementById("TopLoginUserPassword").value;
			document.formParticipant.submit();	
  	}     
   	

     if (val == "4")	{						
			document.formParticipant1.username.value=document.getElementById("TopLoginUserName").value;;
			document.formParticipant1.password.value=document.getElementById("TopLoginUserPassword").value;
			document.formParticipant1.lp.value="BKP";
			document.formParticipant1.action="https://www.dailyaccess.com/ssl/participant/control/login"; 
			document.formParticipant1.submit();		
  	}     
   	
    
document.getElementById("TopLoginUserName").value =""
   	document.getElementById("TopLoginUserPassword").value=""
  	document.getElementById("ctl00_ddlLogin").selectedIndex=0
     }
    
    }
    function modalPopUp()
    { 
        //var val = document.getElementById("login").options[document.getElementById("login").selectedIndex].value;
	    //var val = Combo.options[Combo.selectedIndex].value;

        alert(document.getElementById("login").selectedIndex)
        if (document.getElementById("login").selectedIndex == 4) {
            $object('ModalPopupExtender1')._show();
            return false;
        } else{
            $object('ModalPopupExtender1')._hide();
            return false;
        }
    }

    function hideModalPopUp() {
        window.setTimeout("$object('ModalPopupExtender1')._hide();", 1000);
        $object('ModalPopupExtender1')._hide();
       //document.getElementById("ctl00_ddlLogin").selectedIndex=0;
        //return false;
    }

    function showHideModalPopup() {
	var x = navigator;
	var Name = x.appName;
	var UA = x.userAgent;
        if (document.getElementById("ctl00_ddlLogin")) {
            if (document.getElementById("ctl00_ddlLogin").selectedIndex == 1) {
                if ((document.getElementById("ctl00_hfPersonalUnavailMsg")) && (document.getElementById("ctl00_hfPersonalUnavailMsg").value == 1)) {
                    showIBUnavailableMsg();
                    ChangeIndex()
                } else {
                    if (UA.search("afarixxx") > 0) { window.location = 'BankPlus_safariLogin3.aspx' }
                    $find('MPE').show();
                    document.getElementById("PopUpName").value = 'e-BankPlus Personal'
                }
            }

            if (document.getElementById("ctl00_ddlLogin").selectedIndex == 2) {
                if ((document.getElementById("ctl00_hfBusinessUnavailMsg")) && (document.getElementById("ctl00_hfBusinessUnavailMsg").value == 1)) {
                    showBBUnavailableMsg();
                    ChangeIndex()
                } else {
                    window.location.href = "https://www.e-bankplus.net/onlineserv/CM/"
                }
            }
            
            if (document.getElementById("ctl00_ddlLogin").selectedIndex == 3) {
                $find('MPE').show();
                document.getElementById("PopUpName").value = 'FuturePlus Participant'
            }

            if (document.getElementById("ctl00_ddlLogin").selectedIndex == 4) {
                $find('MPE').show();
                document.getElementById("PopUpName").value = 'FuturePlus DailyAccess'
            }
            
if (document.getElementById("ctl00_ddlLogin").selectedIndex == "5")	{
	 window.location.href = 'https://www.consumercardaccess.com/main/payrollplus/home';
	}

   if (document.getElementById("ctl00_ddlLogin").selectedIndex == "6")	{
	 window.location.href = 'https://www.paycardsolutions.com/pcs/payrollplus/payroll';
	}
if (document.getElementById("ctl00_ddlLogin").selectedIndex == "7")	{
	 window.location.href = 'https://xpress.epaysol.com/ct/?bid=098112115';
	}
if (document.getElementById("ctl00_ddlLogin").selectedIndex == "8")	{
	 window.location.href = 'https://trustreporter.com/TRv3/?bankabvr=BANKPLUS';
	}
if (document.getElementById("ctl00_ddlLogin").selectedIndex == "9")	{
	 window.location.href = 'https://lockbox.banktel.com';
	}


//            else if (document.getElementById("ctl00_ddlLogin").selectedIndex == 0) {
//            } else {
//                $find('MPE').show();
//            } 
        }
    }
    
    function ChangeIndex()
    {
        document.getElementById("ctl00_ddlLogin").selectedIndex=0;
    }
    
    function HidePanel()
    {    
        $find('MPE').hide(); 
         document.getElementById("ctl00_ddlLogin").selectedIndex=0;
        return false;
        
    }

			function TopLoginCheck()
			{
			if (document.getElementById("TopLoginUserName").value =='')
			{
				showHideModalPopup()
				alert('Please Enter Username');
				//document.getElementById("TopLoginUserName").focus();
				//showHideModalPopup()
				return false
				Showme=1
	       		}else
				Showme=0
			if (document.getElementById("TopLoginUserPassword").value =='')
			{
				showHideModalPopup()
				alert('Please Enter Password');
				//document.getElementById("TopLoginUserPassword").focus();
				//showHideModalPopup()
				return false
				Showme=1
			}else
				Showme=0
            }

document.write('<div id="unavail_msg_dis" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #000000; text-align: left; position:absolute; top:2px; left:75px; border: thin solid #000000; padding: 10px; display: none; z-index: 3000; width:300px; height: 100px;"></div>');
