var LinkoutPath = 'dpg/';  // Path to out.php

// generic cross-browser add event function
function addEvent(obj, evType, fn){
        if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
        } else if (obj.attachEvent){
                var r = obj.attachEvent('on'+evType, fn);
                return r;
        } else {
                return false;
        }
}

// init the tracking code and add a listener to all links with a numeric ID
function trackInit() {
	var links = document.getElementsByTagName('a');
	for (var i = 0; i < links.length; i++)
		if (links[i].id.match(/^\d/)) links[i].onclick = track;
}

// report clicks
function track() {

	var trackImg = new Image();
	trackImg.src = LinkoutPath+'out.php?id='+this.id;

}

addEvent(window,'load', trackInit);
