// JavaScript Document

var undefined;



function LinkAlert(URL,target,type) {

	BankName = "The Riley State Bank of Riley"
	MSG = new Array();
	MSG[0] = "You are now leaving the " + BankName + " web site. Neither " + BankName + " nor any of its subsidiaries or affiliates are responsible for the content of any external web site.";
	
	myTarget = "_blank";
	if (target!=undefined) myTarget = target;
	if (type!="" && type!=undefined) alert(MSG[type]);
	else if (confirm(MSG[0])) window.open(URL,myTarget);
	}

function EmailAlert() {
	msg = "This email address is not secure. DO NOT send sensitive personal or financial information such as account numbers, SSN or PIN numbers using this address. If you need to send the bank a secure message, please log in to Internet banking and use the secure message tool there.";
	return(confirm(msg));
	}

function LaunchCalc(URL) {
	window.open (URL,'myCalculator','width=580,height=450');
	}

function newWindow() {
	window.open("","launch","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=400");
	}

function isValidEmail(parmValue) {
	var rex = new RegExp("^[\\w\\+-]+(\\.[\\w\\+-]+)?@((\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\|([\\w\\+-]+\\.[a-zA-Z]{2,}))$");
	var pos = parmValue.search(rex);
	if (pos < 0) {
		return false;
		} 
	else {
		return true;
		}
	}

function mail(link_string,user,domain,nickname,subject) {
    var nn = "";
    var s = "";

    if (nickname != "") nn = nickname + " ";
	else  nn = make_nickname(link_string);
    if (subject != "") s = "?subject=" + subject ;
    document.write(link_string.link(make_href(user,domain,nn,s)));
  }
 
function make_href(user,domain,nickname,subject) {
    address = "mail" + "to" + ":" + nickname + make_address(user,domain);
	if (subject!=undefined) address = address + subject;
	return address;
    }

function make_address(user,domain) {
    return "&lt;" + user + "@" + domain + "&gt;" ;
    }

function make_nickname(link_string) {
    var names = link_string.split(",");
    if (names.length == 2) {
      return names[1] + " " + names[0] + " ";
    } else {
      return "";
    }
  }


// This layer finds an object by ID and is cross-browser compliant.

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}

