function posterity($fid)
{
global $connection;
//static $children=array();
global $children;
$sql = "SELECT DEPT_ID FROM department WHERE DEPT_PARENT= $fid";
$cursor = exequery( $connection, $sql);
while ($row = mysql_fetch_array($cursor)) {
$children[]=$row[DEPT_ID];
$pid = $row[DEPT_ID];
posterity($pid);
}
return $children;
}