
function PopUpSafeLinks(){
	var allAs, cIndex
	if(document.getElementsByTagName) { //DOM compatible
		allAs = document.getElementsByTagName('A');
	} else return false; //fail otherwise don't do more work

	//made it this far lets do some work
	this.pLinks = new Array()
	cIndex = 0;
	for(var i = 0; i < allAs.length; i++) { //Loop through all links in the document
		if( allAs[i].target != ''){ //Get everything set to popup in a new window
			this.pLinks[cIndex++] = allAs[i]; //NOTE: post-increment here [retrieve value and increment afterwards]
		}//if 
	}//for

	this.init = InitializePUSL;
}//function PopUpSafeLinks

function InitializePUSL () {
	if(this.pLinks) {
		for(var i=0; i < this.pLinks.length; i++) {
			this.pLinks[i].onclick = function() { return PopWin(this.href, this.target); }
		}//for
	}//if
}

function PopWin(url, name) {
	var wini;
	wini = window.open(url,name,'');
	if ( !wini ) { //popup failed 
		alert("NOTE: This link has been blocked by a Pop-up blocker. To continue you will need to either disable the Pop-up blocker, or relax its settings. Click \'OK\' to continue...")
	}
	else {
		wini.focus();
	}
	return ( !wini )
}// PopWin()

var PUSL = new PopUpSafeLinks();
PUSL.init();
