var linksToTrack = new Object();

// Add the links you want to track here, in the format:
// linksToTrack['actual link on the page'] = 'link to the tracking url';

// linksToTrack['http://www.cuntlet.com/'] = 'massage/b';



function stopEvent(e) {
	// from http://www.openjs.com/articles/prevent_default_action/
	if (!e) var e = window.event;
	e.cancelBubble = true;
	e.returnValue = false;
	if (e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
	}
	return false;
}

function createTrackingOnClickFn(actualLink) {
	return function(e) {
		stopEvent(e);
		document.location.href = linksToTrack[actualLink.href];
		return false;
	};
}

function configureTracking() {
	var linksInDocument = document.getElementsByTagName('a');
	for (var i = 0, n = linksInDocument.length; i < n; i++) {
		if (linksToTrack[linksInDocument[i].href]) {
			var linkToTrack = linksInDocument[i];
			linkToTrack.onclick = createTrackingOnClickFn(linkToTrack);
		}
	}
}

// Now the stuff to trigger the call to configureTracking when the page has 
// loaded

// Works in Firefox
if (document.addEventListener) {
   document.addEventListener("DOMContentLoaded", configureTracking, null);
}

// Works in IE
/*@cc_on @*/
/*@if (@_win32)
   document.write("<script defer src=\"onload-ie.js\"><"+"/script>");
/*@end @*/

// Last resort, for if neither of the above two triggers work
window.onload = configureTracking;