<%
include("language.html")
if _SESSION["username"] ~= nil and _SESSION["currentpath"] ~= nil then
%>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache, must-revalidate" />
<link href="css/style.css?v=1" rel="stylesheet" type="text/css" />
<head>
<title>Search Files</title>
</head>
<script language="javascript" src="include/common.js"></script>
<script language="javascript">
var EXPTag = "session expired";
var now_dir = "/";
var selectedRow = null;
var lastObj = null;
var searching = false;
var searchfor = "";
var searchin = "";
var download_url = "";
var searchStack = new Array();
var deletelock = false;


function ajaxResponse()
{
	if (xmlhttp.readyState == 4)
	{
		ajaxlock = false;
		if (xmlhttp.status == 200)
		{
			try
			{
				switch(page)
				{
					case 'searchdir':		showlist();break;
					case 'rmfile':			rmfile();break;
					case 'checkdownload':	checkdownload_Result();break;
					case 'weblink':			weblink();break;
					case 'weblink_update':	weblink_update_result();break;
				}
			}
			catch(e)
			{
					//alert("<%=LANG['error_ajax']%>");
			}
			finally
			{
				//$("waitingdiv").style.display = "none";

				$("weblinkDiv_mask2").style.display = "none";
			}
		}
		else
		{
			//$("waitingdiv").style.display = "none";
			//alert("<%=LANG['error_ajax']%>");

		}
	}

	if(page == "rmfile")
	{
		deletelock = false;
	}
}

function sess_expire()
{
	alert("<%=LANG['session_expire']%>");
	top.window.location = "logout.html";
}

function showlist()
{
	//$("waitingdiv").style.display = "";
	try
	{
		var result = trim(xmlhttp.responseText);
		if(result == EXPTag)
		{
			sess_expire();
			return;
		}

		var xmldoc = xmlhttp.responseXML;
		var row = xmldoc.getElementsByTagName("rowdata");
		var rownum = row.length;
		var tr = null;
		selectedRow = null;
		now_dir = xmlFieldValue(xmldoc,"nowdir");

		for(var i=0; i < rownum; i++)
		{
			try
			{
				var myrow = row[i];
				f_img = "";
				f_size = xmlFieldValue(myrow,"size");
				f_name = decodeURIComponent(xmlFieldValue(myrow,"name"));
				f_dir = xmlFieldValue(myrow,"dir");
				f_size = fileSize(f_size);

				if(f_dir != 1)
				{
					var matched = false;
					var filename = f_name.toLowerCase();
					if(searchfor.indexOf("*") != -1)
					{
						matched = true;
						var strArray = searchfor.split("*");
						for(var k=0;k<strArray.length;k++)
						{
							if(trim(strArray[k]) != "" && filename.indexOf(strArray[k]) == -1)
							{
								matched = false;
								break;
							}
						}
					}
					else
					{
						if(filename.indexOf(searchfor) != -1)
							matched = true;
					}
					if(matched == true)
					{
						tr = document.createElement("tr");
						$("maintable").appendChild(tr); 

						if(isIE)
						{
							tr.onclick = function()
							{
								do_list_click(this,-1);
							}
							tr.oncontextmenu = function()
							{
								do_list_click(this,-1,1);
							}
							tr.ondblclick = function()
							{
								do_list_dblclick(this,-1);
							}
						}
						else
						{
							tr.setAttribute('onclick','do_list_click(this,-1);');
							tr.setAttribute('oncontextmenu','do_list_click(this,-1,1);');
						}
						tr.setAttribute('class','listtr01');
						tr.setAttribute('className','listtr01');
						
						var tmpcell = document.createElement("td"); 
						var tmpcell2 = document.createElement("td"); 
						var tmpcell3 = document.createElement("td");
						tmpcell.setAttribute('id',"tr_"+i);
						tmpcell.setAttribute('class','paddingtd');
						tmpcell.setAttribute('className','paddingtd');
						tmpcell.setAttribute('name',htmlencode(f_name));
						tmpcell.setAttribute('path',htmlencode(now_dir));
						tmpcell.innerHTML = htmlencode(f_name)
						tr.appendChild(tmpcell); 
						//tmpcell2.innerHTML = htmlencode(now_dir);
						tmpcell2.innerHTML = htmlencode(now_dir.substr(0,22)+(now_dir.length > 22 ? "...":""));
						tmpcell2.setAttribute('title',htmlencode(now_dir));
						tr.appendChild(tmpcell2); 
						tmpcell3.innerHTML = f_size
						tr.appendChild(tmpcell3); 
					}
				}
				else
				{
					searchStack.push(now_dir+"/"+f_name);
				}
				
				lastsortcol = -1;
				
			}
			catch(e){}
		}
	}
	catch(e)
	{
		stopSearch();
		//$("waitingdiv").style.display = "none";
		var result = trim(xmlhttp.responseText);
		if(result == EXPTag)
		{
			sess_expire();
			return;
		}
	}

	//$("waitingdiv").style.display = "none";
	if(lastArrow != null)
		lastArrow.style.backgroundImage="";

	if(searchStack == null || searchStack.length <= 0)
	{
		stopSearch();
		return;
	}
	
	var reqdir = searchStack.pop();
	if(reqdir != null && reqdir != "")
	{
		ajaxRequest("searchdir","searchin="+urlEncode(reqdir)+"&r="+Math.random());
		$("searchin").value = htmlencode(reqdir);
	}
}


function do_list_click(obj, cellindex, rightmouse)
{
	var row_index = 0;

	if(cellindex >= 0)
		row_index = cellindex;
	else if(cellindex == -2)
		row_index = row_filenum*obj.parentNode.rowIndex+obj.cellIndex;
	else
		row_index = obj.rowIndex-1;

	if(rightmouse == 1)
	{
		if(deletelock == false && searching == false)
		{
			var evt = getEvent();
			$("menu_div").style.visibility = ""; 
			$("menu_div").style.top = evt.clientY - 20; 
			$("menu_div").style.left = evt.clientX;
		}
	}

	if(selectedRow != $("maintable").rows[row_index])
	{
		if(lastObj != null)
			lastObj.className = "listtr01";
		selectedRow = $("maintable").rows[row_index];
		obj.className = "listtr02";
		lastObj = obj;
	}
	else
	{
		if(rightmouse == 1)
			return false;
		if(!isIE)
		{
			downloadFile();
			if(lastObj != null)
			{
				lastObj.className = "listtr01";
				lastObj = null;
			}
			selectedRow = null;		
		}
	}

	return false;
}

function do_list_dblclick(obj,cellindex)
{
	var row_index = 0;
	if(cellindex >= 0)
		row_index = cellindex;
	else if(cellindex == -2)
		row_index = row_filenum*obj.parentNode.rowIndex+obj.cellIndex;
	else
		row_index = obj.rowIndex-1;
	selectedRow = $("maintable").rows[row_index];
	downloadFile();
	return false;
}

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

	if(selectedRow.cells[2].innerHTML != "<%=LANG['list_directory']%>")
	{
		var f_name = selectedRow.cells[0].getAttribute("name");
		var filename = urlEncodeSpecial(htmldecode(f_name));
		var f_path = selectedRow.cells[0].getAttribute("path");
		var pathname = urlEncodeSpecial(htmldecode(f_path));
		var filesize = selectedRow.cells[0].getAttribute("fsize");
		download_url = "/?download&filename="+filename+"&UID=<%=_SESSION_ID%>&nowpath="+pathname+"&r="+Math.random();
		if(isIE)
			checkDownload("checkdownload.html?filename="+filename+"&filesize="+filesize+"&r="+Math.random());
		else
			ajaxRequest("checkdownload","filename="+filename+"&filesize="+filesize+"&r="+Math.random());
	}
}

function checkDownload(url)
{
	var xmlhttpObj = isIE ? new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest();
	xmlhttpObj.open("GET",url,false);
	xmlhttpObj.send("");

	var result = xmlhttpObj.responseText;
	if(result == EXPTag)
	{
		sess_expire();
	}
	else if(result != "")
	{
		alert(result);
	}
	else
	{
		top.window.open(download_url,"_self"); 
	}
}

function checkdownload_Result()
{
	var result = trim(xmlhttp.responseText);
	if(result == EXPTag)
	{
		sess_expire();
	}
	else if(result != "")
	{
		alert(result);
	}
	else
	{
		top.window.open(download_url,"_self"); 
	}
}

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

	var f_name = selectedRow.cells[0].getAttribute("name");
	var filename = urlEncode(htmldecode(f_name));
	var f_path = selectedRow.cells[0].getAttribute("path");
	var pathname = urlEncode(htmldecode(f_path));
	if(confirm("<%=LANG['delete_confirm']%> "+f_name+" ?\r\n") )
	{
		ajaxRequest("rmfile","nowpath="+pathname+"&nowfile="+filename);
		deletelock = true;
	}
}

function rmfile()
{
	var result = trim(xmlhttp.responseText);
	if(result == EXPTag)
	{
		sess_expire();
		return;
	}
	else if(result == "1")
	{
		try
		{
			selectedRow.parentNode.removeChild(selectedRow);
			top.ajaxRequest("dir",'r='+Math.random());
		}
		catch(e){}
	}
	else
	{
		alert(result);
	}
	deletelock = false;
}

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

	if(selectedRow.cells[2].innerHTML == "<%=LANG['list_directory']%>")
	{
		alert("<%=LANG['error_edit']%>");
		return;
	}
	else
	{
		var f_name = selectedRow.cells[0].getAttribute("name");
		var filename = urlEncode(htmldecode(f_name));
		var f_path = selectedRow.cells[0].getAttribute("path");
		var pathname = urlEncode(htmldecode(f_path));
		var frametag = new Date().getTime();
		showMessagebox("<span title='"+f_name+"'>"+f_name.substr(0,55)+(f_name.length > 55 ? "...":"")+"</span>","<iframe src='editor.html?dir="+pathname+"&filename="+filename+"&r="+Math.random()+"' width=720 height=520 border=0 frameborder=0 id='modify"+frametag+"'></iframe>",null,720,520);
	}
}

function selectTime()
{
	var strMyDate = "";
	var strMyTime = "";

	var timevalue = top.$("expiretime").value;
	if(timevalue != "")
	{
		var timeArray = timevalue.split(" ");
		strMyDate = timeArray[0];
		strMyTime = timeArray[1];
	}
	var frametag = new Date().getTime();
	showMessagebox("<%=LANG['str_selecttime']%>","<iframe src='select_time.html?mydate="+strMyDate+"&mytime="+strMyTime+"&seeds=" + Math.random() +"' width=280 height=320 border=0 frameborder=0 id='modify"+frametag+"'></iframe>",selectTime_callback,280,320);
}

function selectTime_callback(str)
{
	if(str != "" && str != null)
		top.$("expiretime").value = str;
}

function formatLimitNumber(numbervalue)
{
	top.$("downloadlimit").value = numbervalue.replace(/\D/g,'');
}

function clearTime()
{
	top.$("expiretime").value = "";
}

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

	if(selectedRow.cells[2].innerHTML != "<%=LANG['list_directory']%>")
	{
		var f_name = htmldecode(selectedRow.cells[0].getAttribute("name"));
		var f_path = htmldecode(selectedRow.cells[0].getAttribute("path"));

		$("weblinkDiv_mask").style.display = "";

		showMessagebox("<%=LANG['weblink_title']%>","<table width='100%' border='0' cellpadding='2' cellspacing='3'><tr><td style='padding-left:10px;padding-top:15px;' colspan=2><input type='checkbox' id='enable_weblink' onclick='top.window.frames[1].clickWeblink();' tabindex='34'> <b><%=LANG['enable_weblink']%></b></td></tr><tr><td style='padding-left:10px;' colspan=2><textarea id='weblink_text' style='width:480px;height:85px' disabled tabindex='35'> </textarea></td></tr><tr><td style='padding-left:10px;width:140px;'><%=LANG['str_expire_on']%>:</td><td><input id='expiretime' type='text' value='' disabled onclick='selectTime();' style='width:150px;' readonly tabindex='36'> <span><em><img src='images/clean.gif' align='absmiddle' id='btn_clear_date' onclick='clearTime();' title='Clean' style='border: 1px solid #666; padding:0px; cursor:pointer;' tabindex='37'>&nbsp;</em></span> <%=LANG['str_optional']%></td></tr><tr><td style='padding-left:10px; width:110px;'><%=LANG['str_download_limit']%>:</td><td><input id='downloadlimit' type='text' maxlength='6' value='' disabled onkeyup='formatLimitNumber(this.value);' onafterpaste='formatLimitNumber(this.value);' style='width:150px;' tabindex='38'> <%=LANG['str_optional']%></td></tr><tr><td style='padding-left:10px; width:110px;'><%=LANG['password']%></td><td><input id='downloadpass' type='text' maxlength='30' value='' disabled style='width:150px;' tabindex='39'> <button onclick='generateRandom();' title='<%=LANG['str_generate_pass']%>'><span style='vertical-align:middle;'><em><img src='images/password.gif' align='absmiddle'>&nbsp;</em></span></button> <%=LANG['str_optional']%></td></tr><tr><td style='padding-left:6px;'><input type='checkbox' id='enable_sendmail' tabindex='40' onclick='enableSendMail();' value='1' disabled> <%=LANG['str_sendmail']%>:</td><td><input id='mail_address' type='text' maxlength='100' tabindex='41' onblur=\"if(this.value=='') this.value='<%=LANG['str_multiple_emails']%>'\" onclick=\"if(this.value =='<%=LANG['str_multiple_emails']%>' ) this.value=''\" value='<%=LANG['str_multiple_emails']%>' style='width:320px;color:#898989;' disabled></td></tr><tr><td style='padding-left:30px;'><%=LANG['str_senderemail']%>:</td><td><input id='sender_mail_address' type='text' maxlength='80' tabindex='42' style='width:180px; color:#898989;' disabled> <%=LANG['str_optional']%></td></tr><tr><td style='padding-left:30px;'><%=LANG['str_field_message']%> <%=LANG['str_optional']%>:</td><td><textarea id='mail_message' style='width:320px;height:35px' maxlength='300' tabindex='43' disabled></textarea> </td></tr><tr align='center'><td height='50' colspan=2><button id='btn_submit' type='submit' onclick='top.window.frames[1].update_weblink();' tabindex='44'><span><em><%=LANG['create_submit']%></em></span></button>&nbsp;&nbsp;&nbsp;<button id='btn_cancel' onclick='top.closewindow();' tabindex='45'><span><em><%=LANG['create_cancel']%></em></span></button></td></tr></table>",top.window.frames[1].closeWindow,530,400);

		top.$("enable_weblink").focus();

		ajaxRequest("weblink","operation=get&filename="+urlEncode(f_name)+"&nowdir="+urlEncode(f_path) );

		if(isIE)
		{
			top.$("enable_weblink").onclick = function(){clickWeblink();};
			top.$("expiretime").onclick = function(){selectTime();};
			top.$("btn_clear_date").onclick = function(){clearTime();};
			top.$("btn_submit").onclick = function(){update_weblink();};
			top.$("btn_cancel").onclick = function(){top.closewindow();};
		}
	}
	else
	{
		alert("<%=LANG['error_edit']%>");
	}
}

function closeWindow()
{
	$("weblinkDiv_mask").style.display = "none";
}

function enableSendMail()
{
	if(top.$("enable_sendmail").checked)
	{
	<% if enable_sendmessage == true then %>
		top.$("mail_address").disabled = false;
		top.$("sender_mail_address").disabled = false;
		top.$("mail_message").disabled = false;
	<% else %>
		alert("<%=LANG['str_no_smtpconfig']%>");
	<% end %>
	}
	else
	{
		top.$("mail_address").disabled = true;
		top.$("sender_mail_address").disabled = true;
		top.$("mail_message").disabled = true;
	}
}

function update_weblink()
{
	var f_name = htmldecode(selectedRow.cells[0].getAttribute("name"));
	var f_path = htmldecode(selectedRow.cells[0].getAttribute("path"));
	var expiretime = htmldecode(top.$("expiretime").value);
	var downloadlimit = htmldecode(top.$("downloadlimit").value);
	var downloadpass = htmldecode(top.$("downloadpass").value);
	var sendmail = (top.$("enable_sendmail").checked ? "yes":"");

	var mailaddress = htmldecode(top.$("mail_address").value);
	var sender_mailaddress = htmldecode(top.$("sender_mail_address").value);
	var mail_message = htmldecode(top.$("mail_message").value);
	var localaddress = location.protocol + "//" + location.host + "/";
	var hostname = location.hostname;

	if(top.$("enable_weblink").checked)
	{
		ajaxRequest("weblink_update","filename="+urlEncode(f_name)+"&nowdir="+urlEncode(f_path)+"&sendmail="+sendmail+"&mailaddress="+urlEncode(mailaddress)+"&sender_mailaddress="+urlEncode(sender_mailaddress)+"&mail_message="+urlEncode(mail_message)+"&hostname="+urlEncode(hostname)+"&localaddress="+urlEncode(localaddress)+"&expiretime="+urlEncode(expiretime)+"&downloadlimit="+urlEncode(downloadlimit)+"&downloadpass="+urlEncode(downloadpass)+"&r="+Math.random());

		$("weblinkDiv_mask2").style.display = "";
	}
	top.closewindow();
}

function weblink_update_result()
{
	var result = xmlhttp.responseText;
	if(trim(result) == "Error: sending email")
	{
		alert("<%=LANG['send_email_error']%>");
	}
	else if(trim(result) == "Error: no permission")
	{
		alert("<%=LANG['make_weblink_error']%>");
	}
	else if(trim(result) == "operation successful")
	{
		alert("<%=RESULT_STR[1]%>");
	}

	$("weblinkDiv_mask2").style.display = "none";
}

function clickWeblink()
{
	var f_name = htmldecode(selectedRow.cells[0].getAttribute("name"));
	var f_path = htmldecode(selectedRow.cells[0].getAttribute("path"));

	if(top.$("enable_weblink").checked)
	{
		ajaxRequest("weblink","operation=add&filename="+urlEncode(f_name)+"&nowdir="+urlEncode(f_path) );
	}
	else
	{
		ajaxRequest("weblink","operation=del&filename="+urlEncode(f_name)+"&nowdir="+urlEncode(f_path) );
	}
}

function weblink()
{
	var result = xmlhttp.responseText;
	try
	{
		if(trim(result) == "")
		{
		}
		else if(trim(result) == "noperm")
		{
			alert("<%=LANG['make_weblink_error']%>");

			top.$("enable_weblink").checked = false;
			top.$("weblink_text").value = "";
			top.$("weblink_text").disabled = true;
			top.$("expiretime").disabled = true;
			top.$("downloadlimit").disabled = true;
			top.$("downloadpass").disabled = true;
			top.$("enable_sendmail").disabled = true;
			top.$("mail_address").disabled = true;
			top.$("mail_message").disabled = true;
		}
		else if(trim(result) == "deleted")
		{
			top.$("enable_weblink").checked = false;
			top.$("weblink_text").value = "";
			top.$("weblink_text").disabled = true;
			top.$("expiretime").disabled = true;
			top.$("downloadlimit").disabled = true;
			top.$("downloadpass").disabled = true;
			top.$("enable_sendmail").disabled = true;
			top.$("mail_address").disabled = true;
			top.$("mail_message").disabled = true;
		}
		else
		{
			var f_name = htmldecode(selectedRow.cells[0].getAttribute("name"));
			var filename = urlEncodeSpecial(f_name);

			top.$("enable_weblink").checked = true;
			top.$("weblink_text").disabled = false;
			top.$("expiretime").disabled = false;
			top.$("downloadlimit").disabled = false;
			top.$("downloadpass").disabled = false;
			top.$("enable_sendmail").disabled = false;
			//top.$("mail_address").disabled = false;

			var localaddress = location.href.replace(/\#/g,"");

			var strWebLink = trim(result);
			if(result.indexOf("\r\n") != -1)
			{
				var resultArray = result.split("\r\n");
				strWebLink = resultArray[0];
				if(resultArray[1] >= 0)
					top.$("downloadlimit").value = resultArray[1];
				else
					top.$("downloadlimit").value = "";

				if(resultArray[2] >= 0)
					top.$("expiretime").value = translateTime(resultArray[2]);
				else
					top.$("expiretime").value = "";

				if(resultArray[3] != null && resultArray[3] != "")
					top.$("downloadpass").value = resultArray[3];
				else
					top.$("downloadpass").value = "";

			}

			top.$("downloadlimit").style.color = "#000000";
			top.$("expiretime").style.color = "#000000";

			if(top.$("downloadlimit").value == "0")
				top.$("downloadlimit").style.color = "#FF0000";

			if(top.$("expiretime").value != "")
			{
				if(compareDate(top.$("expiretime").value) == true)
					top.$("expiretime").style.color = "#FF0000";
			}
			top.$("weblink_text").value = localaddress + "?download&weblink="+strWebLink+"&realfilename="+filename;
		}
	}
	catch(e){}
}

function startSearch()
{
	if(trim($("searchfor").value) == "")
	{
		alert("<%=LANG['str_search_tip']%>");
		$("searchfor").focus();
		return;
	}
	searching = true;
	searchfor = htmldecode($("searchfor").value.toLowerCase());
	searchin = htmldecode($("searchin").value);
	$("btn_start").disabled = true;
	$("btn_stop").disabled = false;
	searchStack = null;
	searchStack = new Array();
	if(isIE)
		RemoveRow("maintable");
	else
		clear("maintable");
	ajaxRequest("searchdir","searchin="+urlEncode(searchin)+"&begin=1&searchfor="+urlEncode(searchfor)+"&r="+Math.random());
	$("searchdiv").style.display = "";
}


function menuMouseOver(obj)
{
	obj.style.color="#FFFFFF";
	obj.style.backgroundColor="#1665CB";
	obj.style.cursor="pointer"; 
}

function menuMouseOut(obj)
{
	obj.style.backgroundColor="#FFFFFF";
	obj.style.color="#000000";
}


function stopSearch()
{
	searching = false;
	$("btn_start").disabled = false;
	$("btn_stop").disabled = true;
	$("searchin").value = htmlencode(searchin);
	searchStack = null;
	$("searchdiv").style.display = "none";
}

top.cancelTimerCallback = function()
{
	stopSearch();
}
</script>
</head>
<body style="background-color:#E7E6DA;margin:0px;padding:5px;">


<div id="weblinkDiv_mask" style="position:absolute; z-index:1000; top:0px; left:0px; width:100%; height:100%; background:#777; filter:alpha(opacity=60); opacity:0.60; display:none;" align="center">
</div>

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

<div id="menu_div" style="position:absolute; visibility:hidden; background-color:#FFF; width:178px;" onclick="return false;">
	<div class="menu_out">
	<div class="menu_in">
    <li style="margin-top:4px;" onmouseover="menuMouseOver(this)" onmouseout="menuMouseOut(this)" onclick="downloadFile();"><img src="images/open.gif">&nbsp;&nbsp;<%=LANG["item_download"]%></li>
    <li style="margin-top:4px;" onmouseover="menuMouseOver(this)" onmouseout="menuMouseOut(this)" onclick="deleteFile();"><img src="images/delete.gif">&nbsp;&nbsp;<%=LANG["item_delete"]%></li>
	<li style="margin-top:4px;" onmouseover="menuMouseOver(this)" onmouseout="menuMouseOut(this)" onclick="showDownloadUrl();"><img src="images/geturl.gif">&nbsp;&nbsp;<%=LANG["item_geturl"]%></li>
	<li style="margin-top:4px;" onmouseover="menuMouseOver(this)" onmouseout="menuMouseOut(this)" onclick="editFile();"><img src="images/edit.gif">&nbsp;&nbsp;<%=LANG["item_edit"]%></li>
	</div>
	</div>
</div>


<div style="width:100%; padding-top:2px; overflow-x:hidden;">
<table width="100%" border="0" cellpadding="3" cellspacing="2">
<tr>
<td><%=LANG["str_searchfor"]%>:</td>
<td><input type="text" id="searchfor" style="width:190px;">&nbsp;&nbsp;<%=LANG["str_searchfor_tip"]%></td>
<td align="left"><button id="btn_start" onclick="startSearch();" style="width:90px;"><span><em><%=LANG["str_search"]%></em></span></button></td>
</tr>
<tr>
<td><%=LANG["str_searchin"]%>:</td>
<td><input type="text" id="searchin" style="width:360px;" value="<%=specialhtml_encode(_GET["searchin"])%>"></td>
<td align="left"><button id="btn_stop" onclick="stopSearch();" style="width:90px;" disabled><span><em><%=LANG["str_app_stop"]%></em></span></button></td>
</tr>
</table>
</div>

<div style="width:605px; padding-top:2px; overflow-x:hidden;">
<table id="listhead" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">
<tr>
<td width="280" onmouseover="className='listhead2';" onmouseout="className='listhead';" class="listhead" onmousedown="sortTable(this,'listtable', 0, 'filename');"><%=LANG["thread_name"]%></td>
<td width="205" onmouseover="className='listhead2';" onmouseout="className='listhead';" class="listhead" onmousedown="sortTable(this,'listtable', 1);"><%=LANG["goto_path"]%></td>
<td width="120" onmouseover="className='listhead2';" onmouseout="className='listhead';" class="listhead" onmousedown="sortTable(this,'listtable', 2, 'size');"><%=LANG["thread_size"]%></td>
</tr>
</table>
</div>

<div id="listview_div" style="width:605px; height: 300px; overflow:auto; overflow-x:hidden; border:1px solid #999; border-top:0px; background-color:#FFF;">
<table id="listtable" width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed;">
<thead><tr height="0">
<td width="280"></td>
<td width="205"></td>
<td width="120"></td>
</tr></thead>
<tbody id="maintable"></tbody>
</table>
</div>

<div id="searchdiv" style="display:none;">
<%=LANG["str_searching"]%> <img src="images/loading3.gif" border="0" align="absmiddle">
</div>

<div id="waitingdiv" style="display:none;">
</div>

<script>
$("searchfor").focus();

document.oncontextmenu=function(){
	var evt = getEvent();
	var element = evt.srcElement || evt.target;
	if((element.tagName =="INPUT" || element.tagName == "TEXTAREA"))
		return true; 
	else
		return false; 
}

document.onclick=function(){
	$("menu_div").style.visibility = "hidden";
	$("menu_div").style.top = 0; 
	$("menu_div").style.left = 0; 
}

if(isOpera)
	document.onkeypress = searchKeyDown;
else
	document.onkeydown = searchKeyDown;


function searchKeyDown(e)
{
	if(!e){	// if IE
		e=event;
	}

	var use = false;
	var opened = false;

	if (V_Key[e.keyCode])
		letter=V_Key[e.keyCode];
	else
		letter=String.fromCharCode(e.keyCode);	
	var low_letter= letter.toLowerCase();

	if(letter == "Tab")
	{
		return false;
	}
}

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

<% 
else
	print("<script>alert('"..LANG["session_expire"].."');top.window.location = 'logout.html';</script>")
end 
%>
<noscript><H2><%=LANG["error_nojavascript"]%></H2></noscript>