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

local domain = _GET["domain"] or _POST["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>Domain Statistics</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:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%end%>
img {border:0px;}

.listhead
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 3px solid #CBC7B8;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #EBEADB; overflow:hidden; height:22px;
}

.listhead2
{
		border-top: 1px solid white; border-right: 1px solid #ACA899; border-left: 1px solid white; border-bottom: 3px solid #FCC247;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #FAF9F4; overflow:hidden; height:22px;
}

.listhead3
{
		border-top: 1px solid white; border-right: 1px solid white; border-left: 1px solid white; border-bottom: 3px solid #CBC7B8;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #EBEADB; overflow:hidden; height:22px;
}

.listhead4
{
		border-top: 1px solid white; border-right: 1px solid white; border-left: 1px solid white; border-bottom: 3px solid #FCC247;
		font: 12px/22px arial; cursor: hand; text-align: center; background-color: #FAF9F4; overflow:hidden; height:22px;
}

.listtr01
{
		background-color: #FFFFFF;
		padding: 3px;
}

.listtr02
{
		background-color: #3366CC;
		color: #FFF;
		padding: 3px;
}
</style>

<script language="javascript" src="include/common.js"></script>
<script language="javascript">
var domain = "<%=domain%>";
var selectedRow = null;
var lastObj = null;
var lastObjIndex = -1;

var xmlhttp,page,post;
var ajaxlock = false;
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_get_status':	getstatus_result();break;
				}
			}
			catch(e)
			{
			}
		}
		else
		{
		}
	}
}

function getstatus_req()
{
	ajaxRequest("admin_get_status","domain="+domain+"&r="+Math.random());
}

function getstatus_result()
{
	try
	{
		var headcell = $("listhead").rows[0].cells;
		var htmltext = "<table id='listtable' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><thead><tr height='0'><td width='40%'></td><td width='40%'></td><td></td></tr></thead><tbody id='maintable'>";
		htmltext += xmlhttp.responseText;
		htmltext += "</tbody></table>";

		clear("listview_div");
		write("listview_div",htmltext);
		selectedRow = null;

		if(lastObjText != "")
		{
			var rownum = $("maintable").rows.length;
			for(var i=0; i < rownum; i++)
			{
				var tempText = $("maintable").rows[i].cells[0].innerHTML;
				if(tempText == lastObjText)
				{
					$("maintable").rows[i].className = "listtr02";
					lastObj = $("maintable").rows[i];
					selectedRow = lastObj;
				}
			}
		}
	}
	catch(e){}
}

function do_list_click(obj)
{
	var row_index = obj.rowIndex-1;
	if(selectedRow != $("maintable").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("maintable").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjText = selectedRow.cells[0].innerHTML;
		}catch(e){
			lastObjText = "";
		}
	}
	return false;
}
</script>
</head>
<body style="background-color:#E7E6DA;" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<div style="padding-top:2px; margin-left:5px;">
	<b><%=LANG["str_domain_statistics"]%>[<%=specialhtml_encode(unescape(domain))%>]</b>
</div>



<div style="background-color:#E7E6DA;">
	<div style="margin-left:5px; border:1px solid #919B9C; border-bottom:0px; width:98%;">
		<table id="listhead" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">
		<tr>
		<td class="listhead" width="40%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_statistics"]%></td>
		<td class="listhead" width="40%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_value"]%></td>
		<td class="listhead3">&nbsp;</td>
		</tr>
		</table>
	</div>
	<div id="listview_div" style="background-color:#FFF; margin-left:5px; border:1px solid #919B9C; border-top:0px; height:450px; width:98%; overflow:auto; overflow-x:hidden;">
		<table id="listtable" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;">
		<thead><tr height="0">
		<td width="40%"></td>
		<td width="40%"></td>
		<td></td>
		</tr></thead>
		<tbody id="maintable">
		</tbody>
		</table>
	</div>
</div>

</body>
</html>

<script>
_TIMER_REFRESH = setInterval("getstatus_req()",1000);
getstatus_req();
</script>

<% 
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>