/**
     * Class constructor
     *
     */
    function Joom_DetailView()
    {
        include_once JPATH_COMPONENT . DS . 'includes' . DS . 'html' . DS . 'joom.viewdetails.html.php';
        jimport('joomla.filesystem.file');
        $this->_mainframe =& JFactory::getApplication('site');
        $database =& JFactory::getDBO();
        $user =& JFactory::getUser();
        $config = Joom_getConfig();
        $this->id = JRequest::getInt('id', 0);
        $this->slideshow = trim(Joom_mosGetParam('jg_slideshow', '', 'post'));
        if ($config->jg_showdetailaccordion) {
            $this->toggler = 'class="joomgallery-toggler"';
            $this->slider = 'class="joomgallery-slider"';
        } else {
            $this->toggler = 'class="joomgallery-notoggler"';
            $this->slider = '';
        }
        $database->setQuery(" SELECT\n                            c.access AS access,\n                            c.name AS name,\n                            c.cid AS cid\n                          FROM\n                            #__joomgallery_catg AS c\n                          LEFT JOIN\n                            #__joomgallery AS a ON a.catid = c.cid\n                          WHERE\n                            a.id = {$this->id}\n                        ");
        if (!($catinfo = $database->loadObject())) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOT_ALLOWED_VIEW_PICTURE'));
        }
        $this->c_access = $catinfo->access;
        $this->cattitle = $catinfo->name;
        if ($user->get('aid') < $this->c_access) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOT_ALLOWED_VIEW_PICTURE'));
        }
        $database->setQuery(" SELECT\n                            a.id,\n                            a.catid,\n                            a.imgtitle,\n                            a.imgauthor,\n                            a.imgtext,\n                            a.imgdate,\n                            a.imgcounter,\n                            a.imgvotes,\n                            a.imgvotesum,\n                            a.published,\n                            a.imgfilename,\n                            a.imgthumbname,\n                            a.checked_out,\n                            a.owner,\n                            a.approved,\n                            a.useruploaded,\n                            a.ordering,\n                            u.username,\n                            ROUND(imgvotesum/imgvotes, 2) AS rating\n                          FROM\n                            #__joomgallery AS a\n                          LEFT JOIN\n                            #__users AS u ON u.id = a.owner\n                          WHERE\n                                a.id        = " . $this->id . "\n                            AND a.approved  = '1'\n                            AND a.published = '1'\n                        ");
        $result1 = $database->loadObject();
        $this->id = $result1->id;
        $this->catid = $result1->catid;
        $this->imgtitle = $result1->imgtitle;
        $this->imgauthor = $result1->imgauthor;
        $this->imgtext = $result1->imgtext;
        $this->imgdate = $result1->imgdate;
        $this->imgcounter = $result1->imgcounter;
        $this->imgvotes = $result1->imgvotes;
        $this->imgvotesum = $result1->imgvotesum;
        $this->published = $result1->published;
        $this->imgfilename = $result1->imgfilename;
        $this->imgthumbname = $result1->imgthumbname;
        $this->checked_out = $result1->checked_out;
        $this->imgowner = $result1->owner;
        $this->approved = $result1->approved;
        $this->useruploaded = $result1->useruploaded;
        $this->ordering = $result1->ordering;
        $this->imgownerid = $result1->username;
        $this->rating = $result1->rating;
        if ($this->published != 1 && $this->approved != 1) {
            $this->_mainframe->redirect(JRoute::_('index.php?option=com_joomgallery&view=gallery' . _JOOM_ITEMID, false), JText::_('JGS_ALERT_NOPICTURE_OR_NOTAPPROVED'));
        }
        $this->catpath = Joom_GetCatPath($this->catid);
        $this->joom_thumbnailpath = $config->jg_paththumbs . $this->catpath;
        $this->joom_picturepath = $config->jg_pathimages . $this->catpath;
        $this->joom_originalpath = $config->jg_pathoriginalimages . $this->catpath;
        $this->joom_thumbnailsource = $config->jg_paththumbs . $this->catpath . $this->imgfilename;
        $this->joom_picturesource = $config->jg_pathimages . $this->catpath . $this->imgfilename;
        $this->joom_originalsource = $config->jg_pathoriginalimages . $this->catpath . $this->imgfilename;
        $this->joom_componenturl = 'index.php?option=com_joomgallery';
        $this->joom_assetspath = 'components/com_joomgallery/assets/';
        $this->picture_src = '';
        if ($config->jg_watermark == 1) {
            $this->picture_src = _JOOM_LIVE_SITE . $this->joom_componenturl . '&amp;func=watermark&amp;catid=' . $this->catid . '&amp;id=' . $this->id . str_replace('&', '&amp;', _JOOM_ITEMID);
        } else {
            $this->picture_src = _JOOM_LIVE_SITE . $this->joom_picturesource;
        }
        if (JFile::exists(JPATH_ROOT . DS . $this->joom_originalsource)) {
            $imginfo_ori = getimagesize(JPath::clean(JPATH_ROOT . DS . $this->joom_originalsource));
            $this->originalimgsize = filesize(JPath::clean(JPATH_ROOT . DS . $this->joom_originalsource));
            $this->foriginalimgsize = number_format($this->originalimgsize / 1024, 2, ",", ".") . " KB";
        } else {
            $imginfo_ori[0] = 0;
            $imginfo_ori[1] = 0;
            $this->foriginalimgsize = JText::_('JGS_NO_ORIGINAL_FILE');
        }
        $imginfo = getimagesize(JPath::clean(JPATH_ROOT . DS . $this->joom_picturesource));
        $imgsize = filesize(JPath::clean(JPATH_ROOT . DS . $this->joom_picturesource));
        $this->fimgsize = number_format($imgsize / 1024, 2, ',', '.') . ' KB';
        $this->srcWidth_ori = $imginfo_ori[0];
        $this->srcHeight_ori = $imginfo_ori[1];
        $this->srcWidth = $imginfo[0];
        $this->srcHeight = $imginfo[1];
        $this->fimgdate = strftime($config->jg_dateformat, $this->imgdate);
        $this->frating = number_format($this->rating, 2, ',', '.');
        if ($config->jg_secondorder != '' && $config->jg_thirdorder == '') {
            $orderclause = $config->jg_firstorder . ', ' . $config->jg_secondorder;
        } elseif ($config->jg_secondorder != '' && $config->jg_thirdorder != '') {
            $orderclause = $config->jg_firstorder . ', ' . $config->jg_secondorder . ', ' . $config->jg_thirdorder;
        } else {
            $orderclause = $config->jg_firstorder;
        }
        $database->setQuery(" SELECT\n                            *\n                          FROM\n                            #__joomgallery\n                          WHERE\n                                    catid = " . $this->catid . "\n                            AND approved  = '1'\n                            AND published = '1'\n                          ORDER BY\n                            {$orderclause}\n                        ");
        $this->rows = $database->loadObjectList();
        ?>
  <a name="joomimg"></a>
<?php 
        if ($config->jg_showdetailtitle == 1) {
            HTML_Joom_Detail::Joom_ShowPictureTitle_HTML();
        }
        if (($config->jg_bigpic == 1 && $user->get('aid') > 0 || $config->jg_bigpic == 2) && !$this->slideshow && JFile::exists(JPATH_ROOT . DS . $this->joom_originalsource) && ($this->srcWidth_ori > $this->srcWidth && $this->srcHeight_ori > $this->srcHeight)) {
            $this->link = Joom_OpenImage($config->jg_bigpic_open, $this->id, $this->catpath, $this->catid, $this->imgfilename, $this->imgtitle, $this->imgtext);
        } else {
            $this->link = '';
        }
        if ($this->slideshow == false) {
            Joom_LightboxImages(0, 1, 0, $this->catid, $this->id);
        }
        $this->Joom_ShowPicture();
        if ($config->jg_slideshow) {
            $this->Joom_ShowSlideshow();
        }
        $this->Joom_PagingCategory();
        if (!$this->slideshow) {
            Joom_LightboxImages(0, 2, 0, $this->catid, $this->id);
        }
        if ($config->jg_minis) {
            $this->Joom_ShowMinis();
        }
        if ($config->jg_showdetailtitle == 2) {
            HTML_Joom_Detail::Joom_ShowPictureTitle_HTML();
        }
        $modules = Joom_getModules('detailbtm');
        if (count($modules)) {
            $document =& JFactory::getDocument();
            $renderer = $document->loadRenderer('module');
            $style = -2;
            $params = array('style' => $style);
            foreach ($modules as $module) {
                ?>
  <div class="jg_module">
<?php 
                if ($module->showtitle) {
                    ?>
    <div class="sectiontableheader">
      <h4>
        <?php 
                    echo $module->title;
                    ?>
&nbsp;
      </h4>
    </div>
<?php 
                }
                echo $renderer->render($module, $params);
                ?>
  </div>
<?php 
            }
        }
        if ($config->jg_showdetail) {
            $this->Joom_ShowPictureData();
        }
        # Update View counter
        $this->imgcounter++;
        if ($config->jg_watermark == 0) {
            $database->setQuery(" UPDATE\n                              #__joomgallery\n                            SET\n                              imgcounter = " . $this->imgcounter . "\n                            WHERE\n                              id = " . $this->id . "\n                          ");
            $database->query();
        }
        if ($config->jg_slideshow) {
            HTML_Joom_Detail::Joom_ShowSlideshow_HTML();
        }
        //******************************************************************************
        //wenn die Slideshow aktiviert ist, sind die folgenden Abfragen hinfaellig
        if ($this->slideshow) {
            return;
        }
        //******************************************************************************
        $modules = Joom_GetModules('detailpane');
        if (count($modules)) {
            HTML_Joom_Detail::Joom_ShowModules_HTML($modules);
        }
        if ($config->jg_showexifdata && extension_loaded('exif') && function_exists('exif_read_data')) {
            include_once JPATH_COMPONENT . DS . 'includes' . DS . 'exif' . DS . 'joom.exifdata.php';
        }
        if ($config->jg_showiptcdata) {
            include_once JPATH_COMPONENT . DS . 'includes' . DS . 'iptc' . DS . 'joom.iptcdata.php';
        }
        if ($config->jg_showrating) {
            HTML_Joom_Detail::Joom_ShowVotingArea_HTML();
        }
        if ($config->jg_bbcodelink) {
            $show_img = false;
            $show_url = false;
            if ($config->jg_bbcodelink == 1 || $config->jg_bbcodelink == 3) {
                $show_img = true;
            }
            if ($config->jg_bbcodelink == 2 || $config->jg_bbcodelink == 3) {
                $show_url = true;
            }
            HTML_Joom_Detail::Joom_ShowBBCodeLink_HTML($this->picture_src, $show_img, $show_url);
        }
        if ($config->jg_showcomment) {
            //darf der Besucher Kommentare eingeben
            if ($config->jg_anoncomment || !$config->jg_anoncomment && $user->get('id')) {
                $allowcomment = 1;
            } else {
                $allowcomment = 0;
            }
            HTML_Joom_Detail::Joom_ShowCommentsHead_HTML();
            if ($config->jg_showcommentsarea == 2) {
                HTML_Joom_Detail::Joom_ShowCommentsArea_HTML($allowcomment);
                HTML_Joom_Detail::Joom_BuildCommentsForm_HTML($allowcomment);
            } else {
                HTML_Joom_Detail::Joom_BuildCommentsForm_HTML($allowcomment);
                HTML_Joom_Detail::Joom_ShowCommentsArea_HTML($allowcomment);
            }
            HTML_Joom_Detail::Joom_ShowCommentsEnd_HTML();
        }
        if ($config->jg_send2friend) {
            HTML_Joom_Detail::Joom_ShowSend2FriendArea_HTML();
        }
    }
     $categoryclass->Joom_CatPageNav();
     $count = $categoryclass->catcount;
     $orderclause = $categoryclass->orderclause;
     $catstart = $categoryclass->catstart;
     $startpage = $categoryclass->catstartpage;
     $gesamtseiten = $categoryclass->catgesamtseiten;
     //Ausgabe der Kategorienavigation im Header
     if ($config->jg_showpagenav == 1 || $config->jg_showpagenav == 2) {
         $categoryclass->Joom_ShowCategoryPageNav();
     }
     //Kategorie Kopfbereich
     $categoryclass->Joom_ShowCategoryHead();
     Joom_LightboxImages(0, $catstart, $orderclause, $catid, 0);
     //Kategorie Hauptbereich
     $categoryclass->Joom_ShowCategoryBody();
     Joom_LightboxImages($catstart + $config->jg_perpage, $count, $orderclause, $catid, 0);
     //Kategorie Navi im Footer
     if ($config->jg_showpagenav == 2 || $config->jg_showpagenav == 3) {
         $categoryclass->Joom_ShowCategoryPageNav();
     }
     //title-tag
     $pagetitle = Joom_MakePagetitle($config->jg_pagetitle_cat, $categoryclass->catname, '');
     $document->setTitle(JText::_('JGS_GALLERY') . " - " . $pagetitle);
     break;
 case 'uploadhandler':
     include JPATH_COMPONENT . DS . 'classes' . DS . 'upload.class.php';
     $uploadclass = new Joom_Upload($func, $catid);
     break;
 case 'send2friend':
     //TODO
     $send2friendname = Joom_mosGetParam('send2friendname', '', 'post');