﻿if (document.addEventListener) 
{
	document.addEventListener("DOMContentLoaded", aE, null); // Firefox
} 
else 
{
	aE(); // IE : Call  function immediately, the script is referenced with the defer attribute supported by IE
}

function aE()
{
	// quit if this function has already been called
	if (arguments.callee.done) return;
	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
	for (i=0; i <document.links.length; i++)
	{
		var x = document.links[i];
		// Only attach tracking code to specific file types
		var extensions = new RegExp(".+\.(zip|pdf|xls|doc|csv|txt|ppt|xml|rtf|uk|asp)$");
		var doc = x.href.toLowerCase().match(extensions);
		if (doc)
		{
			if (x.attachEvent)
			{
	  		x.attachEvent('onclick', function () {Ti(window.event.srcElement)}); // IE
			} 
			else 
		  {
   			x.addEventListener('click', function () {Ti(this)}, false); // Firefox
			}
		}
	
	}
}

function Ti(link)
{
// Remove the conversion to Lowercase if you are on a Case sensitive web server
urchinTracker(link.href.toLowerCase());
}