<?
include "config.inc.php";
$form=$_GET["form"];
$field =$_GET["field"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Category ShortCut</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body, table {
	font-family: Tahoma, Verdana, Arial;
	font-size: 9pt;
	text-decoration: none;
}
-->
</style>
<script>
function ok(va) {
	window.opener.<?=$form?>.<?=$field?>.value=va;
	top.window.close();
	return false;	
}
</script>
<script type="text/javascript" src="<?=PLUS_URL?>/menu/doiMenuDOM.js"></script>
<script type="text/javascript" src="<?=PLUS_URL?>/menu/functions.js"></script>
<script type="text/javascript">
var mm2 = new TMainMenu('mm2','vertical');
<?
	$ret=getDdMenuContent(0,0,10,1);
	echo $ret;
	?>
</script>
 	<script language="JavaScript" type="text/JavaScript">
	//xp style
		mm2.SetPosition('relative',0,0);
		mm2.SetCorrection(0,0);
		mm2.SetCellSpacing(2);
		
		mm2.SetExpandIcon(true,'','6');
		mm2.SetType('free');		
		mm2.SetBackground('whitesmoke','images/xp.gif','repeat-y','top left');		
		mm2.SetItemText('','center','','','');
		mm2.SetItemTextHL('','center','','','');
		mm2.SetItemTextClick('','center','','','');
		
		mm2.SetItemDimension(100,20);
		mm2.SetShadow(true,'#B0B0B0',6);
		mm2._pop.SetCorrection(0,0);
		mm2._pop.SetAlpha(90);
		mm2._pop.SetItemDimension(150,20);
		mm2._pop.SetPaddings(1);
		mm2._pop.SetBackground('whitesmoke','images/xp.gif','repeat-y','top left');
		mm2._pop.SetSeparator(125,'right','gray','');
		mm2._pop.SetExpandIcon(true,'',6);
		mm2._pop.SetFont('tahoma,verdana,arial','8pt');
		mm2._pop.SetBorder(1,'gray','solid');
		mm2._pop.SetShadow(true,'#B0B0B0',6);
		mm2._pop.SetDelay(500);
		mm2.Build();
	
</script>
<?
function getDdMenuContent($topid,$pid=0,$level=3,$deepth=1){
	global $catetree;
	foreach($catetree[$pid][child] as $cid){
		//echo $catetree[$cid][name];
		if($catetree[$cid][status]!='yes') continue;
		$title=$catetree[$cid][name];
		//$url=ge_url($cid);
		//$pid = $catetree[$cd][pid];
		$url="ok($cid)";
		echo "var pmDemo$cid = new TPopMenu('$title','0','f','$url','$title');\n";
		if($pid!=$topid){
		$ret.="pmDemo$pid.Add(pmDemo$cid);\n";
		}else{
		$ret.="mm2.Add(pmDemo$cid);\n";
		}
		//if(count($catetree[$cid][child])>0 && $deepth<=$level)  $ret.=getDdMenuContent($topid,$cid,$level,$deepth+1);
		if(count($catetree[$cid][child])>0 && $deepth<=$level) {
		 $ret.=getDdMenuContent($topid,$cid,$level,$deepth+1);
		}
	}
	return $ret;
}
?>