flashcomsEngine = "php";
flashcomsRoot = "http://www.gkdx.com/flashcoms/";

function openFlashcomsWindow(url, name, width, height, noresize) {
	var left = Math.round((screen.width - width) / 2);
	var top = Math.round((screen.height - height) / 2);
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=' + (noresize ? 'no' : 'yes') + ',width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top;
	window.open(flashcomsRoot + url, name, styleStr);
}

function openMessengerWindow(sender, receiver, request) {
	openFlashcomsWindow(flashcomsEngine + "/messenger." + flashcomsEngine + "?sender=" + sender + "&receiver=" + receiver + (request ? "&request=1" : ""), "messenger_" + receiver, 398, 299);
}

function openCommunicatorWindow(sender, receiver, request) {
	openFlashcomsWindow(flashcomsEngine + "/communicator." + flashcomsEngine + "?sender=" + sender + "&receiver=" + receiver + (request ? "&request=1" : ""), "communicator_" + receiver, 600, 247, false);
}

function openChatWindow(room, uid) {
	openFlashcomsWindow(flashcomsEngine + "/chat." + flashcomsEngine + "?uid=" + (uid ? uid : 0) + "&room=" + (room ? room : 0), "chat", 740, 480);
}

function openVideoChatWindow(room, uid) {
	openFlashcomsWindow(flashcomsEngine + "/videochat." + flashcomsEngine + "?uid=" + (uid ? uid : 0) + "&room=" + (room ? room : 0), "videochat", 740, 480);
}

function openRecorderWindow(sender, uid) {
	openFlashcomsWindow(flashcomsEngine + "/recorder." + flashcomsEngine + "?uid=" + (uid ? uid : 0) + "&sender=" + sender, "recorder", 397, 295);
}

function openDebugWindow(name) {
	var width = 400;
	var height = 300;
	var left = Math.round((screen.width - width) / 3);
	var top = Math.round((screen.height - height) / 3);
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top;
	var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',screenX=' + left + ',screenY=' + top;
	debugWin = window.open('', name, styleStr);
	debugWin.document.write('<html>');
	debugWin.document.write('<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Debug Window</title><style type="text/css">body,td,th {font-family: Verdana; font-size: 10pt; color: #000000;}</style></head>');
	debugWin.document.write('<body leftmargin="5" topmargin="5" marginheight="5" marginwidth="5" bgcolor="#F0F0F0"><div id="debug"></div></body>');
	debugWin.document.write('</html>');
}

function debug(value) {
	debugWin.document.getElementById('debug').innerHTML += value + '<br>';
}