
DebugUtil = new Object();

DebugUtil.debug = function (arg) {
	var debugWin = window.open('','debug','dependent=yes,innerWidth=200,innerHeight=400,scrollbars=yes,location=no,menubar=no,resizable=yes');
	var debugDoc = debugWin.document;
	debugDoc.write('<pre>-------------------------------------------------------------------\n');
	var argType = typeof arg;
	debugDoc.writeln(argType+':');
	if(argType == 'string' || argType == 'number') {
		debugDoc.write(arg);
	} else if(argType == 'array') {
		debugDoc.writeln(arg.join(","));
	} else if (argType == 'object') {
		for (var i in arg ) {
			try {
				debugDoc.writeln('['+ i + ']=' + arg[i]);
			} catch (e) {
				debugDoc.writeln('Error: '+e);
			}
		}
	} else if (argType == 'boolean') {
		debugDoc.write(arg ? 'true' : 'false');
	}
	debugDoc.write('<\/pre>');
}

