
// Only links written to the page (already in the DOM) will be tagged
// Script can be called multiple times. First written Mar-2007
// bug corrected to handle existing onclick events and append correctly

function addLinkerEvents() {
	var as = document.getElementsByTagName("a");
	var extTrack = ["aaai.org"];

	for(var i=0; i<as.length; i++) {
		var tmp = as[i].getAttribute("onclick");

		// Tracking links off site - no GATC
		
		if (as[i].href.indexOf(extTrack[0]) == -1 && as[i].href != "") {
			//alert("adding onclick to: " + as[i].href);
			as[i].setAttribute("onclick",((tmp != null) ? tmp+";" : "javascript: ") + "new Image().src = 'http://www.aaai.org/AITopics/pmwiki/track_click.php?href=" + as[i].href + "';");
			//alert(as[i].href)
		}
		

	}

}
