<%
include("language.html")
if _SESSION["logined"] ~= nil then

local domain = _GET["domain"]
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Broadcast Message</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
body,td,span {font:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%else%>
body,td,span {font:11px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%end%>
img {border:0px;}

button{
border:none;background:none;padding:0;
margin:0;width:auto;overflow:visible;text-align:center;	
white-space:nowrap;height:24px;line-height:22px;
cursor:pointer;
color:#000;
margin-left:2px;
margin-top:2px;
}
button span, button em{
display:block;height:24px;line-height:22px;margin:0;
}	
button span{
padding-left:14px;
background:url("images/button_left.gif") no-repeat 0 0;
}
button em{
font-style:normal;padding-right:14px;
background:url("images/button.gif") no-repeat 100% 0;
}
button:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
button span:hover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}
.buttonhover{
filter:alpha(opacity=60);
opacity:0.60;
color:#5488C9;
}


</style>

<script language="javascript" src="include/common.js"></script>
<script language="javascript">
var domain = "<%=domain%>";
var ajaxlock = false;

var xmlhttp,page,post;
xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

function ajaxRequest(pagename,poststring,method)
{
	if(ajaxlock == false)
	{	
		delete xmlhttp;
		xmlhttp = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();

		ajaxlock = true;
		page = pagename;
		post = poststring;

		if(method == "GET")
			xmlhttp.open("GET",page+".html"+post);
		else
			xmlhttp.open("POST",page+".html");

		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.onreadystatechange = ajaxResponse;
		if(method != "GET")
			xmlhttp.send(post);
		else
			xmlhttp.send("");
	}
}

function ajaxResponse()
{
	if (xmlhttp.readyState == 4)
	{
		ajaxlock = false;
		if (xmlhttp.status == 200)
		{
			try
			{
				switch(page)
				{
					case 'admin_sendmsg':
					{
						$("btn_send").disable = false;
						alert("<%=LANG['str_broadcast_ok']%>");
						break;
					}
				}
			}
			catch(e)
			{
			}
		}
		else
		{
		}
	}
}

function sendMessage()
{
	var msg = trim($("strMessage").value);
	if(msg == "") return;

	ajaxRequest("admin_sendmsg","domain="+domain+"&broadcast=1&msg="+encodeURIComponent(msg)+"&r="+Math.random());
	$("strMessage").value = "";
	$("btn_send").disable = true;
}
</script>
</head>
<body style="background-color:#E7E6DA;" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr><td align="center">
	<textarea id="strMessage" style="width:410px;height:180px;" onmouseover="this.focus();"></textarea>
	</td></tr>
	<tr><td>
	&nbsp;&nbsp;<img src="images/ico_warning.gif"> <%=LANG["str_broadcast_tip"]%>
	</td></tr>
	<tr><td align="center">
	<button onclick="sendMessage();" id="btn_send"><span><em><%=LANG["button_sendmessage"]%></em></span></button>&nbsp;
	<button onclick="top.closewindow();" id="btn_cancel"><span><em><%=LANG["button_cancel"]%></em></span></button>
	</td></tr>
</table>


</body>
</html>

<% 
else
	print("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>")
	print("<script>alert('"..LANG["session_expire"].."');top.location='admin_login.html';</script>")
end 
%>

<noscript><center><H2><%=LANG["error_nojavascript"]%></H2></center></noscript>
