function getChildren($cat_id, $cat_level)
 {
     global $mtconf;
     $database =& JFactory::getDBO();
     $cat_ids = array();
     if ($cat_level > 0) {
         $sql = "SELECT cat_id, cat_name, cat_parent, cat_cats, cat_links FROM #__mt_cats WHERE cat_published=1 && cat_approved=1 && cat_parent= " . $database->quote($cat_id) . ' ';
         if (!$mtconf->get('display_empty_cat')) {
             $sql .= "&& ( cat_cats > 0 || cat_links > 0 ) ";
         }
         $sql .= "\nORDER BY cat_name ASC ";
         $database->setQuery($sql);
         $cat_ids = $database->loadObjectList();
         if (count($cat_ids)) {
             foreach ($cat_ids as $cid) {
                 $children_ids = HTML_mtree::getChildren($cid->cat_id, $cat_level - 1);
                 $cat_ids = array_merge($cat_ids, $children_ids);
             }
         }
     }
     return $cat_ids;
 }