<%
include("language.html")
if _SESSION["logined"] ~= nil then
%>
<!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>Add/Edit Group</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%
if _GET["domain"] ~= nil then
	local group = ""
	if _GET["groupname"] ~= nil then
		group = c_GetGroup(_GET["domain"],_GET["groupname"])
		if group == nil then
			print("<script>alert('Group does not exist!');top.closewindow();</script>")
			exit()
		else
			group = json.encode(group)
		end
	end
%>
<style type="text/css">
a {text-decoration:none;}
a,a:visited {color:#000;background:inherit;}
img {border:0px;}
<%if _COOKIE["admin_lang"] == "schinese" or _COOKIE["admin_lang"] == "tchinese" or _COOKIE["admin_lang"] == "japanese" then%>
body,td,span {margin:0;padding:0;font:12px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%else%>
body,td,span {margin:0;padding:0;font:11px/20px Verdana, Geneva, Arial, Helvetica, sans-serif;}
<%end%>
input,select,textarea{margin:4px;}
input,textarea{background-color:expression((this.disabled && this.disabled==true)?"#D4D0C8":"")}
td{line-height:24px;}
fieldset {  
    border-color: #999;  
    border-style: solid;  
    border-width: 1px;  
}

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;
}


.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:18px;
}

.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:18px;
}

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

.listtr02
{
		background-color: #3366CC;
		color: #FFF;
		text-align: left;
		padding: 3px;
}

.resizeblock{
	background-color:transparent;
	width:2px;
	float:right;
	cursor:e-resize;
}



#tabDiv {
	width: 805px;
	margin: 0px auto 0px auto;
	position: relative;
	border:1px solid transparent;
	border:1px solid #E7E6DA;
}

#tabDiv ul {
	padding: 0px;
	position: absolute;
	margin-left: 0px;
	margin-top: 4px;
}
#tabDiv li {
	list-style-type: none;
	float: left;
	margin-right: 1px;
	height: 24px;
	line-height: 24px;
	padding: 0px;
}
#tabDiv li a {
	display: block;
	text-decoration: none;
	padding-right: 10px;
	padding-left: 10px;
}
.tagContent {
	clear:both;
	float:none;
	margin-top: 27px;
	border: 1px solid #919B9C;
}
.tagContent div {
	margin-top: 0px;
	height: 380px;
	overflow-y:auto;
	background-image: url('images/tabbg.gif');
	background-repeat: repeat-x;
	background-color: #fff;
	padding: 12px;
	display: none;
}
.selectedTag {
	background-image: url('images/tableft.gif');
	background-repeat: no-repeat;
	background-position: left top;
}
.selectedTag a {
	background-image: url('images/tabright.gif');
	background-repeat: no-repeat;
	background-position: right top;
	color:#000;
}
.normalTag {
	background-image: url('images/tableft.gif');
	background-repeat: no-repeat;
	background-position: left bottom;
}
.normalTag a {
	background-image: url('images/tabright.gif');
	background-repeat: no-repeat;
	background-position: right bottom;
	color:#49658F
}
.emptyTag { width:20px;}
</style>

<script language="javascript" src="include/common.js"></script>
<script language="javascript" src="include/json.js"></script>
<script language="javascript">
var ajaxlock = false;
var selectedRow = null;
var lastObj = null;
var lastObjIndex = -1;
var resetStatistic = 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)
	{
		$("waitingdiv").style.display = "none";
		ajaxlock = false;
		if (xmlhttp.status == 200)
		{
			try
			{
				switch(page)
				{
					case 'admin_addgroup':		addGroup_result();break;
					case 'admin_modifygroup':	modifyGroup_result();break;
				}
			}
			catch(e)
			{
				alert("<%=LANG['error_ajax']%>");
			}
		}
		else
		{
			alert("<%=LANG['error_ajax']%>");
		}
	}
}


var directories = new Array();
var ipmasks = new Array();
var filemasks = new Array();
var userlist = new Array();
var subdir_perm = new Array();
var last_dir_id = null;
var last_subdir_id = null;

function addGroupSubmit()
{
	var domain = $("domain").value;
	var groupname = $("groupname").value;
	if(domain.length == 0)
	{
		alert("<%=LANG['str_no_domain']%>");
		return false;
	}
	if(groupname.length <= 0 || groupname.length >= 32 || groupname.search(/[\\\/\<\>\:\?\"\'\|\*\&\=]/i) != -1 || groupname == " ")
	{
		alert("<%=LANG['str_invalid_groupname']%>");
		return false;
	}
	var group = {
	groupname:trim($("groupname").value),
	max_download:$("max_download").value,
	max_upload:$("max_upload").value,
	max_download_account:$("max_download_account").value,
	max_upload_account:$("max_upload_account").value,
	max_download_group:$("max_download_group").value,
	max_upload_group:$("max_upload_group").value,
	max_connection:$("max_connection").value,
	connect_timeout:$("connect_timeout").value,
	idle_timeout:$("idle_timeout").value,
	connect_per_ip:$("connect_per_ip").value,
	max_session_per_user:$("max_session_per_user").value,
	max_ipsession_for_user:$("max_ipsession_for_user").value,
	show_hidden_file:($("show_hidden_file").checked ? 1:0),
	send_message:($("send_message").checked ? 1:0),
	ipmasks:ipmasks,
	filemasks:filemasks,
	directories:directories,
	userlist:userlist,
	subdir_perm:subdir_perm
	};

	var groupString = encodeURIComponent(JSON.stringify(group));
	var modifygroup = '<%=group%>';
	var oldname = '<%=_GET["groupname"]%>';
	if(modifygroup != "")
	{
		if(resetStatistic)
			ajaxRequest("admin_modifygroup","resetstat=1&domain="+domain+"&oldname="+oldname+"&group="+groupString+"&r=" + Math.random());
		else
			ajaxRequest("admin_modifygroup","domain="+domain+"&oldname="+oldname+"&group="+groupString+"&r=" + Math.random());
	}
	else
	{
		ajaxRequest("admin_addgroup","domain="+domain+"&group="+groupString+"&r=" + Math.random());
	}
	$("waitingdiv").style.display = "";
}

function addGroup_result()
{
	var result = xmlhttp.responseText;
	if(result == "0" || result == 0)
	{
		alert("<%=LANG['str_existed_groupname']%>");
	}
	else
	{
		top.closewindow(1);
	}
}

function modifyGroup_result()
{
	var result = xmlhttp.responseText;
	if(result == "0" || result == 0)
	{
		alert("<%=LANG['str_existed_groupname']%>");
	}
	else
	{
		top.closewindow(1);
	}
}

function resetGroupStatistic()
{
	$("total_received").innerHTML = "0.0 B";
	$("total_sent").innerHTML = "0.0 B";
	$("login_count").innerHTML = "0";
	$("file_download").innerHTML = "0";
	$("file_upload").innerHTML = "0";
	$("failed_download").innerHTML = "0";
	$("failed_upload").innerHTML = "0";
	resetStatistic = true;
}

function groupInit()
{
	var group = '<%=group%>';
	if(group != "")
	{
		try
		{
			var groupObject = JSON.parse(group);
			$("groupname").value = groupObject["groupname"];
			$("max_download").value = groupObject["max_download"];
			$("max_upload").value = groupObject["max_upload"];
			$("max_download_account").value = groupObject["max_download_account"];
			$("max_upload_account").value = groupObject["max_upload_account"];
			$("max_download_group").value = groupObject["max_download_group"];
			$("max_upload_group").value = groupObject["max_upload_group"];
			$("max_connection").value = groupObject["max_connection"];
			$("connect_timeout").value = groupObject["connect_timeout"];
			$("idle_timeout").value = groupObject["idle_timeout"];
			$("connect_per_ip").value = groupObject["connect_per_ip"];
			$("max_session_per_user").value = groupObject["max_session_per_user"];
			$("max_ipsession_for_user").value = groupObject["max_ipsession_for_user"];
			$("show_hidden_file").checked = groupObject["show_hidden_file"];
			$("send_message").checked = groupObject["send_message"];
			$("total_received").innerHTML = fileSize(groupObject["total_received"]);
			$("total_sent").innerHTML = fileSize(groupObject["total_sent"]);
			$("login_count").innerHTML = groupObject["login_count"];
			$("file_download").innerHTML = groupObject["file_download"];
			$("file_upload").innerHTML = groupObject["file_upload"];
			$("failed_download").innerHTML = groupObject["failed_download"];
			$("failed_upload").innerHTML = groupObject["failed_upload"];
			ipmasks = (groupObject["ipmasks"] != null ? groupObject["ipmasks"] : new Array());
			filemasks = (groupObject["filemasks"] != null ? groupObject["filemasks"] : new Array());
			directories = (groupObject["directories"] != null ? groupObject["directories"] : new Array());
			userlist = (groupObject["userlist"] != null ? groupObject["userlist"] : new Array());
			subdir_perm = (groupObject["subdir_perm"] != null ? groupObject["subdir_perm"] : new Array());
			AddBlockIP_updateview();
			AddBlockfile_updateview();
			AddDirectory_updateview();
			AddSubfolder_updateview();
			Username_updateview();
		}
		catch(e)
		{
			alert("<%=LANG['str_loadgroup_fail']%>");
		}
	}
}


function AddDirectory()
{
	showMessagebox("<%=LANG['str_adddir']%>","<iframe src='admin_add_directory.html' width=450 height=320 border=0 frameborder=0></iframe>",AddDirectory_callback,450,320);
}

function AddDirectory_updateview()
{
	var htmltext = "<table id='listtable' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'>";
	for(var i=0;i<directories.length;i++)
	{
		var rightmask = "";
		if(directories[i].is_home_dir) rightmask += "H";
		rightmask += " ";
		if(directories[i].fileread) rightmask += "R";
		if(directories[i].filewrite) rightmask += "W";
		if(directories[i].fileappend) rightmask += "A";
		if(directories[i].filedelete) rightmask += "D";
		if(directories[i].filerename) rightmask += "Rn";
		rightmask += " ";
		if(directories[i].dirlist) rightmask += "L";
		if(directories[i].dirmake) rightmask += "M";
		if(directories[i].dirdelete) rightmask += "D";
		if(directories[i].dirrename) rightmask += "Rn";
		rightmask += " ";
		if(directories[i].zipfile) rightmask += "Z";
		if(directories[i].unzipfile) rightmask += "U";
		htmltext += "<tr class='listtr01' onclick='do_list_click(this);'><td width='50%' f_id='"+i+"'>"+directories[i].dir+"</td><td width='25%'>"+directories[i].alias+"</td><td width='25%'>"+rightmask+"</td></tr>";
	}
	htmltext += "</table>";
	clear("listview_div");
	write("listview_div",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddDirectory_callback(dirObject)
{
	if(typeof(dirObject) == "object")
	{
//		if(dirObject.is_home_dir == true || dirObject.alias == "/")
//		{
//			dirObject = null;
//			alert("<%=LANG['str_homedir_denied']%>");
//			return;
//		}
		directories.push(dirObject);
		dirObject = null;
		AddDirectory_updateview();
	}
}

function AddSubfolder()
{
	var frametag = new Date().getTime();
	showMessagebox("<%=LANG['str_subfolder_rule']%>","<iframe src='admin_add_subdir.html' width=450 height=300 border=0 frameborder=0 id='subdir"+frametag+"'></iframe>",AddSubfolder_callback,450,300);
}

function AddSubfolder_updateview()
{
	var htmltext = "<table id='listtable6' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'>";
	for(var i=0;i<subdir_perm.length;i++)
	{
		var rightmask = "";
		if(subdir_perm[i].is_home_dir) rightmask += "H";
		rightmask += " ";
		if(subdir_perm[i].fileread) rightmask += "R";
		if(subdir_perm[i].filewrite) rightmask += "W";
		if(subdir_perm[i].fileappend) rightmask += "A";
		if(subdir_perm[i].filedelete) rightmask += "D";
		if(subdir_perm[i].filerename) rightmask += "Rn";
		rightmask += " ";
		if(subdir_perm[i].dirlist) rightmask += "L";
		if(subdir_perm[i].dirmake) rightmask += "M";
		if(subdir_perm[i].dirdelete) rightmask += "D";
		if(subdir_perm[i].dirrename) rightmask += "Rn";
		rightmask += " ";
		if(subdir_perm[i].zipfile) rightmask += "Z";
		if(subdir_perm[i].unzipfile) rightmask += "U";
		htmltext += "<tr class='listtr01' onclick='do_list_click6(this);'><td width='75%' f_id='"+i+"'>"+subdir_perm[i].dir+"</td><td width='25%'>"+rightmask+"</td></tr>";
	}
	htmltext += "</table>";
	clear("listview_div6");
	write("listview_div6",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddSubfolder_callback(dirObject)
{
	if(typeof(dirObject) == "object")
	{
		subdir_perm.push(dirObject);
		dirObject = null;
		AddSubfolder_updateview();
	}
}

function do_list_click6(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable6").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable6").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifySubfolder();
	}

	return false;
}

function ModifySubfolder()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	last_subdir_id = f_id;
	var f_dir = urlEncode(JSON.stringify(subdir_perm[f_id]));
	var frametag = new Date().getTime();
	showMessagebox("<%=LANG['str_subfolder_rule']%>","<iframe src='admin_add_subdir.html?dir="+f_dir+"&seeds=" + Math.random() +"' width=450 height=300 border=0 frameborder=0 id='modify"+frametag+"'></iframe>",ModifySubfolder_callback,450,300);
}

function ModifySubfolder_callback(dirObject)
{
	if(typeof(dirObject) == "object" && last_subdir_id >= 0)
	{
		subdir_perm[last_subdir_id] = dirObject;
		dirObject = null;
		AddSubfolder_updateview();
	}
}

function DeleteSubfolder()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	subdir_perm.splice(f_id,1);
	AddSubfolder_updateview();
}

function UpSubfolder()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = subdir_perm[f_id-1]; 
		subdir_perm[f_id-1] = subdir_perm[f_id];
		subdir_perm[f_id] = temp;
	}

	AddSubfolder_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < subdir_perm.length; i++)
		{
			var tempID = parseInt($("listtable6").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable6").rows[i].className = "listtr02";
				lastObj = $("listtable6").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownSubfolder()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < subdir_perm.length-1)
	{
		var temp = subdir_perm[f_id+1]; 
		subdir_perm[f_id+1] = subdir_perm[f_id];
		subdir_perm[f_id] = temp;
	}

	AddSubfolder_updateview();

	if(f_id < subdir_perm.length-1)
	{
		for(var i=0; i < subdir_perm.length; i++)
		{
			var tempID = parseInt($("listtable6").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable6").rows[i].className = "listtr02";
				lastObj = $("listtable6").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

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

		selectedRow = $("listtable").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifyDirectory();
	}

	return false;
}

function ModifyDirectory()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	last_dir_id = f_id;
	var f_dir = urlEncode(JSON.stringify(directories[f_id]));
	showMessagebox("<%=LANG['str_modifydir']%>","<iframe src='admin_add_directory.html?dir="+f_dir+"&seeds=" + Math.random() +"' width=450 height=320 border=0 frameborder=0></iframe>",ModifyDirectory_callback,450,320);
}

function ModifyDirectory_callback(dirObject)
{
	if(typeof(dirObject) == "object")
	{
//		if(dirObject.is_home_dir == true || dirObject.alias == "/")
//		{
//			dirObject = null;
//			alert("<%=LANG['str_homedir_denied']%>");
//			return;
//		}

		if(last_dir_id >= 0)
			directories[last_dir_id] = dirObject;
		AddDirectory_updateview();
	}
}

function DeleteDirectory()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	directories.splice(f_id,1);
	AddDirectory_updateview();
}

function UpDirectory()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = directories[f_id-1]; 
		directories[f_id-1] = directories[f_id];
		directories[f_id] = temp;
	}

	AddDirectory_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < directories.length; i++)
		{
			var tempID = parseInt($("listtable").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable").rows[i].className = "listtr02";
				lastObj = $("listtable").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownDirectory()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < directories.length-1)
	{
		var temp = directories[f_id+1]; 
		directories[f_id+1] = directories[f_id];
		directories[f_id] = temp;
	}

	AddDirectory_updateview();

	if(f_id < directories.length-1)
	{
		for(var i=0; i < directories.length; i++)
		{
			var tempID = parseInt($("listtable").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable").rows[i].className = "listtr02";
				lastObj = $("listtable").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}






function AddBlockIP()
{
	showMessagebox("<%=LANG['str_addblockip']%>","<span style='padding:5px;'><%=LANG['str_ipmask_tip']%><span><br><br><%=LANG['str_ip']%>: <input type='text' style='width:190px' id='blockip'><br><input type='radio' name='radio' id='radio_deny' checked><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow'><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return AddBlockIP_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);
	top.$("blockip").focus();

	top.$("btn_submit").onclick = function(){return AddBlockIP_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function AddBlockIP_updateview()
{
	var htmltext = "<table id='listtable2' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><tbody>";
	for(var i=0;i<ipmasks.length;i++)
	{
		var refuse = ipmasks[i].refuse ? "<font color='red'>Deny</font>":"<font color='green'>Allow</font>";
		htmltext += "<tr class='listtr01' onclick='do_list_click2(this);'><td width='70%' f_id='"+i+"'>"+ipmasks[i].ip+"</td><td width='30%'>"+refuse+"</td></tr>";
	}
	htmltext += "</tbody></table>";
	clear("listview_div2");
	write("listview_div2",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddBlockIP_submit()
{
	var blockip = htmldecode(top.$("blockip").value);
	if(blockip.length == 0 || blockip.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("blockip").focus();
		return;
	}
	var mask = new Object();
	mask.ip = blockip;
	mask.refuse = top.$("radio_deny").checked ? true:false;
	ipmasks.push(mask);
	mask = null;
	AddBlockIP_updateview();
	top.closewindow();
}

function do_list_click2(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable2").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable2").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifyBlockIP();
	}

	return false;
}

function ModifyBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	var f_ip = ipmasks[f_id].ip;
	var f_deny = ipmasks[f_id].refuse ? "checked":"";
	var f_allow = ipmasks[f_id].refuse ? "":"checked";
	showMessagebox("<%=LANG['str_modifyblockip']%>","<span style='padding:5px;'><%=LANG['str_ipmask_tip']%><span><br><input type='hidden' id='blockip_id' value='"+f_id+"'><br><%=LANG['str_ip']%>: <input type='text' style='width:190px' id='blockip' value='"+f_ip+"'><br><input type='radio' name='radio' id='radio_deny' "+f_deny+"><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow' "+f_allow+"><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return ModifyBlockIP_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);

	top.$("btn_submit").onclick = function(){return ModifyBlockIP_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function ModifyBlockIP_submit()
{
	var f_id = parseInt(htmldecode(top.$("blockip_id").value));
	var blockip = htmldecode(top.$("blockip").value);
	if(blockip.length == 0 || blockip.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalidip']%>");
		top.$("blockip").focus();
		return;
	}
	ipmasks[f_id].ip = blockip;
	ipmasks[f_id].refuse = top.$("radio_deny").checked ? true:false;
	AddBlockIP_updateview();
	top.closewindow();
}

function DeleteBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	ipmasks.splice(f_id,1);
	AddBlockIP_updateview();
}

function UpBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = ipmasks[f_id-1]; 
		ipmasks[f_id-1] = ipmasks[f_id];
		ipmasks[f_id] = temp;
	}

	AddBlockIP_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < ipmasks.length; i++)
		{
			var tempID = parseInt($("listtable2").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable2").rows[i].className = "listtr02";
				lastObj = $("listtable2").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownBlockIP()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < ipmasks.length-1)
	{
		var temp = ipmasks[f_id+1]; 
		ipmasks[f_id+1] = ipmasks[f_id];
		ipmasks[f_id] = temp;
	}

	AddBlockIP_updateview();

	if(f_id < ipmasks.length-1)
	{
		for(var i=0; i < ipmasks.length; i++)
		{
			var tempID = parseInt($("listtable2").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable2").rows[i].className = "listtr02";
				lastObj = $("listtable2").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}





function AddBlockfile()
{
	showMessagebox("<%=LANG['str_addblockfile']%>","<span style='padding:5px;'><%=LANG['str_filemask_tip']%><span><br><br><%=LANG['str_filemask']%>: <input type='text' style='width:190px' id='blockfilename'><br><input type='radio' name='radio' id='radio_deny' checked><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow'><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return AddBlockfile_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);
	top.$("blockfilename").focus();

	top.$("btn_submit").onclick = function(){return AddBlockfile_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function AddBlockfile_updateview()
{
	var htmltext = "<table id='listtable3' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><tbody>";
	for(var i=0;i<filemasks.length;i++)
	{
		var refuse = filemasks[i].refuse ? "<font color='red'>Deny</font>":"<font color='green'>Allow</font>";
		htmltext += "<tr class='listtr01' onclick='do_list_click3(this);'><td width='70%' f_id='"+i+"'>"+filemasks[i].filename+"</td><td width='30%'>"+refuse+"</td></tr>";
	}
	htmltext += "</tbody></table>";
	clear("listview_div3");
	write("listview_div3",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function AddBlockfile_submit()
{
	var blockfilename = htmldecode(top.$("blockfilename").value);
	if(blockfilename.length == 0 || blockfilename.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalid_filename']%>");
		top.$("blockfilename").focus();
		return;
	}
	var mask = new Object();
	mask.filename = blockfilename;
	mask.refuse = top.$("radio_deny").checked ? true:false;
	filemasks.push(mask);
	mask = null;
	AddBlockfile_updateview();
	top.closewindow();
}

function do_list_click3(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable3").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable3").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}
	else
	{
		ModifyBlockfile();
	}

	return false;
}

function ModifyBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	var f_filename = filemasks[f_id].filename;
	var f_deny = filemasks[f_id].refuse ? "checked":"";
	var f_allow = filemasks[f_id].refuse ? "":"checked";
	showMessagebox("<%=LANG['str_modifyblockfile']%>","<span style='padding:5px;'><%=LANG['str_filemask_tip']%><span><br><input type='hidden' id='blockfileid' value='"+f_id+"'><br><%=LANG['str_filemask']%>: <input type='text' style='width:190px' id='blockfilename' value='"+f_filename+"'><br><input type='radio' name='radio' id='radio_deny' "+f_deny+"><%=LANG['str_denied']%> <input type='radio' name='radio' id='radio_allow' "+f_allow+"><%=LANG['str_allowed']%><br><br><br><button id='btn_submit' type='submit' onclick='return ModifyBlockfile_submit()'><span><em><%=LANG['button_submit']%></em></span></button>&nbsp;<button id='btn_cancel' onclick='top.closewindow();'><span><em><%=LANG['button_cancel']%></em></span></button>",null,340,190);

	top.$("btn_submit").onclick = function(){return ModifyBlockfile_submit();};
	top.$("btn_cancel").onclick = function(){top.closewindow();};
}

function ModifyBlockfile_submit()
{
	var f_id = parseInt(htmldecode(top.$("blockfileid").value));
	var blockfilename = htmldecode(top.$("blockfilename").value);
	if(blockfilename.length == 0 || blockfilename.search(/[\<\>\"\']/i) != -1)
	{
		alert("<%=LANG['str_invalid_filename']%>");
		top.$("blockfilename").focus();
		return;
	}
	filemasks[f_id].filename = blockfilename;
	filemasks[f_id].refuse = top.$("radio_deny").checked ? true:false;
	AddBlockfile_updateview();
	top.closewindow();
}

function DeleteBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}

	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	filemasks.splice(f_id,1);
	AddBlockfile_updateview();
}

function UpBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id > 0)
	{
		var temp = filemasks[f_id-1]; 
		filemasks[f_id-1] = filemasks[f_id];
		filemasks[f_id] = temp;
	}

	AddBlockfile_updateview();

	if(f_id > 0)
	{
		for(var i=0; i < filemasks.length; i++)
		{
			var tempID = parseInt($("listtable3").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id-1)
			{
				$("listtable3").rows[i].className = "listtr02";
				lastObj = $("listtable3").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function DownBlockfile()
{
	if(selectedRow == null)
	{
		alert("<%=LANG['str_norow_tip']%>");
		return;
	}
	var f_id = parseInt(selectedRow.cells[0].getAttribute("f_id"));
	if(f_id < filemasks.length-1)
	{
		var temp = filemasks[f_id+1]; 
		filemasks[f_id+1] = filemasks[f_id];
		filemasks[f_id] = temp;
	}

	AddBlockfile_updateview();

	if(f_id < filemasks.length-1)
	{
		for(var i=0; i < filemasks.length; i++)
		{
			var tempID = parseInt($("listtable3").rows[i].cells[0].getAttribute("f_id"));
			if(tempID == f_id+1)
			{
				$("listtable3").rows[i].className = "listtr02";
				lastObj = $("listtable3").rows[i];
				selectedRow = lastObj;
			}
		}
	}
}

function Username_updateview()
{
	var htmltext = "<table id='listtable8' width='100%' border='0' cellpadding='2' cellspacing='0' style='table-layout:fixed;'><tbody>";
	for(var i=0;i<userlist.length;i++)
	{
		htmltext += "<tr class='listtr01' onclick='do_list_click8(this);'><td>"+userlist[i].username+"</td></tr>";
	}
	htmltext += "</tbody></table>";
	clear("listview_div8");
	write("listview_div8",htmltext);
	selectedRow = null;
	lastsortcol = -1;
}

function do_list_click8(obj)
{
	var row_index = obj.rowIndex;
	if(selectedRow != $("listtable8").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";

		selectedRow = $("listtable8").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
		try{
			lastObjIndex = parseInt(selectedRow.cells[0].innerHTML);
		}catch(e){
			lastObjIndex = -1;
		}
	}

	return false;
}
</script>
</head>
<body style="background-color:#E7E6DA;">

<div id="waitingdiv" style="position:absolute; z-index:100; top:0px; left:0px; width:100%; height:100%; background:#777; filter:alpha(opacity=60); -moz-opacity: 0.60; opacity:0.60; display:none;" align="center">
<div style="position:absolute; top:20%; left:40%; width:250px; height:100px;"><img src="images/loading2.gif" border="0">
<H2><b><%=LANG["title_updating"]%></b></H2></div></div>

<div id="tabDiv">
  <ul id="tags">
  	<li class="emptyTag"></li>
    <li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent1',this)"><%=LANG["title_general"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent2',this)"><%=LANG["title_directory"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent7',this)"><%=LANG["title_subdir"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent3',this)"><%=LANG["title_connection_limit"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent4',this)"><%=LANG["title_transfer_limit"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent5',this)"><%=LANG["title_blockip"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent6',this)"><%=LANG["title_blockfile"]%></a></li>
	<li class="normalTag"><a href="javascript:void(0)" onfocus="this.blur()" onclick="switchTag('tagContent8',this)"><%=LANG["left_user"]%></a></li>
  </ul>
  <div id="tagContent" class="tagContent">
  	<div id="tagContent1">
		<input id="domain" type="hidden" value="<%=_GET["domain"]%>">
		<table cellSpacing="0" cellPadding="0" border="0">

		<tr><td colspan="2">
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_addgroup.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_addgroup_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr><td colspan=2 style="padding:5px;"><b><%=LANG["str_groupname"]%>:</b> <input id="groupname" type="text" style="width:280px;" maxlength="30"></td></tr>
		<tr><td colspan=2><input id="show_hidden_file" type="checkbox" checked><%=LANG["str_show_hiddenfile"]%></td></tr>
		<tr><td colspan=2><input id="send_message" type="checkbox" checked><%=LANG["str_send_message"]%></td></tr>

		<% if _GET["groupname"] ~= nil then %>
		<tr><td colspan=2 style="padding-top:15px;">
		<fieldset>
			<legend><b><%=LANG["str_group_statistics"]%></b>&nbsp;&nbsp; 
			<button onclick="resetGroupStatistic();"><span><em><img src="images/reset.gif" align="absmiddle"> <%=LANG["button_resetstat"]%></em></span></button>&nbsp;&nbsp; 
			</legend>
			<table width="100%" border="0" cellpadding="2" cellspacing="1">
			<tr>
			<td colspan="2"><%=LANG["str_logincount"]%>: <span id="login_count">0</span></td>
			</tr>
			<tr>
			<td><%=LANG["str_file_downloaded"]%>: <span id="file_download">0</span></td><td><%=LANG["str_file_uploaded"]%>: <span id="file_upload">0</span></td>
			</tr>
			<tr>
			<td><%=LANG["str_fail_download"]%>: <span id="failed_download">0</span></td><td><%=LANG["str_fail_upload"]%>: <span id="failed_upload">0</span></td>
			</tr>
			<tr>
			<td><%=LANG["str_sent"]%>: <span id="total_sent">0</span></td><td><%=LANG["str_received"]%>: <span id="total_received">0</span></td>
			</tr>
			</table>
		</fieldset>
		</td></tr>
		<% end %>
		</table>
	</div>
	<div id="tagContent2">
		<table id="listhead" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_tip.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_userdir_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="50%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_directory"]%></td>
			<td class="listhead" width="25%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_virtualpath"]%></td>
			<td class="listhead" width="25%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_attributes"]%></td>
			</tr>
			<tr>
			<td colspan="3">
			<span id="listview_div" style="float:left; height:260px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddDirectory();"><span><em><%=LANG["button_adddir"]%></em></span></button><button onclick="ModifyDirectory();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteDirectory();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpDirectory();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownDirectory();"><span><em><%=LANG["button_down"]%></em></span></button>	
		</td>
		</tr>
		</table>

	</div>

	<div id="tagContent7">
		<table id="listhead6" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_share.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_subfolder_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="75%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_directory"]%></td>
			<td class="listhead" width="25%" onmouseover="className='listhead2';" onmouseout="className='listhead';"><%=LANG["title_attributes"]%></td>
			</tr>
			<tr>
			<td colspan="2">
			<span id="listview_div6" style="float:left; height:260px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable6" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddSubfolder();"><span><em><%=LANG["button_subfolder"]%></em></span></button><button onclick="ModifySubfolder();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteSubfolder();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpSubfolder();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownSubfolder();"><span><em><%=LANG["button_down"]%></em></span></button>	
		</td>
		</tr>
		</table>

	</div>

	<div id="tagContent3">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td>
		<fieldset>
		<legend><b><%=LANG["str_limitgroupspecial"]%>(0 = <%=LANG["str_nolimit"]%>)</b></legend>
		<table width="100%" cellSpacing="0" cellPadding="2" border="0">
		<tr><td><%=LANG["str_connect_num_group"]%>:</td><td><input id="max_connection" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td></tr>
		<tr><td><%=LANG["str_connectnum_ip_group"]%>:</td><td><input id="connect_per_ip" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td></tr>
		</table>
		</fieldset>
		</td></tr>

		<tr><td height="30"></td></tr>

		<tr><td>
		<fieldset>
		<legend><b><%=LANG["str_limitgroupoverride"]%>(0 = <%=LANG["str_nolimit"]%>)</b></legend>
		<table width="100%" cellSpacing="0" cellPadding="2" border="0">
		<tr><td height="30"><%=LANG["str_connectionlimit3"]%>:</td><td><input id="max_session_per_user" type="text" value="0" style="width:100px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td></tr>
		<tr><td height="30"><%=LANG["str_connectionlimit4"]%>:</td><td><input id="max_ipsession_for_user" type="text" value="0" style="width:100px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td></tr>
		<tr><td height="30"><%=LANG["str_connectionlimit5"]%>:</td><td><input id="connect_timeout" type="text" value="0" style="width:100px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> <%=LANG["str_minute"]%></td></tr>
		</table>
		</fieldset>
		</td></tr>
		</table>	
	</div>
	<div id="tagContent4">
		<table cellSpacing="0" cellPadding="0" border="0">
		<tr><td>
		<fieldset>
		<legend><b><%=LANG["str_limitgroupspecial"]%>(0 = <%=LANG["str_nolimit"]%>)</b></legend>
		<table width="100%" cellSpacing="0" cellPadding="2" border="0">
		<tr><td><%=LANG["str_group_downspeed"]%>:</td><td><input id="max_download_group" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		<tr><td><%=LANG["str_group_upspeed"]%>:</td><td><input id="max_upload_group" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		</table>
		</fieldset>
		</td></tr>

		<tr><td height="30"></td></tr>

		<tr><td>
		<fieldset>
		<legend><b><%=LANG["str_limitdomainoverride"]%>(0 = <%=LANG["str_nolimit"]%>)</b></legend>
		<table width="100%" cellSpacing="0" cellPadding="2" border="0">
		<tr><td><%=LANG["str_session_downspeed"]%>:</td><td><input id="max_download" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		<tr><td><%=LANG["str_session_upspeed"]%>:</td><td><input id="max_upload" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		<tr><td><%=LANG["str_account_downspeed"]%>:</td><td><input id="max_download_account" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		<tr><td><%=LANG["str_account_upspeed"]%>:</td><td><input id="max_upload_account" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> KB/s</td></tr>
		<tr><td><%=LANG["str_transferlimit7"]%>:</td><td><input id="idle_timeout" type="text" value="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> <%=LANG["str_minute"]%></td></tr>
		</table>
		</fieldset>
		</td></tr>

		</table>	
	</div>
	<div id="tagContent5">
		<table id="listhead2" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_network.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_groupip_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="70%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable2', 0);"><%=LANG["title_ip"]%></td>
			<td class="listhead" width="30%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable2', 1);"><%=LANG["title_allowdeny"]%></td>
			</tr>
			<tr>
			<td colspan="2">
			<span id="listview_div2" style="float:left; height:260px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable2" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddBlockIP();"><span><em><%=LANG["button_addblockip"]%></em></span></button><button onclick="ModifyBlockIP();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteBlockIP();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpBlockIP();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownBlockIP();"><span><em><%=LANG["button_down"]%></em></span></button>
		</td>
		</tr>
		</table>

	</div>
	<div id="tagContent6">
		<table id="listhead3" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_server.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_groupfile_tip"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" width="70%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable3', 0);"><%=LANG["title_file"]%></td>
			<td class="listhead" width="30%" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable3', 1);"><%=LANG["title_allowdeny"]%></td>
			</tr>
			<tr>
			<td colspan="2">
			<span id="listview_div3" style="float:left; height:260px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable3" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		<tr>
		<td>
		<button onclick="AddBlockfile();"><span><em><%=LANG["button_addblockfile"]%></em></span></button><button onclick="ModifyBlockfile();"><span><em><%=LANG["button_modify"]%></em></span></button><button onclick="DeleteBlockfile();"><span><em><%=LANG["button_delete"]%></em></span></button><button onclick="UpBlockfile();"><span><em><%=LANG["button_up"]%></em></span></button><button onclick="DownBlockfile();"><span><em><%=LANG["button_down"]%></em></span></button>		
		</td>
		</tr>
		</table>

	</div>
	<div id="tagContent8">
		<table id="listhead3" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">

		<tr><td>
		<table cellSpacing="0" cellPadding="0" border="0"><tr>
		<td><img src="images/vista_group.gif">&nbsp;&nbsp;&nbsp;</td><td><%=LANG["str_group_allusers"]%></td>
		</tr></table>
		</td></tr>

		<tr>
		<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #919B9C;">
			<tr>
			<td class="listhead" onmouseover="className='listhead2';" onmouseout="className='listhead';" onmousedown="sortTable(this,'listtable8', 0);"><%=LANG["title_username"]%></td>
			</tr>
			<tr>
			<td>
			<span id="listview_div8" style="float:left; height:260px; width:100%; background-color:#FFF; overflow:auto; overflow-x:hidden;">
			<table id="listtable8" width="100%" border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed;"></table>
			</span>
			</td></tr>
		</table>
		</td></tr>

		</table>

	</div>

  </div>	
</div>

<div style="padding:3px;text-align:right;margin-top:5px;margin-right:10px;">
<button type='submit' onclick='addGroupSubmit();'><span><em><%=LANG["button_submit"]%></em></span></button>&nbsp;
<button onclick='top.closewindow();'><span><em><%=LANG["button_cancel"]%></em></span></button>
</div>

<script type="text/javascript">

$("tagContent1").style.display="block";
$("tags").getElementsByTagName("li")[1].className="selectedTag";
$("groupname").focus();

groupInit();


function switchTag(tagContent,obj){

	for(var i=1; i<$("tags").getElementsByTagName("li").length; i++)
	{
		$("tags").getElementsByTagName("li")[i].className="normalTag";
	}
	obj.parentNode.className="selectedTag";
	
	for(var j=0; j<$("tagContent").getElementsByTagName("div").length; j++)
	{
		$("tagContent").getElementsByTagName("div")[j].style.display="none";
	}
	$(tagContent).style.display="block";
	selectedRow = null;
	lastsortcol = -1;
	if(lastObj != null)
		lastObj.className = "listtr01";
}

</script>
</body>
</html>

<% end %>

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