function trace(msg) {

	// return false;

	if ( typeof debug != 'undefined') {
		if (debug==0) {
			return false;
		}
	}
	$debug = $("debug");
	if (!$debug) {
		$body = $(document.body);
		$body.insert("<div id='debug' style='position: absolute; z-index: 999; top: 0px; right: 0px; width: 20%; height: 800px; opacity:.8; background-color: #fff; color: #000; overflow:scroll;'><p style='font-size: 14px; font-weight: bold; font-family: arial;'><a href='#' onclick='clearTrace();'>clear</a></p></div>");
		$debug = $("debug");
	}
	$debug.insert(msg+"<br />");
}

function enumerate(obj) {
	var output = ""; 
	for (var prop in obj) {
		output += prop+": "+obj[prop]+"<br />";
	}
	return output;
}

function clearTrace() {
	$debug = $("debug");
	$debug.update("<p style='font-size: 14px; font-weight: bold; font-family: arial;'><a href='#' onclick='clearTrace();'>clear</a></p>");
	return false;
}
