﻿function CatchExtUrl() {
	//this.TransUrl = "/Service/transUrl.aspx?";		// controls whether or not Flash objects should be hidden
	this.initialize();
}

CatchExtUrl.prototype.initialize = function() {
	this.updateCatchExtUrlItems();
};

CatchExtUrl.prototype.updateCatchExtUrlItems = function() {	
	// populate array of anchors from the appropriate window (could be the parent or iframe document)
	var anchors = document.getElementsByTagName('a');

	// loop through all anchor tags
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute('href')) {
			if ( 
				(anchor.getAttribute('href').toLowerCase().indexOf('http://')==0 && anchor.getAttribute('href').toLowerCase().indexOf( window.location.href.replace('http://','').replace('https://','').substring(0,window.location.href.replace('http://','').replace('https://','').indexOf('/')))<0)
				|| 
				(anchor.getAttribute('href').toLowerCase().indexOf('https://')==0 && anchor.getAttribute('href').toLowerCase().indexOf(window.location.href.replace('http://','').replace('https://','').substring(0,window.location.href.replace('http://','').replace('https://','').indexOf('/')))<0)
				) { // add a single frame page to frameArray
				anchor.onclick = function () { myCatchExtUrl.start(this); return false; }
			}
		}
	}
};

CatchExtUrl.prototype.start = function(anchorLink) {
	SetObjTrace(anchorLink.getAttribute('href'));
	//alert(anchorLink.getAttribute('href'));
};

