<!--
/********************************************************/
/*  GLOBAL VARIABLE										*/
/********************************************************/

var variables = {};

function $(id) {
	return document.getElementById(id);
}
/********************************************************/
/*  CUSTOM ERROR TRACING								*/
/********************************************************/

function trace(txt, option, func) {
	//func = func || arguments.caller;
	if (func) { txt = func + ': ' + txt; }
	
	option = option || 0;
	if (option == 0) {
		var elTxt = document.createTextNode(txt);
		var elDiv = document.createElement('div');
			elDiv.appendChild(elTxt);
		document.body.appendChild(elDiv);
	}
	
	if (option == 1) { alert(txt); }
}

function addEvent(obj, eventName, fn) {
	var _obj = obj;
	if (_obj) {
		if (_obj.addEventListener) _obj.addEventListener(eventName, fn, false);
		else _obj.attachEvent('on' + eventName, function(e) { fn.call(_obj, e) } );
	}
}

function empty(obj) { while(obj.childNodes.length > 0){ obj.removeChild(obj.lastChild); } }

//-->
