//Logon script for Personal
function validateLogonP( host ) {

	var userid 		= document.form_p.j_username.value;
	
	if ( userid.length == 0 ) {
		alert( "In order to access First National Bank Omaha Online, please enter your User ID and click Log In." );
		document.form_p.j_username.select();
		document.form_p.j_username.focus();
	}
	else {
		if (document.form_p.submitted.value != "yes") {
			document.form_p.submitted.value = "yes";
			document.form_p.action = "https://" + host + "/iwsOnline/public/authenticate/authenticate.do";
			document.form_p.submit();
		}
	}
}
function forceAlphaNumericP(e,textObject) {		
	var charCode = (navigator.appName == "Netscape")?e.which:e.keyCode;
	var targetElement = (navigator.appName == "Netscape")?e.target:e.srcElement;
	
	// NS 6.0 weirdness
	if ((charCode==0)&&(e.keyCode > 0)) {
		charCode = e.keyCode;
	}
	
	var aChar = String.fromCharCode(charCode);
	
	var myCriteria = /[0-9]/gi;
	var myMatch = aChar.match(myCriteria);
	if (myMatch != null){return charCode;}
	
	var myCriteria = /[a-z]/gi;
	var myMatch = aChar.match(myCriteria);
	if (myMatch != null){return charCode;}
	
	if(charCode==8){return charCode;}
	if(charCode==9){return charCode;}
	if(charCode==13){
		if (targetElement==document.form_p.j_username){
			document.form_p.submit();
		}
	}
	return false;
}

function go(location){
	var form = document.form_p;
	self.parent.window.location = location;
}





//Logon script for Business
function validateLogonB( host ) {

	var userid 		= document.form_b.USERID.value;
	
	if ( userid.length == 0 ) {
		alert( "In order to access First National Bank Omaha Online, please enter your User ID and click Log In." );
		document.form_b.USERID.select();
		document.form_b.USERID.focus();
	}
	else {
		document.form_b.action = "https://" + host + "/IBWS/checkUser.do?action=userName"
		document.form_b.submit();
	}
}
function forceAlphaNumeric(e,textObject) {
			
	        var charCode = (navigator.appName == "Netscape")?e.which:e.keyCode;
	        var targetElement = (navigator.appName == "Netscape")?e.target:e.srcElement;

		// NS 6.0 weirdness
		if ((charCode==0)&&(e.keyCode > 0)) {
			charCode = e.keyCode;
		}

	        var aChar = String.fromCharCode(charCode);
	
	        var myCriteria = /[0-9]/gi;
	        var myMatch = aChar.match(myCriteria);
	        if (myMatch != null){return charCode;}
	
	        var myCriteria = /[a-z]/gi;
	        var myMatch = aChar.match(myCriteria);
	        if (myMatch != null){return charCode;}
	
	        if(charCode==8){return charCode;}
	        if(charCode==9){return charCode;}
	        if(charCode==13){
		if (targetElement==document.form_b.USERID){
			document.form_b.submit();
		}
	}
	return false;
}
function go(location){
	var form = document.form_b;
	self.parent.window.location = location;
}





//Logon script for Commercial
function validateLogonC( host ) {

	var userid 		= document.form_c.USERID.value;
	
	if ( userid.length == 0 ) {
		alert( "In order to access First National Bank Omaha Online, please enter your User ID and click Log In." );
		document.form_c.USERID.select();
		document.form_c.USERID.focus();
	}
	else {
		document.form_c.action = "https://" + host + "/IBWS/checkUser.do?action=userName"
		document.form_c.submit();
	}
}
function forceAlphaNumeric(e,textObject) {
			
	        var charCode = (navigator.appName == "Netscape")?e.which:e.keyCode;
	        var targetElement = (navigator.appName == "Netscape")?e.target:e.srcElement;

		// NS 6.0 weirdness
		if ((charCode==0)&&(e.keyCode > 0)) {
			charCode = e.keyCode;
		}

	        var aChar = String.fromCharCode(charCode);
	
	        var myCriteria = /[0-9]/gi;
	        var myMatch = aChar.match(myCriteria);
	        if (myMatch != null){return charCode;}
	
	        var myCriteria = /[a-z]/gi;
	        var myMatch = aChar.match(myCriteria);
	        if (myMatch != null){return charCode;}
	
	        if(charCode==8){return charCode;}
	        if(charCode==9){return charCode;}
	        if(charCode==13){
		if (targetElement==document.form_c.USERID){
			document.form_c.submit();
		}
	}
	return false;
}
function go(location){
	var form = document.form_c;
	self.parent.window.location = location;
}





//Logon script for Other
var logonURL = new Array();	//logon URLS business
	logonURL[0] = "javascript:getSSLOpen('/IBWS/Redirector.do');"
	logonURL[2] = "javascript:popWin('https://www.merchantsummary.com/fnmsonline/fnms_ms_login.asp','750','550');"
	logonURL[3] = "javascript:popWin('https://www.firstinfocenter.com','800','600');"					
	logonURL[4] = "javascript:popWin('https://www.1sttools.com/loginout/login.asp','750','550');"
	logonURL[5] = "/001/html/en/personal/sidebar_assets/wmhsa_login.html"
	logonURL[7] = "javascript:popWin('http://www.firstnationalinvestmentsandplanning.com','800','600');"
	logonURL[8] = "javascript:siteDisclosure('affiliate', 'First National Bank Omaha', 'Investment Gold Online', 'https://www.investmentgoldonline.com/default.asp', 'yes');"
	logonURL[10] = "javascript:popWin('https://www.account3000.com/trust/TFALogin.asp','750','550');"
	logonURL[12] = "javascript:popWin('https://receipts.fnbomaha.com/CBXOnline/Scripts/DailyDeposits.asp','800','600');"
	logonURL[13] = "javascript:siteDisclosure('nonaffiliate', 'First National Bank Omaha', 'First Focus Funds', 'https://www3.financialtrans.com/tf/FANWeb?tx=Disclaim&cz=a05081718190514022018', 'yes');"
	
var enrollURL = new Array();//Enroll URLS business
	enrollURL[0] = "javascript:getSSLOpen('/IBWS/enrollNew.do');"

var demoURL = new Array();//Demo URLS business
	demoURL[0] = "javascript:getSSLOpen('/IBWS/demo.do');"
	demoURL[12] = "javascript:popWin('https://receipts.fnbomaha.com/CBXDemo/demo/welcome_demo.html','750','550');"
	
if (document.images) {
	
	demo_on = new Image();		demo_on.src = "/config/html/en/theme/btn_demo_grey.gif";
	demo_off = new Image();		demo_off.src = "/config/html/en/theme/btn_demo_grey_off.gif";
	enroll_on = new Image();	enroll_on.src = "/config/html/en/theme/btn_enroll_grey.gif";
	enroll_off = new Image();	enroll_off.src = "/config/html/en/theme/btn_enroll_grey_off.gif";
	logon_on = new Image();		logon_on.src = "/config/html/en/theme/btn_logon_grey.gif";
	logon_off = new Image();	logon_off.src = "/config/html/en/theme/btn_logon_grey_off.gif";
}
	
function buttonState(obj, name) {
	var index = obj.options[obj.selectedIndex].value;
	var suffix = "_on.src";
	var button;

	switch( name ) {
		case "demo":
			button = demoURL[index]
			break;
		case "enroll":
			button = enrollURL[index]
			break;
		case "logon":
			button = logonURL[index]
			break;
	}
	if ( button == null ) {
		suffix =  "_off.src";
	}
	document[name].src = eval(name + suffix);
}

function buttonPressed(obj, name) {
	var index = obj.options[obj.selectedIndex].value;
	var documentlocation;
	
	switch( name ) {
		case "demo":
			documentlocation = demoURL[index]
			break;
		case "enroll":
			documentlocation = enrollURL[index]
			break;
		case "logon":
			documentlocation = logonURL[index]
			break;
	}
	if (documentlocation == null) {
		documentlocation = "#";
	}
	window.location = documentlocation	
}

function popup(me){
window.open(me,"popup")
}

function init() {
	demoVisr(document.form1.select);
	enrollVisr(document.form1.select);
	logonVisr(document.form1.select);	
}

function submitForm(){
	document.form.submit();
}





//Log In Display
var ids=new Array('personal','business','commercial','other');

function switchid(id){	
	var isHidden;
	if (document.getElementById(id).className == 'closed'){
		isHidden = true;
	} else {
		isHidden = false;
	}
	
	if (isHidden) {
		hideallids();
		showdiv(id);
	} else {
		hideallids();
	}
}
function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}
function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'closed';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.className = 'closed';
		}
		else { // IE 4
			document.all.id.className = 'closed';
		}
	}
}
function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'open';
		if (id == 'business') {
			document.form_b.USERID.focus();
		}
		else if (id == 'personal') {
			document.form_p.j_username.focus();
		}
		else if (id == 'commercial') {
			document.form_c.USERID.focus();
		}
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.className = 'open';
			if (id == 'business') {
				document.form_b.USERID.focus();
			}
			else if (id == 'personal') {
				document.form_p.j_username.focus();
			}
			else if (id == 'commercial') {
				document.form_c.USERID.focus();
			}
		}
		else { // IE 4
			document.all.id.className = 'open';
			if (id == 'business') {
				document.form_b.USERID.focus();
			}
			else if (id == 'personal') {
				document.form_p.j_username.focus();
			}
			else if (id == 'commercial') {
				document.form_c.USERID.focus();
			}
		}
	}
}