// EMAIL LINKS HANDLER
// Open status message onclick event for email addresses,
// if user clicks "Confirm", then proceed to email.
function confirmExit(url) {
	var retString = "Please realize contacting the bank via email is not secure and is not encrypted." + '\n\n' + "Please do not send account numbers, social security numbers, passwords or other sensitive information via email.  If you need to discuss something of a private nature, please call us at (507) 793-2334. Thank you." + '\n\n' + "To proceed with sending your email, please click 'Ok'.";
	var answer = confirm (retString);
	if (answer) {
		window.open(url, null,"");
	}
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "email") {
			anchor.setAttribute("href", "javascript:confirmExit('" + anchor.getAttribute("href") + "');" );
			//anchor.onclick = confirmExit;
		}
		//anchor.title += anchor.title ? " (Opens in a new window)" : "Opens in a new window";

	}
}

window.onload = externalLinks;
