<?xjs
	load('webInit.ssjs');
	var f = new File(file_cfgname(system.ctrl_dir, 'services.ini'));
	if(f.open("r")) {
		var servicesIni = f.iniGetObject('FlashPolicy');
		f.close();
	}
	if(servicesIni === undefined || servicesIni === null) {
		var embed = false;
	} else {
		var embed = true;
		var fspPort = servicesIni.Port;
	}
?>

<html>

<head>
<script type="text/javascript" src="http://<?xjs write(http_request.host); ?>/<?xjs write(webIni.appendURL); ?>/lightirc/swfobject.js"></script>
<link rel="stylesheet" type="text/css" href="../style/style.css" />
</head>

<body class="background">
<div id="lightIRC">LightIRC would appear here if you had Flash Player installed and Javascript enabled.</div>
<script language="javascript" type="text/javascript">
document.getElementById('lightIRC').innerHTML = "";
var params = {
	host : "<?xjs write(http_request.host.replace(/\:\d*/g, "")); ?>",
	policyPort : "<?xjs write(fspPort); ?>",
	language : "en",
	nickselect : "yes",
	nick : "<?xjs write(user.alias); ?>",
	autojoin : "#bbs",
	ident : "<?xjs write(user.alias); ?>",
	realname : "<?xjs write(user.name); ?>",
	quitmsg : "<?xjs write(system.name); ?>"
};
if(<?xjs write(embed); ?>)
	swfobject.embedSWF('http://<?xjs write(http_request.host); ?>/<?xjs write(webIni.appendURL); ?>/lightirc/lightIRC.swf', 'lightIRC', '730', '420', '9.0.0', null, params, null);
else
	document.getElementById('lightIRC').innerHTML = 'Socket policy server not enabled.  LightIRC not loaded.';
</script>
</body>

</html>