Location: PHPKode > scripts > Cwfm > cwfm/php/Tree.php
<?
//////////////////////////////////////////////////////////////////////
//
// Tree.php - Cwfm
//
// By Vincenzo Valvano - hide@address.com
// Context menu Script derived from a work by Dynamic Drive 
// (www.dynamicdrive.com) 
//
// This program is free software; you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version. This program 
// is distributed in the hope that it will be useful, but WITHOUT 
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
// License for more details. You should have received a copy of the 
// GNU General Public License along with this program; if not, write 
// to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
// Boston, MA  02111-1307  USA
//////////////////////////////////////////////////////////////////////
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
session_start();
include_once("Global.php");
include_once("data/Cwfmini.php");
if( !ValidSession() )
{
	IntrusionNotify();
	exit;
}
include_once("lang/$Language.php");

function dirImg($ndir, $link)
{
	global $ShowIcons;

	if( !$ShowIcons )
		return(" ");
	else
	{
		if( $link )
			return("<img src=\"img/small/FolderB.png\"  border=\"0\" name=\"$ndir\">");
		else
			return("<img src=\"img/small/Folder.png\"  border=\"0\" name=\"$ndir\">");
	}
}
function openImg($ndir, $link)
{
	global $ShowIcons, $HTTP_USER_AGENT;

	if( !$ShowIcons )
	{
		$r = " onClick=\"SetStatus();HideRename();SetLastSelDir();";
		if( !strstr($HTTP_USER_AGENT, "MSIE 5.0") )
			$r .= ";SetDir('$ndir')\"";
		else
			$r .= "\"";
	}
	else
	{
		if( $link )
			$img = 'img/small/OpenFolderB.png';
		else
			$img = 'img/small/OpenFolder.png';
		$r = " onClick=\"MM_swapImage('$ndir','','$img',$link);SetStatus();HideRename();SetLastSelDir()";
		if( !strstr($HTTP_USER_AGENT, "MSIE 5.0") )
			$r .= ";SetDir('$ndir')\"";
		else 
			$r .= "\"";
	}
	return($r);
}

function restoreFolder($link)
{
	global $ShowIcons;

	if( !$ShowIcons )
		return("");
	else
	{
		$r = " onClick=\"MM_swapImage('/','','img/small/Root.png',$link);\"";
		return($r);
	}
}

function rootImg()
{
	global $ShowIcons;

	if( !$ShowIcons )
		return("");
	else
		return("<img src=\"img/small/Root.png\" align=\"absmiddle\" border=\"0\" name=\"/\">");
}

function mycmp($a, $b)
{
	return(strnatcasecmp($a[0], $b[0]));
}


function GetTree($sPath) 
{ 
	global $cwfmPath;
	
	//Load Directory Into Array 
	$handle = @opendir($sPath); 
	$n = -1;
	while( ($file=@readdir($handle)) !== false ) 
	{
		if( $file == "." || $file == ".." )
			continue;
		if( !@file_exists($sPath.$file) )
			continue;
		if( !@is_dir($sPath.$file) )
			continue;
		if( $cwfmPath != "" && ($sPath.$file == $cwfmPath) )
			continue;
		if( $n == -1 )
			$retVal = array();
		$n++;
		$retVal[$n][0] = $file; 
		if( IsWin32() )
			$retVal[$n][1] = 0;
		else
			$retVal[$n][1] = is_link($sPath.$file);
	}
	//Clean up and sort 
	@closedir($handle); 
	if( isset($retVal) )
	{
		usort($retVal, "mycmp"); 
		return $retVal; 
	}
	else
		return(NULL);
}

function hasSubdir($d)
{
	if( ($handle=@opendir($d)) == 0 )
		return(FALSE);
	while( ($file=readdir($handle)) !== false ) 
	{
		if( $file == "." || $file == ".." )
			continue;
		if( !@file_exists($d."/".$file) )
			continue;
		if( is_dir($d."/".$file) )
		{
			closedir($handle); 
			return(TRUE);
		}
	}
	closedir($handle); 
	return(FALSE); 
}


function isempty($dir)
{
	if( ($d=@opendir($dir)) == false )
		return(-1);
	while( ($entry=@readdir($d)) !== false ) 
	{ 
		if ($entry != "." && $entry != ".." && $entry != "") 
		{ 
			closedir($d);
			return(0);
		} 
	} 
	closedir($d); 
	return(1);
}


function rmdirR($dir) 
{ 
	if( ($d=@opendir($dir)) == false )
		return(false);
	while( ($entry=@readdir($d)) !== false ) 
	{ 
		if ($entry != "." && $entry != ".." && $entry != "") 
		{ 
			if (is_dir($dir."/".$entry)) 
			{
				if( rmdirR($dir."/".$entry) == false)
					return(false);
			}	
			else 
			{
				if( @unlink($dir."/".$entry) == false )
					return(false);
			}	
		} 
	} 
	closedir($d); 
	if( @rmdir($dir) == false )
		return(false); 
	return(1);
}

function clickAction($s1, $s, $link, $open, $id, $hassub)
{
	global $HTTP_USER_AGENT;
	
	if( !strstr($HTTP_USER_AGENT, "MSIE 5.0") )
		$ret = "<a href=\"File.php?command=goto&dir=$s1\" target=\"mainFrame\" ";
	else		
		$ret = "<a href=\"MainMenu.php?command=goto&dir=$s1\" target=\"MainMenuFrame\" ";
	$ret .= openImg($s1, $link)." onMouseOver=\"OnContext('$s1', $link, $id, '$s', $hassub)\" onMouseOut=\"OffContext()\">".dirImg($s1, $link)."$s</a>";
	return($ret);
}


/*
*	Prints directory listing with open trees recursively
*
*	$command : ('goto', 'open', 'close', 'refresh') indicates the type of operation to be done
*	$target  : is the (relative) directory name selected for the operation (goto, open, close, refresh)
*	$parent  : is the directory from witch the function prints dir & subdir
*	$level	 : nesting level (starts from 0)
*/

if( $ShowIcons )
	$dX = 20;
else
	$dX = 27;
$offsetTop = 30; $dY = 22; 
$Id=0; $wX=7;

function printTree($command, $target, $parent, $level)
{
	global $oTarget, $iPath, $LoBgCol, $offsetTop, $dY, $dX, $Id, $wX;
	$a = array();
	
	if( $target != "/"  )
		$target = $target."/";
	if( $parent != "/" )
		$parent = $parent."/";
	if( ereg( '(^/[^/]*)(.*)', $target, $a) )
	{
		$left = $a[1];
		$right = $a[2];
	}
	else
		$left = $right = "";
	$d = GetTree($iPath.$parent);
	$offsetLeft = 35+$level*19;
	for($i=0; $d != NULL && $i < count($d); $i++)
	{
		$s = $d[$i][0];
		$width = 60 + strlen($s) * $wX;
		$s1 = $parent.$s;
		if( ($command == "open") && $left == ("/".$s))
		{
			$oL = $offsetLeft-$dX;
			echo "<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"$s1\" href=\"Tree.php?command=close&target=$s1#$s1\">[-]</a>";
			$offsetTop += $dY;
			printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1], 1, $Id, 1));
			$Id++;
			printTree($command, $right, $parent.$s, $level+1);
		}
		else
		if( ($command == "refresh") && $left == ("/".$s))
		{
			$s1 = $parent.$s;
			if( hasSubdir($iPath.$s1) )
			{
				$oL = $offsetLeft-$dX;
				printf("<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=close&target=%s#%s\">[-]</a>",$s1, $s1, $s1);
				printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1], 1, $Id, 1));
				$Id++;
			}
			else
			{
				printf("<div id=\"A$Id\" style=\"position:absolute;left:$offsetLeft;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=close&target=%s#%s\"></a>",$s1, $s1, $s1);
				printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1], 1, $Id, 0));
				$Id++;				
			}
			$offsetTop += $dY;			
			printTree($command, $right, $parent.$s, $level+1);
		}
		else
		if( $command == "close" )
		{
			$s1 = $parent.$s;
			if( $left != "/".$s )
			{
				$oL = $offsetLeft-$dX;
				if( hasSubdir($iPath.$s1) )
				{
					printf("<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=open&target=%s#%s\">[+]</a>", $s1, $s1, $s1);
					printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id, 1));
				}
				else
					printf( "<div id=\"A$Id\" style=\"position:absolute;left:$offsetLeft;top:$offsetTop;width:$width\">%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id,0));
				$Id++;
				$offsetTop += $dY;			
			}
			else
			{
				$oL = $offsetLeft-$dX;
				if( $oTarget != $parent.$s )
				{
					printf("<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=close&target=%s#%s\">[-]</a>",$s1, $s1, $s1);
					printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id,1));
					$offsetTop += $dY;
					$Id++;
					printTree($command, $right, $parent.$s, $level+1);
				}
				else
				{
					$s1 = $parent.$s;
					printf("<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=open&target=%s#%s\">[+]</a>", $s1, $s1, $s1);
					printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id,1));
					$offsetTop += $dY;
					$Id++;
				}
			}
		}
		else
		{
			$oL = $offsetLeft-$dX;
			if( hasSubdir($iPath.$s1) )
			{
				printf("<div id=\"A$Id\" style=\"position:absolute;left:$oL;top:$offsetTop;width:$width\"><a name=\"%s\" href=\"Tree.php?command=open&target=%s#%s\">[+]</a>", $s1, $s1, $s1);
				printf( "%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id,1));
			}
			else
			{
				printf( "<div id=\"A$Id\" style=\"position:absolute;left:$offsetLeft;top:$offsetTop;width:$width\">%s</div>\n", clickAction($s1, $s, $d[$i][1],0, $Id,0));
			}
			$offsetTop += $dY;
			$Id++;			
		}
	}
}
?>
<html>
<head>
<title>Tree.php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet href="Css.php" type="text/css">
<style>
<!--
.skin0{
position:absolute;
width:130px;
border-bottom:2px solid #555555;
border-right:2px solid #555555;
border-top:2px solid #EEEEEE;
border-left:2px solid #EEEEEE;
background-color:menu;
font-family:Verdana;
line-height:15px;
cursor:default;
font-size:10px;
z-index:100;
visibility:hidden;
}

.menuitems{
padding-left:10px;
padding-right:10px;
}
.menudisabled{
padding-left:10px;
padding-right:10px;
color:#8F8F8F;
}

-->
</style>

<script language="JavaScript">
function MM_findObj(n, d) 
{ //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

var lSel = "";
var lSelLink = 0;

function MM_swapImage() 
{ 
	var i,j=0,x,tmp, timg, a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	
	tmp = a[0];
	timg = a[2];
	a[0] = lSel;
	if( lSelLink )
		a[2] = 'img/small/FolderB.png';
	else
		a[2] = 'img/small/Folder.png';
	for(i=0;i<(a.length-2);i+=3)
	{
		if( (x=MM_findObj(a[i]))!=null)
		{
			document.MM_sr[j++]=x; 
			if(!x.oSrc) 
				x.oSrc=x.src; 
			x.src=a[i+2];
		}
	}
	if( tmp != '/' )
	{
		a[0] = tmp;
		a[2] = timg;
		for(i=0;i<(a.length-2);i+=3)
		{
			if( (x=MM_findObj(a[i]))!=null)
			{
				document.MM_sr[j++]=x; 
				if(!x.oSrc) 
					x.oSrc=x.src; 
				x.src=a[i+2];
			}
		}
		lSel = a[0];
		lSelLink = a[3];
	}
	else
		lSel = '';
}
function SetStatus()
{
	parent.Done = 2;
}
function RefreshDir(d)
{
	var id = parent.MainMenuFrame.document.getElementById("dirtext");
	id['innerHTML'] = '<strong>'+d+'</strong>';
}
function SetDir(d)
{
	parent.Dir = d;
}
function OpenDir()
{
<? if( $ShowIcons ) { ?>
	if( Link )
		MM_swapImage(Dir,'','img/small/OpenFolderB.png',Link)
	else
		MM_swapImage(Dir,'','img/small/OpenFolder.png',Link)
<? } ?>
	SetStatus();
	SetDir(Dir);
	window.open('File.php?command=goto&dir='+parent.LastSelDirLong, 'mainFrame','');
}

function MakeDir()
{
	var w = 400;
	var h = 100;
	var top = (screen.height-h)/2 - 50;
	var left = (screen.width-w)/2;

	window.open('MakeDir.php?dir='+parent.LastSelDirLong,'Makedir','width='+w+',height='+h+',top='+top+',left='+left);
}
function RmDir()
{
	window.open('RemoveDir.php?dir='+parent.LastSelDirLong, 'rightFrame','');
}
function Copy()
{
	var id = document.getElementById("paste");
 	id.className='menuitems';
	id.style.backgroundColor="";
	id.style.color="";
	parent.DirCopyState = 1;
	window.open('DirCopy.php?dir='+parent.LastSelDirLong, 'rightFrame','');
}

function Cut()
{
	var id = document.getElementById("paste");
 	id.className='menuitems';
	id.style.backgroundColor="";
	id.style.color="";
	parent.DirCopyState = 1;
	window.open('DirCut.php?dir='+parent.LastSelDirLong, 'rightFrame','');
}
function Paste()
{
	parent.DirCopyState = 0;
	window.open('DirPaste.php?dir='+parent.LastSelDirLong, 'rightFrame','');
}

var Over=0;
var Dir='';
var Link = 0;
var Id = -1;
var Dd='';
var Hs=0;

function OnContext(d, ln, id, dd, hs)
{
	Over=1;
	Dir=d;
	Id=id;
	Link = ln;
	Dd = dd;
	Hs=hs;
}
function OffContext()
{
	Over=0;
}

function SetLastSelDir()
{
	parent.LastSelDirId=Id;
	parent.LastSelDir=Dd;
	parent.LastSelDirHs=Hs;
	parent.LastSelDirLong=Dir;
}
function Rename()
{
	var id=document.getElementById("ddir");
	var lid=document.getElementById('A'+parent.LastSelDirId);
<? if( strstr($HTTP_USER_AGENT, "Mozilla/5") ) { ?>
	id.style.top=lid.offsetTop+3;
	if( parent.LastSelDirHs )
		id.style.left=lid.offsetLeft+37;
	else
		id.style.left=lid.offsetLeft+17;
<? } else { ?>
	id.style.top=lid.offsetTop+2;
	if( parent.LastSelDirHs )
		id.style.left=lid.offsetLeft+37;
	else
		id.style.left=lid.offsetLeft+16;
<? } ?>
	document.dir.dir.value=parent.LastSelDir;
	document.dir.dir.size=parent.LastSelDir.length+4;
	id.style.visibility="visible"
	document.dir.dir.select();
	document.dir.dir.focus();
}
function ExecRename()
{
	if( document.dir.dir.value == "" )
	{
		alert('<?echo $A48_L?>');
		return;
	}
	window.open('RenameDir.php?dir='+parent.LastSelDirLong+'&n='+document.dir.dir.value, 'rightFrame', '');
}
function HideRename()
{
	var id=document.getElementById("ddir");
	id.style.visibility="hidden";
}
</script>
</head>
<body>
<div id="ddir" class="dir" display:hidden ><form name="dir" class="dir" action="javascript:ExecRename()">
<input type="text" class="dir" name="dir"  maxlength="255">
</form></div>
<div id="ie5menu" class="skin0" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:hidden>
<div class="menuitems" js="OpenDir()"><? echo $L26_L ?></div>
<hr width="95%">
<? if( $CanCut && $CanRmdir ) { ?>
<div id="cut" class="menuitems" js="Cut()"><? echo $L5_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L5_L ?></div>
<? } ?>
<? if( $CanCopy ) { ?>
<div id="copy" class="menuitems" js="Copy()"><? echo $L6_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L6_L ?></div>
<? } ?>
<hr width="95%">
<? if( $CanPaste ) { ?>
<div id="paste" class="menudisabled" js="Paste()"><? echo $L7_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L7_L ?></div>
<? } ?>
<hr width="95%">
<? if( $CanMkdir ) { ?>
<div class="menuitems" js="MakeDir()"><? echo $L47_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L47_L ?></div>
<? } ?>
<? if( $CanRmdir ) { ?>
<div id="rmdir" class="menuitems" js="RmDir()"><? echo $L18_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L18_L ?></div>
<? } ?>
<? if( $CanRendir ) { ?>
<div id="rename" class="menuitems" js="Rename()"><? echo $L19_L ?></div>
<? } else { ?>
<div class="menudisabled"><? echo $L19_L ?></div>
<? } ?>
</div>
<?
	global $target, $command, $ipath;

	if( $ipath != "" )
		$ipath = $$ipath;
	$oTarget = $target;
	if( $command == "" )
	{ // First invocation from browser or area change
		if( $ipath != "" )
			$iPath = $ipath;
		else
			$iPath = $DefRoot;
		if( Last($iPath) != "/" )
			$iPath .= "/";
		if( $iPath == "/" )
			$iPath = "";
		printf("<a href=\"MainMenu.php?command=goto&dir=/\" target=\"MainMenuFrame\" onClick=\"SetLastSelDir()\" onMouseOver=\"OnContext('/', 0,-1)\" onMouseOut=\"OffContext()\"%s>%s/</a><br>", restoreFolder(0),
			rootImg());
		printTree("", "", "/", 0);
		echo "<script language=\"JavaScript\">\n";
		echo "parent.Done--;\n";
		echo "window.open('MainMenu.php?command=goto&dir=/', 'MainMenuFrame', '');\n";
		echo "</script>\n";
	}
	else
	{
		if( $command == "rmdir" && $CanRmdir && $target != "" && $target != "/" )
		{
			if( !OkDir($target,1) )
				exit;
			$d = $iPath.$target;
			if( !isempty($d) )
				$r = rmdirR($d);
			else
				$r = @rmdir($d);
			if( !$r )
			{
				echo "<script language=\"JavaScript\">\n";
				echo "alert('$A28_L $target $A28B_L');\n";
				echo "</script>\n";
			}
			else
			{
				$a = explode("/", $target);
				$r = "";
				for($i=1; $i < count($a)-1; $i++ )
					$r = $r."/".$a[$i];
				if( $r == "" )
					$target = "/";
				else
					$target = $r;
				$command = "refresh";
				echo "<script language=\"JavaScript\">\n";
				echo "window.open('MainMenu.php?command=goto&dir=$target', 'MainMenuFrame', '');\n";
				echo "</script>\n";
			}
		}
		printf("<a href=\"MainMenu.php?command=goto&dir=/\" target=\"MainMenuFrame\" onClick=\"SetLastSelDir()\" onMouseOver=\"OnContext('/', 0,-1)\" onMouseOut=\"OffContext()\"%s>%s/</a><br>", restoreFolder(0),
				rootImg() );
		printTree($command, $target, "/", 0);
	}
	if( $ipath != "" )
	{
		echo "<script language=\"JavaScript\">\n";
		echo "window.open('MainMenu.php?command=goto&dir=/', 'MainMenuFrame', '');\n";
		echo "</script>";
	}
?> 
<script language="JavaScript1.2">
var display_url=0;
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
if (ie5||ns6)
	var menuobj=document.getElementById("ie5menu");

function enableItem(name)
{
	var id = document.getElementById(name);
 	id.className='menuitems';
	id.style.backgroundColor="";
	id.style.color="";
}
function disableItem(name)
{
	var id = document.getElementById(name);
 	id.className='menudisabled';
	id.style.backgroundColor="";
	id.style.color="";
}

function showmenuie5(e)
{
	HideRename();
	hidemenuie5(e);
	var ie5=document.all&&document.getElementById
	var ns6=document.getElementById&&!document.all
	if (ie5||ns6)
	{
		if( Over )
		{
			var menuobj=document.getElementById("ie5menu");
			if( Id == -1 )
			{
			 	disableItem('rename');
			 	disableItem('rmdir');
			 	disableItem('cut');
			 	disableItem('copy');
			}
			else
			{
			 	enableItem('rename');
			 	enableItem('rmdir');
			 	enableItem('cut');
			 	enableItem('copy');
			}
			parent.LastSelDirId=Id;
			parent.LastSelDir=Dd;
			parent.LastSelDirLong=Dir;
			parent.LastSelDirHs=Hs;
		}
		else
			return false;
	}
//Find out how close the mouse is to the corner of the window
	var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
	var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY

//if the horizontal distance isn't enough to accomodate the width of the context menu
	if (rightedge<menuobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
//		menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth
		menuobj.style.left= 2;
	else
//position the horizontal position of the menu where the mouse was clicked
		menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX

//same concept with the vertical position
	if(bottomedge<menuobj.offsetHeight)
		tmp=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight
	else
		tmp=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY
	if( tmp < 2 )
		tmp = 2;
	menuobj.style.top = tmp;
	menuobj.style.visibility="visible"
	return false
}

function hidemenuie5(e)
{
	var menuobj=document.getElementById("ie5menu");
	menuobj.style.visibility="hidden";

	menuobj = parent.mainFrame.document.getElementById("ie5menu");
	menuobj.style.visibility="hidden";
	menuobj = parent.mainFrame.document.getElementById("ie5menu2");
	menuobj.style.visibility="hidden";

	menuobj = parent.MainMenuFrame.document.getElementById("File");
	menuobj.style.visibility="hidden";
	menuobj = parent.MainMenuFrame.document.getElementById("Edit");
	menuobj.style.visibility="hidden";
	menuobj = parent.MainMenuFrame.document.getElementById("View");
	menuobj.style.visibility="hidden";
	menuobj = parent.MainMenuFrame.document.getElementById("Dir");
	menuobj.style.visibility="hidden";
	menuobj = parent.MainMenuFrame.document.getElementById("Transfer");
	menuobj.style.visibility="hidden";
	RefreshDir(parent.Dir);
}

function highlightie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems") 
			firingobj=firingobj.parentNode //up one node
		firingobj.style.backgroundColor="highlight"
		firingobj.style.color="white"
		if (display_url==1)
			window.status=event.srcElement.url
	}
}

function lowlightie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems") 
			firingobj=firingobj.parentNode //up one node
		firingobj.style.backgroundColor=""
		firingobj.style.color="black"
		window.status=''
	}
}

function jumptoie5(e)
{
	var firingobj=ie5? event.srcElement : e.target
	if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems")
	{
		if (ns6&&firingobj.parentNode.className=="menuitems") 
			firingobj=firingobj.parentNode
		if (firingobj.getAttribute("js"))
			eval(firingobj.getAttribute("js"))
		else
		if (firingobj.getAttribute("target"))
			window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target"))
		else
			window.location=firingobj.getAttribute("url")
	}
}

function HideAll(e)
{
	hidemenuie5(e);
//	HideRename();
}
if (ie5||ns6)
{
	menuobj.style.display=''
	document.oncontextmenu=showmenuie5
	document.onclick=HideAll
}
</script>

</body>
</html>
Return current item: Cwfm