var undefined;

function Calculator(myURL)
	{
	myBase = "http://gateway.fundsxpress.com/calculators/";
	window.open(myBase + myURL,'','width=585,height=450,scrollbars=yes,resizable=yes');
	}
	
function LinkAlert(URL)
	{
	BANK_NAME = "The National Bank of Adams County";
	MSG = "The contents of external links within The National Bank of Adams County's website do not represent the bank, and the bank may not be held liable for any content in those links.";
	if (URL!=undefined) 
		{
		if (confirm(MSG)) window.open(URL,"_blank");
		}
	else return confirm(MSG);
	}
	
function SearchSite(URL)
	{
	myQuery = document.f.NewQuery.value;
	UpdateQuery = myQuery + " site:"+URL;
	document.f.q.value = UpdateQuery;
	}

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 function loops through all the hyperlinks in a document and assigns
// the LinkAlert function to each weather.com link as an event handler.  Don't call it
// before the document is parsed and the links are all defined.  It is best
// to call it from the onload event handler of a <body> tag.
function confirmAllLinks() {
  for(var i = 0; i < document.links.length; i++) {
    this_href = document.links[i].href;
	if (this_href.indexOf("weather.com")>0) {
		document.links[i].href = "javascript:LinkAlert('"+this_href+"');"
		//document.links[i].onclick = confirmLink;
		document.links[i].target = "_self";
	}
  }
}


window.onload = confirmAllLinks;