if(typeof jQuery == 'function') { /* use jQuery if it exists because it is a more elegant solution */
	jQuery(function () {
		jQuery('a:not([href*="' + document.domain + '"])').click(function () {
			if(jQuery(this).attr('href')[0] != '/') {
				_gaq.push(['_trackPageview', ('/outgoing/' + jQuery(this).attr('href'))]);
			}
		});
	});
}
else { /* use regular Javascript if jQuery does not exist */
	window.onload = function () {
		var links = document.getElementsByTagName('a');
		for (var x=0; x < links.length; x++) {
			links[x].onclick = function () {
				var mydomain = new RegExp(document.domain, 'i');
				if(!mydomain.test(this.getAttribute('href'))) {
					_gaq.push(['_trackPageview', ('/outgoing/' + this.getAttribute('href'))]);
				}
			};
		}
	};
}
