
var uri = document.location.href;
var newUri = false;
if (uri.indexOf('dig')<0){
	if (window.secure)
	{
		/* make sure we're at https: */
		if(/^http:/.test(uri)){
			uri = uri.replace(/^http/,'https');
			newUri = true;
		}
		/* make sure the 'www' is there */
		if(!/^https:\/\/www\./.test(uri)){
			uri = uri.replace(/^https:\/\//,'https://www.');
			newUri = true;
		}
	}
	else
	{
		/* make sure we're at http: */
		if(/^https:/.test(uri)){
			uri = uri.replace(/^https/,'http');
			newUri = true;
		}
		/* make sure the 'www' is there */
		if(!/^http:\/\/www\./.test(uri)){
			uri = uri.replace(/^http:\/\//,'http://www.');
			newUri = true;
		}
	}
}	
	/* redirect */
	if(newUri) document.location.replace(uri);

/*****************************************************
*	External Link Function
*****************************************************/

function ext_link(url)
{
	var x=window.confirm("You are now leaving the secure website of E1 Financial Credit Union (E1). The website you are about to access is not owned or operated by E1 and we are not responsible for its content. Be aware that the privacy and security policies of third-party websites may differ from those practiced by E1. If you did not mean to leave our website, please click 'Cancel' now.  If you wish to continue to the next website, click 'OK'. Thank you for visiting E1 Financial Credit Union's website.");
	if (x) window.open(url);
}


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") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;
