function addLinkTracking()
{
    var makeLinkCallback = function(url) {
	return function(event) {
//	    if (!window.confirm("You are about to leave this site and visit: " + url))
//		event.preventDefault();
	    pageTracker._trackPageview('/outgoing?' + url);
	};
    };

    // if a link matches this, we don't add onclick (NB, will pick up mailto:s)
    hostRE = new RegExp("^(https?|ftp)://"+window.location.host+"/");
    for (var i=0; i<document.links.length; i++) {
	var a = document.links[i];
	if (a.href && ! a.onclick && ! hostRE.test(a.href)) {
	    // Must use a helper function to get separate closures for a.href
	    a.onclick = makeLinkCallback(a.href);
	}
    }
}

addLinkTracking();
