function gaXtras(options) {
	/* 
		------- gaXtras -------
			about:
				- an extra set of tools to be used with Google Analytics for tracking of mailto links, outbound links, and download links (tracked as Events)
				- customizeable list of file extensions to track as downloads (using pipe separated extension list)
				- customizeable delay between click and link firing (to allow more or less time for event to be tracked)						
			example usage:
				- default options	 			window.onload = gaXtras();
				- override extension list		window.onload = gaXtras({dl_regex:'doc|pdf|zip'})
				- override timeout 				window.onload = gaXtras({timeout:200})
			note:
				- this will work with both the new/asynchronous (_gaq) and old (pageTracker) variations of Google Analytics
	*/
	
	options = init(options);

	function init(options) {
		// override defaults
		var defaults = {
			dl_regex:'doc|eps|jpg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3',
			timeout:500
		}
		for (attrname in options) { 
			defaults[attrname] = options[attrname]; 
		}
		defaults.dl_regex = new RegExp('\\.(' + defaults.dl_regex + ')$','i');
		options = defaults;
		// add click listeners
		var i, a, as = document.getElementsByTagName('a');
		for (i = 0; i < as.length; i++) {
			a = as[i];
			if (a.protocol.match(/mailto:|https:|http:/) && (a.hostname !== location.host || a.pathname.match(options.dl_regex))) {
				addListener(a,'click',trackLink);
			}
		}
		// determine which tracker to use
		if (_gaq) {
			trackIt = function(catg,act) {
				_gaq.push(['_trackEvent', catg, act]);
			}
		} else if (pageTracker) {
			trackIt = function(catg,act) {
				pageTracker.trackEvent(catg,act);
			}
		}
		return options;
	}
	function addListener(obj,e,fn) {
		// if browser supports event listener, use that, otherwise just use onclick
		if (obj.addEventListener) {
			obj.addEventListener(e,fn,false);
		} else if (obj.attachEvent) {
			obj.attachEvent('on' + e,fn);
		}
	}
	function trackLink(e) {
		// evaluate element and track as email, outbound link, or download
		if (!e) {
			e = window.event;
		}
		var a = (e.srcElement) ? e.srcElement : this;
		while (a.tagName !== 'A') {
			a = a.parentNode;
		}
		var catg, msg;
		if (a.protocol === 'mailto:') {
			catg = 'Email';
			act = a.href.substring(7);
		} else if (a.hostname !== location.host) {
			catg = 'Outbound Link';
			act = a.href;
			var target = a.target;
		} else if (a.pathname.match(options.dl_regex)) {
			catg = 'Download';
			act = a.href;
		}
		if (catg) {
			if (e.preventDefault) {
				e.preventDefault();
			}
			// track event
			trackIt(catg,act);
			// delay the link to allow time for tracking
			if (target === "_blank") {
				setTimeout(window.open('\ + a.href + \'),options.timeout);
				return false;
			} else {
				setTimeout('window.location = "' + a.href + '";',options.timeout);
				return false;
			}
		}
	}
}
