var undefined;
BANKNAME = "Community State Bank";

function LaunchCalc(myURL)
	{
	myBase = "https://gateway.fundsxpress.com/calculators/";
	window.open(myBase + myURL,'','width=585,height=450,scrollbars=yes,resizable=yes');
	}

function Calculator(myURL) {
	LaunchCalc(myURL)
	}
	
function LinkAlert(URL)
	{
	
	MSG =       "You are now leaving the "+BANKNAME+" 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+".";
	
	if (URL!=undefined) 
		{
		if (confirm(MSG)) window.open(URL,"_blank");
		}
	else return confirm(MSG);
	}

function EmailAlert() {
	msg = "This email is not secure. DO NOT send sensitive personal or financial information such as account numbers, SSN, or PIN numbers usign this email. To send us a secure message, please log in to Online banking and send us a message from there.";
	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, subject) {
    var s = "";
    if (link_string=="" || link_string==undefined) link_string = make_address(user, domain);
    if (subject!="" && subject!=undefined) s = "?subject=" + subject ;
	
    document.write ("<a href=mailto:" + make_address(user, domain) + s + " onClick='return EmailAlert();'>" + link_string + "</a>"); 
  	}

function make_address(user,domain) {
    return user + "@" + domain;
    }


// 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;
