function winUpfile(msgpath)
{
	window.open(FILE_URL+"/?file=upfile&dir="+msgpath,"objfrmDialog");
	sysOpenDialog(frmDialog);

}
var nowObj;
var nowType;
var nowName="";
var isfocus=false;
var menuskin = "skin1"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
var menu_val="";
var back_val="";
var menu_p="";
var now_name="";
var old_name="";
var nowPath="";
function set_focus(msgobjid,msgtype,msgname)
{
	msgobj=document.getElementById(msgobjid);
	if(!msgobj) return;
	isfocus=true;
	if(nowObj)
	{
		if(nowObj.id==msgobj.id) return;
		nowObj.style.backgroundColor="#ffffff";
		nowObj.style.color="#000000";
	}
	nowObj=msgobj;
	nowType=msgtype;
	nowName=msgname;
	nowObj.style.backgroundColor="#0066CC";
	nowObj.style.color="#ffffff";
	obj=document.getElementById("menuopen");
	obj.style.color="black";
	obj=document.getElementById("menucopy");
	obj.style.color="black";
	obj=document.getElementById("menucut");
	obj.style.color="black";
	obj=document.getElementById("menudel");
	obj.style.color="black";
	obj=document.getElementById("menurename");
	obj.style.color="black";
}
function blur_focus()
{
	if(isfocus)
	{
		isfocus=false;
		return;
	}
	if(!nowObj) return;
	nowObj.style.backgroundColor="#ffffff";
	nowObj.style.color="#000000";
	obj=document.getElementById("menuopen");
	obj.style.color="#cccccc";
	obj=document.getElementById("menucopy");
	obj.style.color="#cccccc";
	obj=document.getElementById("menucut");
	obj.style.color="#cccccc";
	obj=document.getElementById("menudel");
	obj.style.color="#cccccc";
	obj=document.getElementById("menurename");
	obj.style.color="#cccccc";
}
function open_file(msgx)
{
	var obj;
	if(parent.pubOpenId)
	{
		parent.selVal(msgx);
	}
	else
	window.open(msgx,'_blank');
}
function create_folder(msgname)
{
	if(event.keyCode==13)
		window.open("?path="+nowPath+"&act=createfolder&foldername="+msgname,"_self");	
	else if(event.keyCode==27)
		{
			new_folder.style.display='none';
			txtfolder.value="新建文件夹";
		}
		
}
function set_menu(msgobj,msgobj2,msgx,msgp)
{
	set_focus(msgobj);
	menu_val=msgx;
	menu_p=msgp;
	now_name=msgobj2;
}
function open_obj()
{
	if(!nowObj) return;
	if(!nowName&&nowName==""&&nowName=="undefined") return;
	if(nowType=="dir")
		dirOpen(nowPath+"/"+nowName);
	else
		window.open(nowPath+"/"+nowName,"_blank");
	
}




function cut_file()
{
	parent.topwin.path.value=nowPath+"/"+nowName;
	parent.topwin.txtp.value=nowType;
	parent.topwin.txtact.value="cut";
}
function paste_file()
{
	var path="";
	var obj;
	var txtact="";
	var txtp="";
	//obj=parent.topwin.document.getElementById("path");
	path=parent.topwin.path.value;
	txtact=parent.topwin.txtact.value;
	if(path==""||path=="undefined")
	  {
		  alert("请先复制文件!");
		  return;
	  }
	  txtp=parent.topwin.txtp.value;
	window.open("?file=file&act="+txtact+"&actp="+txtp+"&path="+nowPath+"&actpath="+path,'_self');
}
function del_file()
{
	var path;
	var txtp;
	path=menu_val;
	if(confirm('确定要删除吗？'))
	txtp=nowType;
	window.open("?file=file&act=del&path="+nowPath+"&actpath="+nowPath+"/"+nowName+"&actp="+txtp,'_self');
}
function showmenuie5() {
	var rightedge = document.body.clientWidth-event.clientX;
	var bottomedge = document.body.clientHeight-event.clientY;
	if (rightedge < ie5menu.offsetWidth)
	ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
	else
	ie5menu.style.left = document.body.scrollLeft + event.clientX;
	if (bottomedge < ie5menu.offsetHeight)
	ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
	else
	ie5menu.style.top = document.body.scrollTop + event.clientY;
	ie5menu.style.visibility = "visible";
	obj=document.getElementById("menupast");
	//if(parent.topwin.path.value!="")obj.style.color="black";
	return false;
}
function hidemenuie5() {
	ie5menu.style.visibility = "hidden";
	obj=document.getElementById("objview");
	obj.style.display="none";
}
function highlightie5() {
if (event.srcElement.className == "buyokmenu") {
	event.srcElement.style.backgroundColor = "highlight";
	if(event.srcElement.style.color=="black")event.srcElement.style.color = "white";
	if (display_url)
	window.status = event.srcElement.url;
   }
}
function viewwin(msgx)
{
	window.open("?file=file&path="+nowPath+"&viewmod="+msgx,'_self');
}
function lowlightie5() {
	if (event.srcElement.className == "buyokmenu") {
		event.srcElement.style.backgroundColor = "";
		if(event.srcElement.style.color=="white")event.srcElement.style.color = "black";
		window.status = "";
	   }
}
function jumptoie5() {
	if (event.srcElement.className == "buyokmenu") {
	if (event.srcElement.getAttribute("target") != null)
		window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
	else
		window.location = event.srcElement.url;
	   }
}
function open_forlisttype(msgx)
{
	window.open("file_main.asp?path="+nowPath+"&listtype="+msgx,"mainframe");
}
function rename_box()
{
	if(nowName=="") return;
	document.all.txtnewname.value=nowName;
	obj=document.getElementById("renameDialog");
	sysOpenDialog(obj);
	document.all.txtnewname.focus;
}
function createdir_box()
{
	document.all.txtdirname.value="新建文件夹";
	obj=document.getElementById("createdirDialog");
	sysOpenDialog(obj);
	document.all.txtdirname.focus;
}
function rename()
{
	newname=document.all.txtnewname.value;
	if(newname=="")
	{
		alert("新名字不能为空!");
		return;
	}
	if(newname==nowName)return;
	window.open("?file=file&act=rename&path="+nowPath+"&actoldname="+nowPath+"/"+nowName+"&actnewname="+nowPath+"/"+newname+"&actp="+nowType,'_self');

}
function createdir()
{
	newname=document.all.txtdirname.value;
	if(newname=="")
	{
		alert("文件夹名不能为空!");
		return;
	}
	window.open("?file=file&act=createdir&path="+nowPath+"&actdirname="+newname,'_self');

}
function copy_file()
{
	parent.topwin.path.value=nowPath+"/"+nowName;
	parent.topwin.txtp.value=nowType;
	parent.topwin.txtact.value="copy";
}

function name_change()
{
	var strp;
	strp=menu_p;
	if(event.keyCode==13){
	window.open("file_main.asp?act=rename&path="+nowPath+"&oldname="+menu_val+"&newname="+now_name.value+"&p="+strp,"_self");
	}
	else if(event.keyCode==27){
		now_name.readOnly=true;
		now_name.style.backgroundColor='transparent';
		now_name.value=old_name;
	}
}
function show_new_folder()
{
	new_folder.style.display='';
	txtfolder.focus();
}