/**
     * Comments manager
     *
     * @param string $rows
     * @param string $search
     * @param object $pageNav
     */
    function Joom_ShowComments_HTML(&$rows, &$search, &$pageNav)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        jimport('joomla.filesystem.file');
        ?>
<script  type="text/javascript" src="<?php 
        echo _JOOM_LIVE_SITE;
        ?>
includes/js/overlib_mini.js"></script>
<form action="index.php" method="post" name="adminForm">
<table cellpadding="4" cellspacing="0" border="0" width="100%">
  <tr>
    <td width="100%"></td>
    <td>
      <?php 
        echo JText::_('JGA_SEARCH');
        ?>
    </td>
    <td>
      <input type="text" name="search" value="<?php 
        echo $search;
        ?>
" class="inputbox" onChange="document.adminForm.submit();" />
    </td>
  </tr>
</table>
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
  <tr>
    <th width="20">
      <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
    </th>
    <th class="title" width="15%">
      <div align="left">
        <?php 
        echo JText::_('JGA_AUTHOR');
        ?>
      </div>
    </th>
    <th width="35%">
      <div align="left">
        <?php 
        echo JText::_('JGA_TEXT');
        ?>
      </div>
    </th>
    <th width="10%">
      <div align="center">
      <?php 
        echo JText::_('JGA_IP');
        ?>
      </div>
    </th>
    <th width="10%">
      <?php 
        echo JText::_('JGA_PUBLISHED');
        ?>
    </th>
    <th width="10%">
      <?php 
        echo JText::_('JGA_APPROVED');
        ?>
    </th>
    <th width="10%">
      <?php 
        echo JText::_('JGA_PICTURE');
        ?>
    </th>
    <th width="24"></th>
    <th width="15%">
      <?php 
        echo JText::_('JGA_DATE');
        ?>
    </th>
  </tr>
<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $task = $row->published ? 'unpublishcmt' : 'publishcmt';
            $img = $row->published ? 'tick.png' : 'publish_x.png';
            $taska = $row->approved ? 'rejectcmt' : 'approvecmt';
            $imga = $row->approved ? 'tick.png' : 'publish_x.png';
            ?>
  <tr class="<?php 
            echo "row{$k}";
            ?>
">
    <td>
      <input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="id[]" value="<?php 
            echo $row->cmtid;
            ?>
" onclick="isChecked(this.checked);" />
    </td>
    <td>
      <div align="left">
<?php 
            if ($row->userid > 0) {
                echo Joom_GetDisplayName($row->userid, false);
            } else {
                echo $row->cmtname;
            }
            ?>
      </div>
    </td>
    <td>
      <div align="left">
<?php 
            $cmttext = Joom_ProcessText($row->cmttext);
            ?>
        <?php 
            echo $cmttext;
            ?>
      </div>
    </td>
    <td>
      <div align="center">
        <?php 
            echo $row->cmtip;
            ?>
      </div>
    </td>
    <td align='center'>
      <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')">
        <img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="" /><?php 
            /* portierung: width und height entfernt */
            ?>
      </a>
    </td>
    <td align='center'>
      <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $taska;
            ?>
')">
        <img src="images/<?php 
            echo $imga;
            ?>
" border="0" alt="" /><?php 
            /* portierung: width und height entfernt */
            ?>
      </a>
    </td>
    <td width="10%" align="center">
      <?php 
            echo $row->cmtpic;
            ?>
    </td>
    <td>
<?php 
            $database->setQuery("SELECT imgthumbname\n            FROM #__joomgallery\n            WHERE id = '{$row->cmtpic}'");
            $is_imgthumbname = $database->loadResult();
            $database->setQuery("SELECT catid\n            FROM #__joomgallery\n            WHERE id = '{$row->cmtpic}'");
            $is_catid = $database->loadResult();
            $catpath = Joom_GetCatPath($is_catid);
            if (JFile::exists(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $is_imgthumbname)) {
                $imginfo = getimagesize(JPath::clean(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $is_imgthumbname));
                $imgsource = _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $is_imgthumbname;
                $srcWidth = $imginfo[0];
                $srcHeight = $imginfo[1];
                $thumbexists = 1;
            } else {
                $thumbexists = 0;
            }
            if ($thumbexists) {
                ?>
      <a href="<?php 
                echo _JOOM_LIVE_SITE;
                ?>
index.php?option=<?php 
                echo _JOOM_OPTION;
                ?>
&amp;func=detail&amp;id=<?php 
                echo $row->cmtpic;
                ?>
" onmouseover="return overlib('<img src=\'<?php 
                echo $imgsource;
                ?>
\' />',WIDTH,<?php 
                echo $srcWidth;
                ?>
, HEIGHT,<?php 
                echo $srcHeight;
                ?>
)"  onmouseout="return nd()";target="_blank">
        <img src="<?php 
                echo $imgsource;
                ?>
" border="0" width="24" height="24" alt="" />
      </a>
<?php 
            } else {
                ?>
      &nbsp;
<?php 
            }
            ?>

    </td>
    <td width="10%" align="center">
      <?php 
            echo strftime($config->jg_dateformat, $row->cmtdate);
            ?>
    </td>
<?php 
            $k = 1 - $k;
            ?>
  </tr>
<?php 
        }
        ?>
  <tr>
    <td colspan="9">
      <?php 
        echo $pageNav->getListFooter();
        ?>
    </td>
  </tr>
</table>
<input type="hidden" name="option" value="<?php 
        echo _JOOM_OPTION;
        ?>
" />
<input type="hidden" name="task" value="comments" />
<input type="hidden" name="boxchecked" value="0" />
</form>
<?php 
    }
    function Joom_ShowCategoryBody_HTML(&$rows, &$rowcounter, &$colum, $order_by, &$order_dir)
    {
        global $id;
        $config = Joom_getConfig();
        $document =& JFactory::getDocument();
        $mainframe =& JFactory::getApplication('site');
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        //wenn jg_cooliris = true, dann zusaetzlich XML im head aufbauen
        if ($config->jg_cooliris && count($rows) > 0) {
            $href = _JOOM_LIVE_SITE . $this->viewcategory_url . $this->catid . '&startpage=' . $this->catstartpage . '&cooliris=1' . _JOOM_ITEMID;
            $attribs = array('id' => 'joomgallery', 'type' => 'application/rss+xml', 'title' => 'Cooliris');
            $document->addHeadLink($href, 'alternate', 'rel', $attribs);
            if ($config->jg_coolirislink) {
                $document->addScript('http://lite.piclens.com/current/piclens.js');
                echo '<a id="jg_cooliris" href="javascript:PicLensLite.start({feedUrl:\'' . _JOOM_LIVE_SITE . $this->viewcategory_url . $this->catid . '&startpage=' . $this->catstartpage . _JOOM_ITEMID . '&cooliris=1\'});">' . JText::_('JGS_COOLIRISLINK_TEXT') . '</a>';
            }
        }
        if (!$config->jg_showtitle && !$config->jg_showhits && !$config->jg_showauthor && !$config->jg_showowner && !$config->jg_showcatrate && !$config->jg_showcatcom && !$config->jg_showcatdescription) {
            $show_text = false;
        } else {
            $show_text = true;
        }
        $num_rows = ceil(count($rows) / $colum);
        $index = 0;
        $count_pics = count($rows);
        ?>
  <a name="category"></a>
<?php 
        if ($count_pics > 0) {
            for ($row_count = 0; $row_count < $num_rows; $row_count++) {
                $linecolor = ($row_count + 1) % 2 + 1;
                ?>
  <div class="jg_row <?php 
                if ($linecolor == 1) {
                    echo "sectiontableentry1";
                } else {
                    echo "sectiontableentry2";
                }
                ?>
">
<?php 
                for ($col_count = 0; $col_count < $colum && $index < $count_pics; $col_count++) {
                    $ii = 1;
                    $row1 = $rows[$index];
                    if ($config->jg_showpicasnew) {
                        $isnew = Joom_CheckNew($row1->imgdate, $config->jg_daysnew);
                    }
                    $catpath = Joom_GetCatPath($row1->cid);
                    if ($config->jg_showdetailpage == 0 && $user->get('aid') != 0 || $config->jg_showdetailpage == 1) {
                        $link = Joom_OpenImage($config->jg_detailpic_open, $row1->id, $catpath, $row1->cid, $row1->imgfilename, $row1->imgtitle, $row1->imgtext);
                    } else {
                        $link = "javascript:alert('" . JText::_('JGS_ALERT_NO_DETAILVIEW_FOR_GUESTS', true) . "')";
                    }
                    ?>
    <div class="jg_element_cat">
      <a href="<?php 
                    echo $link;
                    ?>
" class="jg_catelem_photo">
        <img src="<?php 
                    echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row1->imgthumbname;
                    ?>
" class="jg_photo" alt="<?php 
                    echo $row1->imgtitle;
                    ?>
" />
      </a>
<?php 
                    if ($show_text) {
                        ?>
      <div class="jg_catelem_txt">
        <ul>
<?php 
                        if ($config->jg_showtitle || $config->jg_showpicasnew) {
                            ?>
          <li>
<?php 
                            if ($config->jg_showtitle) {
                                ?>
            <b><?php 
                                echo $row1->imgtitle;
                                ?>
</b>
<?php 
                            }
                            if ($config->jg_showpicasnew) {
                                ?>
            <?php 
                                echo $isnew;
                                ?>
&nbsp;
<?php 
                            }
                            ?>
          </li>
<?php 
                        }
                        if ($config->jg_showauthor) {
                            if ($row1->imgauthor) {
                                $authorowner = $row1->imgauthor;
                            } elseif ($config->jg_showowner) {
                                $authorowner = Joom_GetDisplayName($row1->owner);
                            } else {
                                $authorowner = JText::_('JGS_NO_DATA');
                            }
                            ?>
          <li>
            <?php 
                            echo JText::_('JGS_AUTHOR') . ": " . $authorowner;
                            ?>
&nbsp;
          </li>
<?php 
                        }
                        if ($config->jg_showhits) {
                            ?>
          <li>
            <?php 
                            echo JText::_('JGS_HITS') . ": " . $row1->imgcounter;
                            ?>
&nbsp;
          </li>
<?php 
                        }
                        if ($config->jg_showcatrate) {
                            if ($row1->imgvotes > 0) {
                                $fimgvotesum = number_format($row1->imgvotesum / $row1->imgvotes, 2, ',', '.');
                                if ($row1->imgvotes == 1) {
                                    $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_ONE_VOTE') . ')';
                                } else {
                                    $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_VOTES') . ')';
                                }
                            } else {
                                $frating = JText::_('JGS_NO_VOTES');
                            }
                            ?>
          <li>
            <?php 
                            echo JText::_('JGS_RATING') . ": " . $frating;
                            ?>
&nbsp;
          </li>
<?php 
                        }
                        if ($config->jg_showcatcom) {
                            # Check how many comments exist
                            $database->setQuery(" SELECT \n                                        COUNT(cmtid)\n                                      FROM \n                                        #__joomgallery_comments\n                                      WHERE \n                                               cmtpic = '{$row1->id}' \n                                        AND published ='1' \n                                        AND approved = '1'\n                                    ");
                            $comments = $database->LoadResult();
                            ?>
          <li>
            <?php 
                            echo JText::_('JGS_COMMENTS') . ": " . $comments;
                            ?>
 
          </li>
<?php 
                        }
                        if ($config->jg_showcatdescription == 1 && $row1->imgtext) {
                            ?>
          <li>
            <?php 
                            echo JText::_('JGS_DESCRIPTION') . ": " . $row1->imgtext;
                            ?>
&nbsp;
          </li>
<?php 
                        }
                        $mainframe->triggerEvent('onAfterDisplayJoomThumb', array($row1->id));
                        $li_tag_set = false;
                        if (is_file(JPath::clean(JPATH_ROOT . DS . $config->jg_pathoriginalimages . $catpath . $row1->imgfilename)) || $config->jg_downloadfile != 1) {
                            if ($config->jg_showcategorydownload == 1 && $user->get('aid') >= 1 || $config->jg_showcategorydownload == 2 && $user->get('aid') == 2 || $config->jg_showcategorydownload == 3) {
                                ?>
          <li>
            <a href="<?php 
                                echo JRoute::_('index.php?option=com_joomgallery&func=download&catid=' . $row1->catid . '&id=' . $row1->id . _JOOM_ITEMID);
                                ?>
"
                onMouseOver="return overlib('<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT', true);
                                ?>
', CAPTION, '<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true);
                                ?>
', BELOW, RIGHT);" onmouseout="return nd();">
              <img src="<?php 
                                echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download.png';
                                ?>
" alt="<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION');
                                ?>
" class="pngfile jg_icon" />
            </a>
<?php 
                                $li_tag_set = true;
                            } elseif ($config->jg_showcategorydownload == 1 && $user->get('aid') < 1) {
                                ?>
          <li>
            <span onMouseOver="return overlib('<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT_LOGIN', true);
                                ?>
', CAPTION, '<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true);
                                ?>
', BELOW, RIGHT);" onmouseout="return nd();" >
              <img src="<?php 
                                echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download_gr.png';
                                ?>
" alt="<?php 
                                echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION');
                                ?>
"  class="pngfile jg_icon" />
            </span>
<?php 
                                $li_tag_set = true;
                            }
                        }
                        if ($config->jg_favourites == 1 && $config->jg_showcategoryfavourite) {
                            if ($config->jg_showdetailfavourite == 0 && $user->get('aid') >= 1 || $config->jg_showdetailfavourite == 1 && $user->get('aid') == 2 || $config->jg_usefavouritesforpubliczip == 1 && $user->get('aid') < 1) {
                                if ($config->jg_usefavouritesforzip == 1 || $config->jg_usefavouritesforpubliczip == 1 && $user->get('aid') < 1) {
                                    if (!$li_tag_set) {
                                        $li_tag_set = true;
                                        ?>
          <li>
<?php 
                                    }
                                    ?>
            <a href="<?php 
                                    echo JRoute::_('index.php?option=com_joomgallery&func=addpicture&id=' . $row1->id . '&catid=' . $row1->catid . _JOOM_ITEMID);
                                    ?>
"
                onMouseOver="return overlib('<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_TEXT', true);
                                    ?>
', CAPTION, '<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION', true);
                                    ?>
', BELOW, RIGHT);" onmouseout="return nd();" >
              <img src="<?php 
                                    echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/basket_put.png';
                                    ?>
" alt="<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION');
                                    ?>
"  class="pngfile jg_icon" />
            </a>
<?php 
                                } else {
                                    if (!$li_tag_set) {
                                        $li_tag_set = true;
                                        ?>
          <li>
<?php 
                                    }
                                    ?>
            <a href="<?php 
                                    echo JRoute::_('index.php?option=com_joomgallery&func=addpicture&id=' . $row1->id . '&catid=' . $row1->catid . _JOOM_ITEMID);
                                    ?>
"
                onMouseOver="return overlib('<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_TEXT', true);
                                    ?>
', CAPTION, '<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION', true);
                                    ?>
', BELOW, RIGHT);" onmouseout="return nd();">
              <img src="<?php 
                                    echo $this->assetsimages_url . 'star.png';
                                    ?>
" alt="<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION');
                                    ?>
" class="pngfile jg_icon" />
            </a>
<?php 
                                }
                            } elseif ($config->jg_favouritesshownotauth == 1) {
                                if ($config->jg_usefavouritesforzip == 1) {
                                    if (!$li_tag_set) {
                                        $li_tag_set = true;
                                        ?>
          <li>
<?php 
                                    }
                                    ?>
            <span onMouseOver="return overlib('<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_NOT_ALLOWED_TOOLTIP_TEXT', true);
                                    ?>
', CAPTION, '<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION', true);
                                    ?>
', BELOW, RIGHT);" onmouseout="return nd();" >
              <img src="<?php 
                                    echo $this->assetsimages_url . 'basket_put_gr.png';
                                    ?>
" alt="<?php 
                                    echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION');
                                    ?>
"  class="pngfile jg_icon" />
            </span>
<?php 
                                } else {
                                    if (!$li_tag_set) {
                                        $li_tag_set = true;
                                        ?>
          <li>
<?php 
                                    }
                                    ?>
            <span onMouseOver="return overlib('<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_NOT_ALLOWED_TOOLTIP_TEXT', true);
                                    ?>
', CAPTION, '<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION', true);
                                    ?>
', BELOW, RIGHT);" onmouseout="return nd();" >
              <img src="<?php 
                                    echo $this->assetsimages_url . 'star_gr.png';
                                    ?>
" alt="<?php 
                                    echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION');
                                    ?>
"  class="pngfile jg_icon" />
            </span>
<?php 
                                }
                            }
                        }
                        if ($li_tag_set) {
                            ?>
          </li>
<?php 
                        }
                        ?>
        </ul>
      </div>
<?php 
                    }
                    ?>
    </div>
<?php 
                    $index++;
                }
                // for loop over cols in row
                ?>
    <div class="jg_clearboth"></div>
  </div>
<?php 
                $ii++;
            }
            // for loop over rows
            if ($config->jg_showcathead) {
                ?>
    <div class="sectiontableheader">
      &nbsp; 
    </div>
<?php 
            }
        }
        // if count($pics) > 0
    }
    function Joom_ShowCommentsArea_HTML($allowcomment)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $linecolor = 0;
        ?>
      <a name="joomcomments"></a>
<?php 
        if ($user->get('username') || !$user->get('username') && $config->jg_showcommentsunreg == 0) {
            if ($config->jg_showcommentsarea == 1) {
                $order = 'DESC';
            } else {
                $order = 'ASC';
            }
            $database->setQuery(" SELECT\n                              cm.*\n                            FROM\n                              #__joomgallery_comments AS cm\n                            WHERE\n                                  cm.cmtpic    = " . $this->id . "\n                              AND cm.published = '1'\n                              AND cm.approved  = '1'\n                            ORDER BY\n                              cmtid {$order}\n                          ");
            $result1 = $database->LoadObjectList();
            $count = count($result1);
            if ($count > 0) {
                ?>
      <tr class="sectiontableheader">
        <td class="jg_cmtl">
          <?php 
                echo JText::_('JGS_AUTHOR');
                ?>
&nbsp;
        </td>
        <td class="jg_cmtr">
          <?php 
                echo JText::_('JGS_COMMENT');
                ?>
&nbsp;
        </td>
      </tr>
<?php 
                foreach ($result1 as $row1) {
                    $linecolor = $linecolor % 2 + 1;
                    ?>
      <tr class="<?php 
                    echo "sectiontableentry" . $linecolor;
                    ?>
">
        <td class="jg_cmtl">
<?php 
                    if ($row1->userid > 0) {
                        ?>
          <?php 
                        echo Joom_GetDisplayName($row1->userid, false);
                        ?>
&nbsp;
<?php 
                    } elseif ($row1->cmtname == JText::_('JGS_GUEST')) {
                        ?>
          <?php 
                        echo $row1->cmtname;
                        ?>
&nbsp;
<?php 
                    } else {
                        ?>
      <?php 
                        echo $row1->cmtname . ' (' . JText::_('JGS_GUEST') . ') ';
                        ?>
&nbsp;
<?php 
                    }
                    // Editor logged?
                    if ($user->get('gid') == 20 || $user->get('gid') == 24 || $user->get('gid') == 25) {
                        ?>
          <div class="jg_cmticons">
            <a href="http://www.db.ripe.net/whois?form_type=simple&full_query_string=&searchtext=<?php 
                        echo $row1->cmtip;
                        ?>
&do_search=Search" target="_blank">
              <img src="<?php 
                        echo _JOOM_LIVE_SITE . $this->joom_assetspath;
                        ?>
images/ip.gif" alt="<?php 
                        echo $row1->cmtip;
                        ?>
" title="<?php 
                        echo $row1->cmtip;
                        ?>
" hspace="3" border="0" /></a>
            <a href="<?php 
                        echo JRoute::_($this->joom_componenturl . '&func=deletecomment&cmtid=' . $row1->cmtid . _JOOM_ITEMID);
                        ?>
">
              <img src="<?php 
                        echo _JOOM_LIVE_SITE . $this->joom_assetspath;
                        ?>
images/del.gif" alt="<?php 
                        echo JText::_('JGS_DELETE_COMMENT');
                        ?>
" hspace="3" border="0" /></a>
          </div>
<?php 
                    }
                    ?>
        </td>
<?php 
                    $signtime = strftime($config->jg_dateformat, $row1->cmtdate);
                    $origtext = $row1->cmttext;
                    $origtext = Joom_ProcessText($origtext);
                    if ($config->jg_bbcodesupport) {
                        $origtext = Joom_BBDecode($origtext);
                    }
                    if ($config->jg_smiliesupport) {
                        $smileys = Joom_GetSmileys();
                        foreach ($smileys as $i => $sm) {
                            $origtext = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $origtext);
                        }
                    }
                    ?>
        <td class="jg_cmtr">
          <span class="small">
            <?php 
                    echo JText::_('JGS_COMMENT_ADDED');
                    ?>
: <?php 
                    echo $signtime;
                    ?>
&nbsp;
            <hr />
          </span>
          <?php 
                    echo stripslashes($origtext);
                    ?>
&nbsp;
        </td>
      </tr>
<?php 
                }
            } else {
                ?>
      <tr class="<?php 
                echo "sectiontableentry" . $linecolor;
                ?>
">
        <td colspan="2" class="jg_cmtf">
          <p>
          <?php 
                echo JText::_('JGS_NO_EXISTING_COMMENTS');
                ?>
&nbsp;
<?php 
                if ($allowcomment == 1) {
                    ?>
          <?php 
                    echo ' ' . JText::_('JGS_WRITE_FIRST_COMMENT');
                    ?>
&nbsp;
<?php 
                }
                ?>
          </p>
        </td>
      </tr>
<?php 
            }
        } else {
            ?>
      <tr class="<?php 
            echo "sectiontableentry" . $linecolor;
            ?>
">
        <td colspan="2" class="jg_cmtf">
          <p>
          <?php 
            echo JText::_('JGS_NO_COMMENTS_FOR_UNREG');
            ?>
&nbsp;
          </p>
        </td>
      </tr>
<?php 
        }
    }
    /**
     * Category manager
     *
     * @param array $rows database rows of categeories
     * @param string $search
     * @param string $slist
     * @param string $olist
     * @param object $pageNav
     */
    function Joom_ShowCategories_HTML(&$rows, $search, &$slist, &$olist, $pageNav)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        jimport('joomla.filesystem.file');
        ?>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script language="Javascript" src="../includes/js/overlib_mini.js"></script>
<form action="index.php" method="post" name="adminForm">
<table cellpadding="4" cellspacing="0" border="0" width="100%">
  <tr>
    <td width="100%"></td>
    <td>
      <?php 
        echo JText::_('JGA_SEARCH') . ':';
        ?>
<br />
      <input type="text" name="search" value="<?php 
        echo $search;
        ?>
"
       class="inputbox" onChange="document.adminForm.submit();" />
    </td>
    <td nowrap>
      <?php 
        echo JText::_('JGA_SORT_BY_ORDER');
        ?>
<br />
      <?php 
        echo $olist;
        ?>
    </td>
    <td>
      <?php 
        echo JText::_('JGA_SORT_BY_TYPE');
        ?>
<br />
      <?php 
        echo $slist;
        ?>
    </td>
  </tr>
  <tr>
    <td width="100%"></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="adminlist">
  <tr>
    <th width="20">
      <input type="checkbox" name="toggle" value=""
       onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
    </th>
    <th width="10%"></th>
    <th width="5%" align="left">ID</th>
    <th width="85%" class="title">
      <?php 
        echo JText::_('JGA_CATEGORY');
        ?>
    </th>
    <th nowrap align="left">
      <?php 
        echo JText::_('JGA_PARENT_CATEGORY');
        ?>
    </th>
    <th nowrap>
      <?php 
        echo JText::_('JGA_PUBLISHED');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_OWNER');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_TYPE');
        ?>
    </th>
    <th nowrap>
      <?php 
        echo JText::_('JGA_HIT');
        ?>
    </th>
    <th colspan="2" nowrap>
      <div align="center">
        <?php 
        echo JText::_('JGA_REORDER');
        ?>
      </div>
    </th>
    <th align="center">
      <a href="javascript: saveorder(<?php 
        echo count($rows) - 1;
        ?>
)">
        <img src="images/filesave.png" border="0" width="16" height="16"
         alt="<?php 
        echo JText::_('JGA_SAVE_ORDER');
        ?>
" />
      </a>
    </th>
  </tr>
<?php 
        $k = 0;
        $i = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $catpath = Joom_GetCatPath($row->cid);
            ?>
  <tr class="row<?php 
            echo $k;
            ?>
">
    <td width="20">
      <input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]"
       value="<?php 
            echo $row->cid;
            ?>
" onClick="isChecked(this.checked);" />
    </td>
    <td width="10%">
<?php 
            if ($row->catimage != '') {
                if (JFile::exists(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $row->catimage)) {
                    $imginfo = getimagesize(JPath::clean(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $row->catimage));
                    $imgsource = _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row->catimage;
                    $srcWidth = $imginfo[0];
                    $srcHeight = $imginfo[1];
                    $thumbexists = 1;
                } else {
                    $thumbexists = 0;
                }
                if ($thumbexists) {
                    ?>
      <a href="#" onmouseover="return overlib('<img src=\'<?php 
                    echo $imgsource;
                    ?>
\' />',WIDTH,<?php 
                    echo $srcWidth;
                    ?>
, HEIGHT,<?php 
                    echo $srcHeight;
                    ?>
)"  onmouseout="return nd()"; alt=""/>
        <img src="<?php 
                    echo $imgsource;
                    ?>
" border="0" width="24" height="24" />
      </a>
<?php 
                } else {
                    ?>
      &nbsp;
<?php 
                }
            }
            ?>
    </td>
    <td width="5%" ><?php 
            echo $row->cid;
            ?>
</td>
    <td width="85%" >
      <div align="left">
        <a href="#edit" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
',
                                                     'editcatg')">
<?php 
            if ($row->parent > 0) {
                ?>
        &nbsp; &raquo;
<?php 
            }
            ?>
        <?php 
            echo $row->name;
            ?>
        </a>
      </div>
    </td>
    <td  align="center" nowrap>
      <?php 
            echo Joom_ShowCategoryPath($row->parent);
            ?>
    </td>
<?php 
            $task = $row->published ? 'unpublishcatg' : 'publishcatg';
            $img = $row->published ? 'tick.png' : 'publish_x.png';
            ?>
    <td width="10%" align="center" nowrap>
      <a href="javascript: void(0);"
       onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')">
        <img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="" />
      </a>
    </td>
    <td width="5%" align="center">
<?php 
            if ($row->owner != null) {
                $owner = JFactory::getUser($row->owner);
                ?>
    <?php 
                echo Joom_GetDisplayName($row->owner, true);
                ?>
    [<?php 
                echo $config->jg_realname ? $owner->get('username') : $owner->get('name');
                ?>
&nbsp;(<?php 
                echo $row->owner;
                ?>
)]
<?php 
            } else {
                ?>
      Administrator[def]
<?php 
            }
            ?>
    </td>
    <td width="5%" align="center">
<?php 
            if ($row->owner != null) {
                ?>
      <img src="../includes/js/ThemeOffice/users.png"
       alt="<?php 
                echo JText::_('JGA_USER_UPLOAD');
                ?>
"
       title="<?php 
                echo JText::_('JGA_USER_UPLOAD');
                ?>
" />
<?php 
            } else {
                ?>
      <img src="../includes/js/ThemeOffice/credits.png"
       alt="<?php 
                echo JText::_('JGA_ADMIN_UPLOAD');
                ?>
"
       title="<?php 
                echo JText::_('JGA_ADMIN_UPLOAD');
                ?>
" />
<?php 
            }
            ?>
    </td>
    
    <td width="10%" align="center" nowrap>
      <?php 
            echo $row->groupname;
            ?>
    </td>
    <td>
<?php 
            if ($i > 0 || $i + $pageNav->limitstart > 0) {
                ?>
      <div align="center">
        <a href="#reorder" onclick="return listItemTask('cb<?php 
                echo $i;
                ?>
',
                                                        'orderupcatg')">
          <img src="images/uparrow.png" border="0"<?php 
                /* portierung: width und height entfernt */
                ?>
           alt="<?php 
                echo JText::_('JGA_UP');
                ?>
" />
        </a>
      </div>
<?php 
            } else {
                ?>
          &nbsp;
<?php 
            }
            ?>
    </td>
    <td>
<?php 
            if ($i < $n - 1 || $i + $pageNav->limitstart < $pageNav->total - 1) {
                ?>
      <div align="center">
        <a href="#reorder" onclick="return listItemTask('cb<?php 
                echo $i;
                ?>
',
                                                        'orderdowncatg')">
          <img src="images/downarrow.png" border="0"<?php 
                /* portierung: width und height entfernt */
                ?>
           alt="<?php 
                echo JText::_('JGA_DOWN');
                ?>
" />
        </a>
      </div>
<?php 
            }
            ?>
    </td>
    <td align="center">
      <input type="text" name="order[]" size="5" value="<?php 
            echo $row->ordering;
            ?>
"
       class="text_area" style="text-align: center" />
    </td>
<?php 
            $k = 1 - $k;
            ?>
  </tr>
<?php 
        }
        ?>
  <tr>
    <td colspan="12">
      <?php 
        echo $pageNav->getListFooter();
        ?>
    </td>
  </tr>
</table>
<input type="hidden" name="option" value="<?php 
        echo _JOOM_OPTION;
        ?>
" />
<input type="hidden" name="task" value="categories" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="returntask" value="catg" />
</form>
<?php 
    }
    /**
     * Picture manager
     *
     * @param array of objects $rows
     * @param string $clist
     * @param string $slist
     * @param string $search
     * @param object $pageNav
     * @param string $olist
     */
    function Joom_ShowPictures_HTML(&$rows, &$clist, &$slist, &$search, &$pageNav, &$olist)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        jimport('joomla.filesystem.file');
        ?>
<script  type="text/javascript" src="<?php 
        echo _JOOM_LIVE_SITE;
        ?>
includes/js/overlib_mini.js"></script>
<form action="index.php" method="post" name="adminForm">
<table cellpadding="4" cellspacing="0" border="0" width="100%">
  <tr>
    <td width="100%"></td>
    <td><?php 
        echo JText::_('JGA_SEARCH');
        ?>
<br />
      <input type="text" name="search" value="<?php 
        echo $search;
        ?>
"
       class="inputbox" onChange="document.adminForm.submit();" />
    </td>
    <td nowrap>
      <?php 
        echo JText::_('JGA_SORT_BY_ORDER');
        ?>
<br />
      <?php 
        echo $olist;
        ?>
    </td>
    <td nowrap>
      <?php 
        echo JText::_('JGA_SORT_BY_CATEGORY');
        ?>
<br />
      <?php 
        echo $clist;
        ?>
    </td>
    <td><?php 
        echo JText::_('JGA_SORT_BY_TYPE');
        ?>
<br />
      <?php 
        echo $slist;
        ?>
    </td>
  </tr>
</table>
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
  <tr>
    <th width="20">
      <input type="checkbox" name="toggle" value=""
       onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
    </th>
    <th width="5%"></th>
    <th width="5%" align="left">ID</th>
    <th class="title" width="20%">
      <?php 
        echo JText::_('JGA_TITLE');
        ?>
    </th>
    <th width="20%">
      <div align="left">
        <?php 
        echo JText::_('JGA_CATEGORY');
        ?>
      </div>
    </th>
    <th width="5%">
      <div align="center">
        <?php 
        echo JText::_('JGA_HITS');
        ?>
      </div>
    </th>
    <th width="10%" colspan="2">
      <div align="center">
        <?php 
        echo JText::_('JGA_ORDERING');
        ?>
      </div>
    </th>
    <th width="5%">
      <div align="center">
        <a href="javascript: saveorder( <?php 
        echo count($rows) - 1;
        ?>
 )">
          <img src="images/filesave.png" border="0" width="16" height="16"
           alt="<?php 
        echo JText::_('JGA_SAVE_ORDER');
        ?>
" />
        </a>
      </div>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_PUBLISHED');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_APPROVED');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_OWNER');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_AUTHOR');
        ?>
    </th>
    <th width="5%">
      <?php 
        echo JText::_('JGA_TYPE');
        ?>
    </th>
    <th width="15%">
      <?php 
        echo JText::_('JGA_DATE');
        ?>
    </th>
  </tr>
<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $taska = $row->approved ? 'rejectpic' : 'approvepic';
            $imga = $row->approved ? 'tick.png' : 'publish_x.png';
            $task = $row->published ? 'unpublishpic' : 'publishpic';
            $img = $row->published ? 'tick.png' : 'publish_x.png';
            $catpath = Joom_GetCatPath($row->catid);
            if (JFile::exists(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $row->imgthumbname)) {
                $imginfo = getimagesize(JPath::clean(JPATH_ROOT . DS . $config->jg_paththumbs . $catpath . $row->imgthumbname));
                $imgsource = _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row->imgthumbname;
                $srcWidth = $imginfo[0];
                $srcHeight = $imginfo[1];
                $thumbexists = 1;
            } else {
                $thumbexists = 0;
            }
            ?>
  <tr class="<?php 
            echo "row{$k}";
            ?>
">
    <td>
      <input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="id[]"
       value="<?php 
            echo $row->id;
            ?>
" onclick="isChecked(this.checked);" />
    </td>
    <td><?php 
            if ($thumbexists) {
                ?>
      <a href="#edit" onmouseover="return overlib('<img src=\'<?php 
                echo $imgsource;
                ?>
\' />',WIDTH,<?php 
                echo $srcWidth;
                ?>
, HEIGHT,<?php 
                echo $srcHeight;
                ?>
)"  onmouseout="return nd()"; onclick="return listItemTask('cb<?php 
                echo $i;
                ?>
','editpic')" alt=""/>
        <img src="<?php 
                echo $imgsource;
                ?>
" border="0" width="24" height="24" alt="" />
      </a>
<?php 
            } else {
                ?>
      &nbsp;
<?php 
            }
            ?>
    </td>
    <td>
      <?php 
            echo $row->id;
            ?>
    </td>
    <td>
      <div align="left">
        <a href="#edit" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','editpic')">
          <?php 
            echo $row->imgtitle;
            ?>
        </a>
      </div>
    </td>
    <td>
      <div align="left">
        <?php 
            echo Joom_ShowCategoryPath($row->catid);
            ?>
      </div>
    </td>
    <td>
      <div align="center">
        <?php 
            echo $row->imgcounter;
            ?>
      </div>
    </td>
    <td align="center">
      <?php 
            echo $pageNav->orderUpIcon($i, $row->catid == @$rows[$i - 1]->catid);
            ?>
      <?php 
            echo $pageNav->orderDownIcon($i, $n, $row->catid == @$rows[$i + 1]->catid);
            ?>
    </td>
    <td align="center" colspan="2">
      <input type="text" name="order[]" size="5" value="<?php 
            echo $row->ordering;
            ?>
"
       class="text_area" style="text-align: center" />
    </td>
    <td align='center'>
      <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')">
        <img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="" />
      </a>
    </td>
    <td align='center'>
      <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $taska;
            ?>
')">
        <img src="images/<?php 
            echo $imga;
            ?>
" border="0" alt="" />
      </a>
    </td>
    <td width="5%" align="center">
      <?php 
            echo Joom_GetDisplayName($row->owner, true);
            ?>
    </td>
    <td width="5%" align="center">
<?php 
            if ($row->imgauthor) {
                ?>
        <?php 
                echo $row->imgauthor;
            }
            ?>
    </td>
    <td width="5%" align="center">
<?php 
            if ($row->useruploaded) {
                ?>
      <img src="../includes/js/ThemeOffice/users.png"
       alt="<?php 
                echo JText::_('JGA_USER_UPLOAD');
                ?>
"
       title="<?php 
                echo JText::_('JGA_USER_UPLOAD');
                ?>
" />
<?php 
            } else {
                ?>
      <img src="../includes/js/ThemeOffice/credits.png"
       alt="<?php 
                echo JText::_('JGA_ADMIN_UPLOAD');
                ?>
"
       title="<?php 
                echo JText::_('JGA_ADMIN_UPLOAD');
                ?>
" />
<?php 
            }
            ?>
    </td>
    <td width="10%" align="center">
      <?php 
            echo strftime($config->jg_dateformat, $row->imgdate);
            ?>
    </td>
<?php 
            $k = 1 - $k;
            ?>
  </tr>
<?php 
        }
        ?>
  <tr>
    <td colspan="15">
      <?php 
        echo $pageNav->getListFooter();
        ?>
    </td>
  </tr>
</table>
<input type="hidden" name="option" value="<?php 
        echo _JOOM_OPTION;
        ?>
" />
<input type="hidden" name="task" value="pictures" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="returntask" value="pictures" />
</form>
<?php 
    }
    function Joom_ShowSpecials_HTML($tl_title, $rows, $sorting)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $num_rows = ceil(count($rows) / $config->jg_toplistcols);
        $index = 0;
        $line = 1;
        ?>
  <div class="jg_topview">
    <div class="sectiontableheader">
      <?php 
        echo $tl_title;
        ?>
&nbsp;
    </div>
<?php 
        $count_rows = count($rows);
        if ($count_rows) {
            for ($row_count = 0; $row_count < $num_rows; $row_count++) {
                $line++;
                $linecolor = $line % 2 + 1;
                ?>
    <div class="jg_row <?php 
                if ($linecolor == 1) {
                    echo "sectiontableentry1";
                } else {
                    echo "sectiontableentry2";
                }
                ?>
">
<?php 
                for ($col_count = 0; $col_count < $config->jg_toplistcols && $index < $count_rows; $col_count++) {
                    $row1 = $rows[$index];
                    ?>
      <div class="jg_topelement">
<?php 
                    $catpath = Joom_GetCatPath($row1->catid);
                    if ($config->jg_showdetailpage == 0 && $user->get('aid') != 0 || $config->jg_showdetailpage == 1) {
                        $link = Joom_OpenImage($config->jg_detailpic_open, $row1->id, $catpath, $row1->catid, $row1->imgfilename, $row1->imgtitle, $row1->imgtext);
                    } else {
                        $link = "javascript:alert('" . JText::_('JGS_ALERT_NO_DETAILVIEW_FOR_GUESTS', true) . "')";
                    }
                    ?>
        <div  class="jg_topelem_photo">
          <a href="<?php 
                    echo $link;
                    ?>
">
            <img src="<?php 
                    echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row1->imgthumbname;
                    ?>
" class="jg_photo" alt="<?php 
                    echo $row1->imgtitle;
                    ?>
" />
          </a>
        </div>
        <div class="jg_topelem_txt">
          <ul>
            <li>
              <b><?php 
                    echo $row1->imgtitle;
                    ?>
</b>
            </li>
            <li>
              <?php 
                    echo JText::_('JGS_CATEGORY') . ':';
                    ?>
              <a href="<?php 
                    echo JRoute::_('index.php?option=com_joomgallery&func=viewcategory&catid=' . $row1->catid . _JOOM_ITEMID);
                    ?>
">
                <?php 
                    echo $row1->name;
                    ?>
              </a>
            </li>
<?php 
                    if ($config->jg_showauthor) {
                        if ($row1->imgauthor) {
                            $authorowner = $row1->imgauthor;
                        } elseif ($config->jg_showowner) {
                            $authorowner = Joom_GetDisplayName($row1->owner);
                        } else {
                            $authorowner = JText::_('JGS_NO_DATA');
                        }
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_AUTHOR') . ': ' . $authorowner;
                        ?>
&nbsp;
            </li>
<?php 
                    }
                    if ($config->jg_showhits) {
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_HITS') . ': ' . $row1->imgcounter;
                        ?>
&nbsp;
            </li>
<?php 
                    }
                    if ($config->jg_showcatrate) {
                        ?>
            <li>
<?php 
                        if ($row1->imgvotes > 0) {
                            $fimgvotesum = number_format($row1->imgvotesum / $row1->imgvotes, 2, ',', '');
                            if ($row1->imgvotes == 1) {
                                $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_ONE_VOTE') . ')';
                            } else {
                                $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_VOTES') . ')';
                            }
                        } else {
                            $frating = '(' . JText::_('JGS_NO_RATINGS') . ')';
                        }
                        ?>
              <?php 
                        echo JText::_('JGS_RATING') . ': ' . $frating;
                        ?>
            </li>
<?php 
                    }
                    if ($config->jg_showcatcom) {
                        # Check how many comments exist
                        $database->setQuery(" SELECT \n                                    COUNT(*)\n                                  FROM \n                                    #__joomgallery_comments\n                                  WHERE \n                                           cmtpic = '{$row1->id}' \n                                    AND approved  = '1' \n                                    AND published = '1'\n                                ");
                        $comments = $database->LoadResult();
                        ?>
            <li>
<?php 
                        switch ($comments) {
                            case 0:
                                ?>
              <?php 
                                echo JText::_('JGS_NO_COMMENTS');
                                ?>
&nbsp;
<?php 
                                break;
                            case 1:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENT');
                                ?>
&nbsp;
<?php 
                                break;
                            default:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENTS');
                                ?>
&nbsp;
<?php 
                                break;
                        }
                        ?>
            </li>
<?php 
                        if ($sorting == 'lastcomment' && $config->jg_showthiscomment) {
                            for ($ii = 0; $ii < $comments; $ii++) {
                                $userid = $row1->userid;
                                $cmtname = $row1->cmtname;
                                if ($userid > 0) {
                                    $cmtname = $row1->username;
                                }
                                $cmttext = $row1->cmttext;
                                $cmtdate = $row1->cmtdate;
                                #$cmtdate = strftime( "%d-%m-%Y %H:%M:%S", $cmtdate );
                                $cmtdate = strftime($config->jg_dateformat, $cmtdate);
                            }
                            ?>
            <li>
<?php 
                            if ($userid > 0) {
                                ?>
			        <?php 
                                echo Joom_GetDisplayName($userid, false);
                            } else {
                                echo $cmtname;
                            }
                            echo ' ' . JText::_('JGS_WROTE') . ' (' . JText::_('JGS_AT') . ' ' . $cmtdate . '):';
                            $cmttext = Joom_ProcessText($cmttext);
                            if ($config->jg_smiliesupport) {
                                $smileys = Joom_GetSmileys();
                                foreach ($smileys as $i => $sm) {
                                    $cmttext = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $cmttext);
                                }
                            }
                            ?>
              <?php 
                            echo stripslashes($cmttext);
                            ?>
&nbsp;
            </li>
<?php 
                        }
                    }
                    ?>
          </ul>
        </div>
      </div>
<?php 
                    $index++;
                }
                ?>
      <div class="jg_clearboth"></div>
    </div>
<?php 
            }
        }
        ?>
  </div>
<?php 
    }
 /**
  * Creates HTML for description of one picture-$obj,
  * with display options & style just like in JG.
  * Adjustments are possible via the interface options
  *
  * @param db-obj $obj DB-row coming from this interface, e.g. getPicsByCategory
  *
  * @return string HTML of thumb description (like configured in JG or in the interface)
  */
 function displayDesc($obj)
 {
     $output = "<ul>\n";
     if ($this->getConfig('showtitle') || $this->getConfig('showpicasnew')) {
         $output .= "  <li>";
         if ($this->getConfig('showtitle')) {
             $output .= "<b>{$obj->imgtitle}</b>";
         }
         if ($this->getConfig('showpicasnew')) {
             $output .= Joom_CheckNew($obj->imgdate, $this->_jg_config->jg_daysnew);
         }
         $output .= "  </li>\n";
     }
     if ($this->getConfig('showauthor')) {
         if ($obj->imgauthor) {
             $authorowner = $obj->imgauthor;
         } else {
             $authorowner = Joom_GetDisplayName($obj->owner);
         }
         $output .= "  <li>" . JText::_('JGS_AUTHOR') . ": " . $authorowner;
         $output .= "</li>\n";
     }
     if ($this->getConfig('showcategory')) {
         $catpath = $output .= "  <li>" . JText::_('JGS_CATEGORY') . ": ";
         if ($this->getConfig('showcatlink')) {
             $output .= "<a href=\"" . JRoute::_('index.php?option=com_joomgallery&func=viewcategory&catid=' . $obj->catid) . $this->getJoomId() . "\">";
         }
         $output .= $obj->cattitle;
         if ($this->getConfig('showcatlink')) {
             $output .= "</a>";
         }
         $output .= "  </li>";
     }
     if ($this->getConfig('showhits')) {
         $output .= "  <li>" . JText::_('JGS_HITS') . ": " . $obj->imgcounter . "</li>";
     }
     if ($this->getConfig('showrate')) {
         if ($obj->imgvotes > 0) {
             $fimgvotesum = number_format($obj->vote, 2, ',', '.');
             $frating = $fimgvotesum . ' (' . $obj->imgvotes . JText::_('JGS_VOTES') . ')';
         } else {
             $frating = JText::_('JGS_NO_VOTES');
         }
         $output .= '  <li>' . JText::_('JGS_RATING') . ': ' . $frating . '</li>';
     }
     if ($this->getConfig('shownumcomments')) {
         $output .= '  <li>' . JText::_('JGS_COMMENTS') . ': ' . $obj->cmtcount . '</li>';
     }
     if ($this->getConfig('showdescription') && $obj->imgtext) {
         $output .= '  <li>' . JText::_('JGS_DESCRIPTION') . ': ' . $obj->imgtext . '</li>';
     }
     $output .= '</ul>';
     return $output;
 }
    function Joom_ShowFavourites_HTML1($rows, $showDownloadIcon)
    {
        $config = Joom_getConfig();
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $num_rows = ceil(count($rows) / $config->jg_toplistcols);
        $index = 0;
        $line = 1;
        ?>
  <div class="jg_favview">
    <div class="sectiontableheader">
      <?php 
        echo $this->Output('HEADING');
        ?>
 
    </div>
    <div class="jg_fav_switchlayout">
      <a href="<?php 
        echo JRoute::_('index.php?option=com_joomgallery&func=switchlayout' . _JOOM_ITEMID);
        ?>
">
        <?php 
        echo JText::_('JGS_FAV_SWITCH_LAYOUT');
        ?>
 
      </a>
    </div>
    <div class="jg_fav_clearlist">
      <a href="<?php 
        echo JRoute::_('index.php?option=com_joomgallery&func=removeall' . _JOOM_ITEMID);
        ?>
">
        <?php 
        echo JText::_('JGS_FAV_REMOVE_ALL');
        ?>
 
      </a>
    </div>
<?php 
        $count_rows = count($rows);
        if ($count_rows) {
            for ($row_count = 0; $row_count < $num_rows; $row_count++) {
                $line++;
                $linecolor = $line % 2 + 1;
                ?>
    <div class="jg_row <?php 
                if ($linecolor == 1) {
                    echo "sectiontableentry1";
                } else {
                    echo "sectiontableentry2";
                }
                ?>
">
<?php 
                for ($col_count = 0; $col_count < $config->jg_toplistcols && $index < $count_rows; $col_count++) {
                    $row = $rows[$index];
                    ?>
      <div class="jg_favelement">
<?php 
                    $catpath = Joom_GetCatPath($row->catid);
                    if ($config->jg_showdetailpage == 0 && $user->get('aid') != 0 || $config->jg_showdetailpage == 1) {
                        $link = Joom_OpenImage($config->jg_detailpic_open, $row->id, $catpath, $row->catid, $row->imgfilename, $row->imgtitle, $row->imgtext);
                    } else {
                        $link = "javascript:alert('" . JText::_('JGS_ALERT_NO_DETAILVIEW_FOR_GUESTS', true) . "')";
                    }
                    ?>
        <div class="jg_favelem_photo">
          <a href="<?php 
                    echo $link;
                    ?>
">
            <img src="<?php 
                    echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row->imgthumbname;
                    ?>
" class="jg_photo" alt="<?php 
                    echo $row->imgtitle;
                    ?>
" />
          </a>
        </div>
        <div class="jg_favelem_txt">
          <ul>
            <li>
              <b><?php 
                    echo $row->imgtitle;
                    ?>
</b>
            </li>
            <li>
              <?php 
                    echo JText::_('JGS_CATEGORY') . ":";
                    ?>
 
              <a href="<?php 
                    echo JRoute::_('index.php?option=com_joomgallery&func=viewcategory&catid=' . $row->catid . _JOOM_ITEMID);
                    ?>
">
                <?php 
                    echo $row->name;
                    ?>
 
              </a>
            </li>
<?php 
                    if ($config->jg_showauthor) {
                        if ($row->imgauthor) {
                            $authorowner = $row->imgauthor;
                        } elseif ($config->jg_showowner) {
                            $authorowner = Joom_GetDisplayName($row->imgowner);
                        } else {
                            $authorowner = JText::_('JGS_NO_DATA');
                        }
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_AUTHOR') . ": " . $authorowner;
                        ?>
 
            </li>
<?php 
                    }
                    if ($config->jg_showhits) {
                        ?>
            <li>
              <?php 
                        echo JText::_('JGS_HITS') . ": " . $row->imgcounter;
                        ?>
 
            </li>
<?php 
                    }
                    if ($config->jg_showcatrate) {
                        ?>
            <li>
<?php 
                        if ($row->imgvotes > 0) {
                            $fimgvotesum = number_format($row->imgvotesum / $row->imgvotes, 2, ',', '');
                            $frating = $fimgvotesum . ' (' . $row->imgvotes . ' ' . JText::_('JGS_VOTES') . ')';
                        } else {
                            $frating = '(' . JText::_('JGS_NO_RATINGS') . ')';
                        }
                        ?>
              <?php 
                        echo JText::_('JGS_RATING') . ": " . $frating;
                        ?>
 
            </li>
<?php 
                    }
                    if ($config->jg_showcatcom) {
                        # Check how many comments exist
                        $database->setQuery(" SELECT \n                                    COUNT(*)\n                                  FROM \n                                    #__joomgallery_comments\n                                  WHERE \n                                           cmtpic = '{$row->id}' \n                                    AND approved  = '1' \n                                    AND published = '1' \n                                ");
                        $comments = $database->loadResult();
                        ?>
            <li>
<?php 
                        switch ($comments) {
                            case 0:
                                ?>
              <?php 
                                echo JText::_('JGS_NO_COMMENTS');
                                ?>
 
<?php 
                                break;
                            case 1:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENT');
                                ?>
 
<?php 
                                break;
                            default:
                                ?>
              <?php 
                                echo $comments . ' ' . JText::_('JGS_COMMENTS');
                                ?>
 
<?php 
                                break;
                        }
                        ?>
            </li>
<?php 
                    }
                    ?>
            <li>
<?php 
                    // Download Icon
                    if ($showDownloadIcon == 1) {
                        ?>
              <a href="<?php 
                        echo JRoute::_('index.php?option=com_joomgallery&func=download&catid=' . $row->catid . '&id=' . $row->id . _JOOM_ITEMID);
                        ?>
"
                  onMouseOver="return overlib('<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT', true);
                        ?>
', CAPTION, '<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true);
                        ?>
', BELOW, RIGHT);" onmouseout="return nd();">
                <img src="<?php 
                        echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download.png';
                        ?>
" border="0" width="16" height="16" alt="<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION');
                        ?>
" class="pngfile jg_icon" />
              </a>
<?php 
                    } elseif ($showDownloadIcon == -1) {
                        ?>
              <span onMouseOver="return overlib('<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT_LOGIN', true);
                        ?>
', CAPTION, '<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true);
                        ?>
', BELOW, RIGHT);" onmouseout="return nd();" >
                <img src="<?php 
                        echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download_gr.png';
                        ?>
" alt="<?php 
                        echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION');
                        ?>
"  class="pngfile jg_icon" />
              </span>
<?php 
                    }
                    ?>
              <a href="<?php 
                    echo JRoute::_('index.php?option=com_joomgallery&func=removepicture&id=' . $row->id . _JOOM_ITEMID);
                    ?>
"
                  onMouseOver="return overlib('<?php 
                    echo $this->Output('REMOVE_TOOLTIP_TEXT');
                    ?>
', CAPTION, '<?php 
                    echo $this->Output('REMOVE_TOOLTIP_CAPTION');
                    ?>
', BELOW, RIGHT);" onmouseout="return nd();">
                <img src="<?php 
                    echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/basket_remove.png';
                    ?>
" alt="<?php 
                    echo $this->Output('REMOVE_TOOLTIP_CAPTION');
                    ?>
" class="pngfile jg_icon" />
              </a>
            </li>
          </ul>
        </div>
      </div>
<?php 
                    $index++;
                }
                ?>
      <div class="jg_clearboth"></div>
    </div>
<?php 
            }
        } else {
            ?>
    <div class="jg_txtrow">
      <div class="sectiontableentry1">
        <img src="<?php 
            echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/arrow.png';
            ?>
" class="pngfile jg_icon" alt="arrow" />
      <?php 
            echo $this->Output('NO_PICS');
            ?>
      </div>
    </div>
<?php 
        }
        ?>
    <div class="sectiontableheader">
      &nbsp;
    </div>
  </div>
<?php 
    }