// JavaScript Document<script>

// List of domains or addresses that do not need the pop-up separated by semi-colons
var strDomainFilters = "cngefcu.org;cngefcu.com;http://www.creditunionwebsites4.com;https://www.cusa-hfs.com/hfs/svc/cngefcu;http://216.128.15.110";
var strMessage = "You are leaving the CNG Employees FCU Website.\n\nThe website you are linking to is not operated by CNG Employees FCU.\n\nWe are not responsible for any content or information posted to this external web site.\n\nCNG Employees FCU is not responsible for, nor do we represent you or the External web site if you enter into any agreements.\n\nPrivacy and Security policies may differ between our web site and this external site.";
// Do not edit below this point

var nav4 = window.Event ? true : false;

function processClicks(e) {
	// Grab the Source Element based on browser type
  if (nav4) 
	{
    var srcElem = e.target
  } 
	else 
	{
    var srcElem = event.srcElement
  }
	
	// Code to Check for linked images
	if(srcElem.tagName == "IMG")
	{
		srcElem = srcElem.parentElement;
	}
	
	// If this clicked object is a link of some sort check the URL against the Domain Filters
	if(srcElem.tagName == "A")
	{
		var strURL = srcElem.href;
		// Make sure this an external link, internal links are ok by default
		if(strURL.indexOf("http:") > -1 || strURL.indexOf("https:") > -1)
		{
			// Setup variables; by default we'll show the message unless the url contains one of the filters
			var bShowAlert = true;
			var i = 0
			// Create an array of filters
			var arrDomainFilters = strDomainFilters.split(";");
			// Loop through filters and check against the URL
			for(i=0; i<arrDomainFilters.length;i++)
			{
				// if the filter is in the URL, we will NOT show the Message
				if(strURL.indexOf(arrDomainFilters[i]) != -1)
					bShowAlert = false;
			}
			// If the message is determined to be displayed, display it
			if(bShowAlert)
				alert(strMessage);
		}
	}	
}

// trap the click even based on browser type
if (nav4)
  document.captureEvents(Event.CLICK);
document.onclick = processClicks;

// function to open external links w/ the alert message
function openExtLink(strURL, strTarget)
{
	alert(strMessage);
	window.open(strURL, strTarget);
}
