// Click Stack
var errorH = {
	stack: [],
	ini: function() {
		document.body.onclick = errorH.h;
	},
	h: function(e) {
		var o;
		if (!e) {
			e = window.event;
			o = e.srcElement;
		} else  o = e.target;
		if (errorH.stack.length > 10) errorH.stack.shift();
		errorH.stack.push(o.id === '' ? o : o.id);
	},
	normalize: function() {
		var i=0, s=errorH.stack, so=s.length, res=[], o, tmp, k, e;
		for(; i < so; i++) {
			if (typeof s[i] === 'string') {
				res[i] = '#'+ s[i];
				continue;
			}
			o = s[i];
			tmp = [];
			while (o && o.parentNode && o.tagName !== 'BODY') {
				if (o.tagName === 'TBODY') {
					o = o.parentNode;
					continue;
				}
				for (k = 0, e = o; e = e.previousSibling; e.tagName ? k++ : null);
				tmp.push(o.tagName + (k ? '-'+ k : ''));
				o = o.parentNode;
			}
			res[i] = tmp.join('>');
		}
		return res;
	}
};

window.onload = errorH.ini;
// Error reporting
var firsterror = true;
window.onerror = function(msg, url, line) {
	if (!firsterror) return;
	firsterror = false;
	setTimeout(function (msg, url, line) { document.body.appendChild(document.createElement("SCRIPT")).src = "/cms/ajax/register.javascript.error.php?msg="+ encodeURIComponent(msg) +"&url="+ encodeURIComponent(url) +"&line="+ encodeURIComponent(line) +"&stack="+ encodeURIComponent(errorH.normalize()); }, 1000, msg, url, line);
}