<?

  echo '<s';
  echo 'cript>
';
  if (!($result1 = mysql_query ('SELECT * FROM categories')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  $total = mysql_num_rows ($result1);
  echo '
var NoOffFirstLineMenus=';
  echo $total;
  echo ';
';
  include 'inc/dmenu/config.php';
  echo '
function BeforeStart(){return}
function AfterBuild(){return}
function BeforeFirstOpen(){return}
function AfterCloseAll(){return}


';
  $i = 0;
  if (!($result1 = mysql_query ('SELECT * FROM categories')))
  {
    exit ('<b>Error:</b>' . mysql_error ());
    ;
  }

  while ($row1 = mysql_fetch_array ($result1))
  {
    $j = 0;
    if (!($result2 = mysql_query ('' . 'SELECT * FROM sub_categories WHERE parent=\'' . $row1['id'] . '\'')))
    {
      exit ('<b>Error:</b>' . mysql_error ());
      ;
    }

    $row2 = mysql_fetch_array ($result2);
    $pieces = split ('
', $row2['name']);
    echo 'Menu';
    echo ++$i;
    echo '=new Array("';
    echo $row1['name'];
    echo '","index.php?tim=';
    echo $_GET['tim'];
    echo '&cat_id=';
    echo urlencode ($row1['name']);
    echo '","",';
    if ($row2['name'])
    {
      echo sizeof ($pieces);
    }
    else
    {
      echo '0';
    }

    if ($i == 1)
    {
      echo ',20,Topic_Width';
    }

    echo ');';
    for ($o = 0; $o < sizeof ($pieces); ++$o)
    {
      echo 'Menu';
      echo $i;
      echo '_';
      echo ++$j;
      echo '=new Array("';
      echo $pieces[$o];
      echo '","index.php?tim=';
      echo $_GET['tim'];
      echo '&cat_id=';
      echo urlencode ($row1['name']);
      echo '~';
      echo urlencode ($pieces[$o]);
      echo '","",0';
      if ($j == 1)
      {
        echo ',20,Sub_Topic_Width';
      }

      echo ');';
    }
  }

  echo '</script>
';
  echo '<s';
  echo 'cript type=\'text/javascript\' src=\'inc/dmenu/menu_com.js\'></script>

<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="';
  echo ($total + 1) * 20;
  echo '"></td></tr></table>
';
?>
