// JavaScript Document

var undefined;



function LinkAlert(URL,target)

	{

	BankName = "The Twin Valley Bank"
	MSG =        BankName + " web site provides links to other web sites ";
	MSG = MSG + "for convenience and informational purposes only. Users should ";
	MSG = MSG + "be aware that when you select a link on the " + BankName + "'s web ";
	MSG = MSG + "site to an external web site, they are leaving " + BankName + "'s site. ";
	MSG = MSG + "\n\n";
	MSG = MSG + "Linked sites are not under the control of " + BankName + ". ";
	MSG = MSG + BankName + " is not responsible for the contents of any linked site ";
	MSG = MSG + "or any link contained in a linked site, or any changes or updates ";
	MSG = MSG + "to such sites. The inclusion of a link does not imply endorsement ";
	MSG = MSG + "by " + BankName + " of the site, its content, advertisers or sponsors. ";
	MSG = MSG + "External sites may contain information that is copyrighted with ";
	MSG = MSG + "restrictions on reuse. Permission to use copyrighted materials must ";
	MSG = MSG + "be obtained from the original source and cannot be obtained ";
	MSG = MSG + "from " + BankName + ".";
	
	myTarget = "_blank";
	if (target!=undefined) myTarget = target;
	if (confirm(MSG)) {
		if (confirm("Are you sure you want to leave The Twin Valley Bank's Website?")) window.open(URL,myTarget);
		}
	}

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 "";
    }
  }
