if (Event) {
	Event.onDOMReady(function() {
		var lnks = $$("a");
		lnks.each(function(a, index) {
			var href = a.readAttribute('href');
			
			// Check if the a tag has a href, if not, stop for the current link
			if ( href == undefined ) return;
			
			var url = href.replace('http://','').replace('https://','');
			var hrefArray = href.split('.').reverse();
			var extension = hrefArray[0].toLowerCase();
			var hrefArray = href.split('/').reverse();
			var domain = hrefArray[2];
			
			// If the link is external
			if ( ( href.match(/^http/) ) && ( !href.match(document.domain) ) && (_gaq)) {
				// Add the tracking code
				Event.observe(a, 'mousedown', function() {
					_gaq.push(['_trackEvent', 'Outbound Traffic', href.match(/:\/\/(.[^/]+)/)[1], href]);
				});
			}
		});
	});
}
