function XEvent()
{
	this.Lock = XEvent_Lock;
	this.Unlock = XEvent_Unlock;
	this.Worker = XEvent_Worker;
	return this;
}
function XEvent_Worker(win)
{
	win.document.body.style.visibility="hidden";
	//print(win.dialogArguments);
	this.win = win;
	window.args = win.args;
	//alert(this.locked+","+window.dialogArguments);
	if(this.locked) {
		this.workerTimer = win.setTimeout("window.dialogArguments.Worker(window);", 10);
		if(this.timoutTimer == null)
			this.timeoutTimer = win.setTimeout("window.dialogArguments.locked = false; window.close();", this.timeout);
	} else {
		win.close();
	}	
}

function XEvent_Lock(ms)
{
	this.locked = true;
	this.timeout = ms;
	//addLine("Lock();");
//wnd = window.showModalDialog("javascript: var doc = document.open(\"text/html\", \"replace\");doc.writeln(\"<body onload=alert('onload');></body>\"); doc.close();",null,"dialogLeft:1800;dialogHeight:0;dialogWidth:0");
	//window.showModalDialog("/utils/xeventdlg.htm",this,"dialogLeft:1800;dialogHeight:0;dialogWidth:0");return;
/*
	wnd = open("\
	javascript:\
	var doc = document.open(\"text/html\", \"replace\");\
	document.writeln(\"\
	<html>\
	<head>\
	<script>\
	function onLoad() { window.args = window.dialogArguments; alert(window.parent.dialogArguments);}\
	<\/script>\
	</head>\
	<body oonload=onLoad();>wert<script>document.write(window.dialogArguments);alert(window.opener);<\/script>\
	</body></html>\
	<script>\
	<\/script>\
	\");\
	document.write(window.dialogArguments);\
	document.close();","hallo","dialogLeft:1800;dialogHeight:0;dialogWidth:0");
*/	
	window.showModalDialog("/utils/xeventdlg.htm",this,"dialogLeft:1800;dialogHeight:0;dialogWidth:0");
	//window.focus();
}
function XEvent_Unlock()
{
	this.locked = false;
	//this.win.close();
}
