var undefined;

function LaunchCalc(myURL)
	{
	myBase = "https://gateway.fundsxpress.com/calculators/";
	window.open(myBase + myURL,'','width=585,height=450,scrollbars=yes,resizable=yes');
	}
	
function LinkAlert(URL, type)
	{
	BANKNAME = "Crossroads Bank";
	type = (type=="" || type==undefined) ? "link" : "email";
	MSG = Array();
	MSG['link'] =	"You are now leaving "+BANKNAME+"'s website and will be redirected to another site. "+BANKNAME+" makes no endorsement or claims about the accuracy or content of information contained within  third party sites to which you may be going. The security and privacy policies on these sites may be different from "+BANKNAME+".";
	MSG['email'] = 	"Notice: Because there is a small risk that information transmitted via Internet email could fall into the wrong hands, we suggest that confidential information, such as account numbers or social security numbers, not be transmitted via email. Instead, please contact us directly at your nearest bank branch. Thank you.";
	
	if (URL!=="" && URL!=undefined) 
		{
		if (confirm(MSG[type])) window.open(URL,"_blank");
		}
	else return confirm(MSG[type]);
	}

function email(address, domain, text){
  	mailto_address = address + "@" + domain;
	link_text = (text=="" || text==undefined) ? mailto_address : text;
	document.write('<a href="mailto:' + mailto_address + '" onClick="return LinkAlert(\'\',\'email\');">' + link_text + '</a>');
  	return false;
	}
	
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;