/*****************************************************************/
/**** trace window *****/
/*****************************************************************/
var tracecount = 0;
var opener = new Object();
function trace(msg, options){
	if(! options)
	options = new Object();
	tracecount++;
	if(options){
		width = options.width ? options.width:300;
		height = options.height ? options.height:300;
		scrollbars = options.scrollbars ? options.scrollbars:1;
		resizable = options.resizable ? options.resizable:1;
		windowname = options.windowname ? options.windowname:'tracewindow';
		left = options.left ? options.left: (screen.width  - width)/2;
 		top = options.top ? options.top: (screen.height - height)/2;

	}
	if(! opener.document){
		var title = (new Date()).toGMTString();
		opener = window.open('', windowname,'toolbar=0,scrollbars='+scrollbars+',location=0,statusbar=0,menubar=0,resizable='+resizable+',width='+width+',height='+height+',left='+left+',top='+top);
		opener.document.write('<body style="background:#ffffcc"><div id="trace" style="font:10px arial;">'+title+'</div></body>');
		opener.document.close();
		opener.onunload = function(){
			opener = new Object();
		}
	}
	opener.document.getElementById('trace').innerHTML = opener.document.getElementById('trace').innerHTML +"\n<br/>"+tracecount+":"+msg;
}
