if (typeof addEvent != 'function') {
	function addEvent(object, event, fn) {
		if (object.addEventListener){
			object.addEventListener(event, fn, false);
			return true;
		} else if (object.attachEvent){
			var r = object.attachEvent("on" + event, fn);
			return r;
		} else {
			return false;
		}
	}
}

addEvent(window, "load", auditInit);
_uacct = "UA-2906607-6";
urchinTracker();

function auditInit() {

	var y = document.getElementById('addshoppinglistlink');
	if (y) {
		y.setAttribute('clickaudit', '/interaction/addshoppinglist');
	}
		
	var y = document.getElementsByTagName('*');
	for (var i=0; i<y.length; i++) {
		if (y[i].tagName == 'SPAN') {
			if (y[i].className) {
				var classPieces = y[i].className.split("=");
				if (classPieces[0] == 'audit' && classPieces[1]) {
					y[i].onclick = function () { return true; }
					if (y[i].getAttribute('set') == '1') {
						audit(classPieces[1], 1);
					}
					else {
						audit(classPieces[1], 0);
					}
				}
			}
		}
		if (y[i].tagName == 'AUDIT') {
			if (y[i].getAttribute('set') == '1') {
				audit(y[i].getAttribute('string'), 1);
			}
			else {
				audit(y[i].getAttribute('string'), 0);
			}
		}
		if (y[i].getAttribute('clickaudit')) {
			if (!y[i].onclick) {
				y[i].onclick = _clickaudit;
			}
			/*
			else {
				var old = (y[i].onclick) ? y[i].onclick : function () {};
				y[i].onclick = function () { alert('test'); _clickaudit(y[i]); old(); };
			}
			// addEvent(y[i], "click", _clickaudit);
			*/
		}
		if (y[i].className) {
			var classPieces = y[i].className.split("=");
			if (classPieces[0] == 'clickaudit' && classPieces[1]) {
				y[i].setAttribute('clickaudit', classPieces[1]);
				y[i].onclick = _clickaudit;
			}
		}
	}

}

function _clickaudit() {

	var auditstring = this.getAttribute('clickaudit');
	if (auditstring) {
		audit(auditstring);
		return true;
	}
	
	return false;
}

function audit(auditstring, sett) {

	if (auditstring) {
		// alert('audit ' + auditstring);
		if (sett == 1) {
			__utmSetVar(auditstring);
		}
		else {
			urchinTracker(auditstring);
		}
		return true;
	}
	
	return false;
}