var undefined;

function Calculator(myURL)
	{
	myBase = "https://gateway.fundsxpress.com/calculators/";
	window.open(myBase + myURL,'','width=585,height=450,scrollbars=yes,resizable=yes');
	}
	
function LinkAlert(URL,target,attributes)
	{
	BANKNAME = "Citizens Bank and Trust";
	MSG =       "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+".";

	attributes = (attributes!=undefined) ? attributes : "scrollbars=1,resizable=1";
	target = (target!=undefined) ? target : "_blank";
	if (URL!=undefined) 
		{
		if (confirm(MSG)) window.open(URL,target, attributes);
		}
	else return confirm(MSG);
	}


function PDF(URL,target,attributes)
	{
	BANKNAME = "Citizens Bank and Trust";
	MSG =       "The following link is to an Adobe PDF file. Please enable pop-ups on your browser in order to view this file in a new window.";

	target = (target!=undefined) ? target : "_blank";
	if (URL!=undefined) 
		{
		if (confirm(MSG)) window.open(URL,target, attributes);
		}
	else return confirm(MSG);
	}	

function EmailAlert(num) {
	num = (num==undefined) ? 0 : num;
	msg = new Array();
	// default message
	msg.push('This email address is NOT secure. DO NOT send sensitive personal or financial information such as account numbers, SSN, or PIN numbers using this email. Please log in to Online Banking and use the secure messaging system to send us a secure email.');
	// message 1
	msg.push('NOTICE: DO NOT send confidential information via email. Email is not a secure mode of delivery of sensitive information.');
	// message 2
	msg.push('Please DO NOT transmit any confidential information via this e-mail address.  When sending confidential information, please transmit via secure e-mail after logging into your online banking account.');
	
	return confirm(msg[num]);
	}
	
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;
