function view(&$row, &$cat, &$neighbors, &$related, &$params)
    {
        global $option, $mainframe, $wbgItemid, $my;
        global $WBG_CONFIG, $WBG_LANG, $wbGallery_common;
        // mosPathway must be in template
        $wbGallery_common->pathway($row);
        // Stylesheet
        if ($params->get('css')) {
            $mainframe->addCustomHeadTag('<link href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/css/' . $params->get('css') . '" rel="stylesheet" type="text/css" />');
        } else {
            $mainframe->addCustomHeadTag('<link href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/css/default.css" rel="stylesheet" type="text/css" />');
        }
        // Page Title
        if ($params->get('wbg_title_show', 0)) {
            if ($params->get('view_img_name', 0)) {
                $page_title = $row->name;
            } elseif ($params->get('wbg_title_follow', 0)) {
                $page_title = $params->get('wbg_title', $row->name);
            }
            if ($page_title) {
                $title = sprintf($WBG_LANG->_('VIEW_IMAGE'), $page_title);
            } else {
                $title = $WBG_LANG->_('VIEW_IMAGE_GEN');
            }
            $mainframe->setPageTitle($title);
            if (is_object($cat) && strlen($cat->name) && $params->get('view_img_name_cat', 1)) {
                echo '<h1 class="componentheading"><a href="' . sefRelToAbs('index.php?option=' . $option . '&cid=' . $cat->id . '&Itemid=' . $wbgItemid) . '" title="' . $cat->name . '">' . $cat->name . '</a> :: ' . $title . '</h1>';
            } else {
                echo '<h1 class="componentheading">' . $title . '</h1>';
            }
        }
        // Neighbor Links
        if ($params->get('view_neighbors', 1) && ($neighbors->prev_id || $neighbors->next_id)) {
            $link = 'index.php?option=' . $option . '&Itemid=' . $wbgItemid . '&id=';
            echo '<div class="wbgNeighbor">';
            if ($neighbors->prev_id) {
                echo '<a href="' . sefRelToAbs($link . $neighbors->prev_id) . '" alt="' . $neighbors->prev_name . '" class="prev">' . $WBG_LANG->_('VIEW_PREV_IMAGE') . '</a>';
            }
            if ($neighbors->next_id) {
                echo '<a href="' . sefRelToAbs($link . $neighbors->next_id) . '" alt="' . $neighbors->next_name . '" class="next">' . $WBG_LANG->_('VIEW_NEXT_IMAGE') . '</a>';
            }
            echo '</div>';
        }
        // Render Detail Image
        $imgPath = wbGalleryDB_img::getImagePath($params->get('view_img_size', 'large'));
        $imgFile = $imgPath . $row->file;
        ?>

    <div class="wbgImgView">
      <span class="wbgImg">
        <div class="img"><img src="<?php 
        echo $imgFile;
        ?>
" border="0" /></div>
      </span>
    </div>
    <?php 
        // Sku / Price / Photographer
        if ($params->get('view_img_cat', 0)) {
            echo '<div class="category">' . sprintf($WBG_LANG->_('CAT_NAME'), $cat->name) . '</div>';
        }
        if ($params->get('view_img_sku', 0)) {
            echo '<div class="sku"><span>' . $WBG_LANG->_('SKU_TITLE') . '</span> ' . (strlen($row->sku) ? $row->sku : $WBG_LANG->_('SKU_NA')) . '</div>';
        }
        if ($params->get('view_img_price', 0)) {
            echo '<div class="price"><span>' . $WBG_LANG->_('PRICE_TITLE') . '</span> ' . $wbGallery_common->formatPrice($row->price) . '</div>';
        }
        if ($params->get('view_img_photog', 0)) {
            echo '<div class="photog"><span>' . $WBG_LANG->_('PHOTOGRAPHER_TITLE') . '</span> ' . (strlen($row->photographer) ? $row->photographer : $WBG_LANG->_('PHOTOGRAPHER_NA')) . '</div>';
        }
        // Image Description
        if ($params->get('view_img_desc', 1) && strlen(trim(strip_tags($row->description)))) {
            echo '<div class="componentdescription">' . $row->description . '</div>';
            echo '<div class="clr"></div>';
        }
        // Show Related Images
        if ($params->get('view_related', 1) && count($related)) {
            // Image Lightbox
            if ($params->get('img_link', 'lightbox') == 'lightbox' || $params->get('img_name_link', 'lightbox') == 'lightbox') {
                $mainframe->addCustomHeadTag('<script type="text/javascript">var path="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/";</script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/prototype.js"></script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/scriptaculous.js?load=effects"></script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/lightbox.js"></script>');
                $mainframe->addCustomHeadTag('<link rel="stylesheet" href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/css/lightbox.css" type="text/css" media="screen" />');
            }
            // Get Image Size Path
            $imgPath = wbGalleryDB_img::getImagePath($params->get('related_img_size', 'thumb'));
            $lboxImgPath = wbGalleryDB_img::getImagePath($params->get('lightbox_img_size', 'large'));
            // Render Relative Header
            if ($params->get('view_related_title', 1)) {
                if (is_object($cat)) {
                    $relLink = '<a href="' . sefRelToAbs('index.php?option=' . $option . '&cid=' . $cat->id . '&Itemid=' . $wbgItemid) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
                } else {
                    $relLink = '<a href="' . sefRelToAbs('index.php?option=' . $option . '&Itemid=' . $wbgItemid) . '" title="' . $WBG_LANG->_('RELATED_LINK_NOCAT') . '">' . $WBG_LANG->_('RELATED_LINK_NOCAT') . '</a>';
                }
                echo '<h2 class="contentheading">' . sprintf($WBG_LANG->_('RELATED_IMAGES'), $relLink) . '</h2>';
            }
            // Render Images
            echo '<div class="wbgRelatedImages">';
            echo '<div class="wbgImgList">';
            $count = 1;
            $cols = $params->get('related_img_cols', 3);
            echo '<div class="ncpr' . $cols . '">';
            foreach ($related as $img) {
                $link = sefRelToAbs('index.php?option=' . $option . '&id=' . $img->id . '&Itemid=' . $wbgItemid);
                $imgFile = $imgPath . $img->file;
                $lboxFile = $lboxImgPath . $img->file;
                $lboxName = $img->name . ($params->get('img_price', 0) ? ' ' . $wbGallery_common->formatPrice($img->price) : '');
                ?>

            <span class="wbgImg">
              <span class="block">
                <span class="pad">
                  <?php 
                if ($params->get('img_name', 1)) {
                    if ($params->get('img_name_link', 'view') == 'view') {
                        echo '<div class="name"><a href="' . $link . '">' . $img->name . '</a></div>';
                    } elseif ($params->get('img_name_link') == 'lightbox') {
                        echo '<div class="name"><a href="' . $lboxFile . '" rel="lightbox[' . $row->name . ']" title="' . $lboxName . '">' . $img->name . '</a></div>';
                    } else {
                        echo '<div class="name">' . $img->name . '</div>';
                    }
                }
                if ($params->get('img_image', 1)) {
                    if ($params->get('img_link', 'lightbox') != 'lightbox') {
                        $alt_link = null;
                        if ($params->get('lightbox_alternate', 'view') == 'view') {
                            $alt_link = $link;
                        } elseif (in_array($params->get('lightbox_alternate'), array('load', 'load_pop'))) {
                            $alt_link = $lboxFile;
                        }
                        ?>

                      <a href="<?php 
                        echo is_null($alt_link) ? 'javascript:void(0);' : $alt_link;
                        ?>
" title="<?php 
                        echo $lboxName;
                        ?>
" <?php 
                        echo $params->get('lightbox_alternate') == 'load_pop' ? 'target="_blank"' : '';
                        ?>
 class="img"><span style="background-image:url('<?php 
                        echo $imgFile;
                        ?>
');"><img src="<?php 
                        echo $imgFile;
                        ?>
" border="0" /></span></a>
                      <?php 
                    } else {
                        ?>

                      <a href="<?php 
                        echo $lboxFile;
                        ?>
" rel="lightbox[<?php 
                        echo $row->name;
                        ?>
]" title="<?php 
                        echo $lboxName;
                        ?>
" class="img"><span style="background-image:url('<?php 
                        echo $imgFile;
                        ?>
');"><img src="<?php 
                        echo $imgFile;
                        ?>
" border="0" /></span></a>
                      <?php 
                    }
                }
                if ($params->get('img_sku', 0)) {
                    echo '<div class="sku"><span>' . $WBG_LANG->_('SKU_TITLE') . '</span> ' . (strlen($img->sku) ? $img->sku : $WBG_LANG->_('SKU_NA')) . '</div>';
                }
                if ($params->get('img_price', 0)) {
                    echo '<div class="price"><span>' . $WBG_LANG->_('PRICE_TITLE') . '</span> ' . $wbGallery_common->formatPrice($img->price) . '</div>';
                }
                if ($params->get('img_photog', 0)) {
                    echo '<div class="photog"><span>' . $WBG_LANG->_('PHOTOGRAPHER_TITLE') . '</span> ' . (strlen($img->photographer) ? $img->photographer : $WBG_LANG->_('PHOTOGRAPHER_NA')) . '</div>';
                }
                if ($params->get('img_desc', 1)) {
                    echo '<div class="desc">' . $img->description . '</div>';
                }
                ?>

                </span>
              </span>
            </span>
            <?php 
                if (!($count++ % $cols)) {
                    echo '<div class="clr"></div>';
                }
            }
            echo '</div>';
            if (--$count % $cols) {
                echo '<div class="clr"></div>';
            }
            echo '</div>';
            // wbgImgList
            echo '</div>';
            // wbgRelatedImages
        }
        // End Related Images
        if ($params->get('view_goback') || $params->get('view_continue')) {
            echo '<div class="wbgFootnav">';
            if ($params->get('view_goback')) {
                echo '<div class="wbg_goback"><a href="javascript:history.back();" title="' . $WBG_LANG->_('GOBACK') . '">' . $WBG_LANG->_('GOBACK') . '</a></div>';
            }
            if ($params->get('view_continue')) {
                if (is_object($cat)) {
                    $relLink = '<a href="' . sefRelToAbs('index.php?option=' . $option . '&cid=' . $cat->id . '&Itemid=' . $wbgItemid) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
                } else {
                    $relLink = '<a href="' . sefRelToAbs('index.php?option=' . $option . '&Itemid=' . $wbgItemid) . '" title="' . $WBG_LANG->_('RELATED_LINK_NOCAT') . '">' . $WBG_LANG->_('RELATED_LINK_NOCAT') . '</a>';
                }
                echo '<div class="wbg_continue">' . sprintf($WBG_LANG->_('CONTINUE'), $relLink) . '</div>';
            }
            echo '</div>';
        }
    }
    function view(&$row, &$cats, &$imgs, &$pageNav, &$params)
    {
        global $option, $mainframe, $wbgItemid, $my;
        global $WBG_CONFIG, $WBG_LANG, $wbGallery_common;
        // mosPathway must be in template
        $wbGallery_common->pathway($row);
        // Stylesheet
        if ($params->get('css')) {
            $mainframe->addCustomHeadTag('<link href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/css/' . $params->get('css') . '" rel="stylesheet" type="text/css" />');
        } else {
            $mainframe->addCustomHeadTag('<link href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/css/default.css" rel="stylesheet" type="text/css" />');
        }
        // Page Title
        if ($params->get('wbg_title_show', 0)) {
            $custom_title = $params->get('wbg_title_follow', 0) || $row->id == $params->get('cid', 0);
            if ($custom_title && strlen($params->get('wbg_title', null))) {
                $title = $params->get('wbg_title');
            } elseif (strlen($row->name)) {
                $title = sprintf($WBG_LANG->_('VIEW_CATEGORY'), $row->name);
            } else {
                $title = $WBG_LANG->_('VIEW_CATEGORY_GEN');
            }
            $mainframe->setPageTitle($title);
            echo '<h1 class="componentheading">' . $title . '</h1>';
        }
        // Page Description
        if ($params->get('cat_desc', 1) && strlen(trim(strip_tags($row->description)))) {
            echo '<div class="desc">' . $row->description . '</div>';
            echo '<div class="clr"></div>';
        }
        // Show Categories
        $countCat = 0;
        if (count($cats)) {
            // Get Image Size Path
            $imgPath = wbGalleryDB_img::getImagePath($params->get('cat_size', 'thumb'));
            // Render Categories
            echo '<div class="wbgCatList">';
            $count = 1;
            $cols = $params->get('cat_cols', 3);
            echo '<div class="ncpr' . $cols . '">';
            foreach ($cats as $cat) {
                $imgFile = null;
                $link = sefRelToAbs('index.php?option=' . $option . '&cid=' . $cat->id . '&Itemid=' . $wbgItemid);
                if (in_array($params->get('cat_image', 1), array(2, 3)) && $cat->file) {
                    $imgFile = $imgPath . $cat->file;
                } elseif (in_array($params->get('cat_image', 1), array(1, 3)) && $cat->img_file) {
                    $imgFile = $imgPath . $cat->img_file;
                }
                if (!$params->get('cat_image', 1) || $imgFile) {
                    ?>
            <span class="wbgCat">
              <span class="block">
                <span class="pad">
                  <?php 
                    if (!is_null($imgFile)) {
                        if ($params->get('cat_name', 1)) {
                            echo '<div class="name">' . $cat->name . '</div>';
                        }
                        ?>
                      <a href="<?php 
                        echo $link;
                        ?>
" title="'.$cat->name.'" class="img"><span style="background-image:url('<?php 
                        echo $imgFile;
                        ?>
');">
                        <img src="<?php 
                        echo $imgFile;
                        ?>
" alt="'.$cat->name.'" border="0" /></span></a>
                      <?php 
                    } else {
                        echo '<div class="name"><a href="' . $link . '" title="' . $cat->name . '">' . $cat->name . '</a></div>';
                    }
                    if ($params->get('cat_desc', 1)) {
                        echo '<div class="desc">' . $cat->description . '</div>';
                    }
                    ?>
                </span>
              </span>
            </span>
            <?php 
                    if (!($count++ % $cols)) {
                        echo '<div class="clr"></div>';
                    }
                    $countCat++;
                }
            }
            echo '</div>';
            if (--$count % $cols) {
                echo '<div class="clr"></div>';
            }
            echo '</div>';
        }
        // Show Images
        $countImg = 0;
        if (count($imgs)) {
            // Page Navigation
            if (in_array($params->get('show_pagenav', 'both'), array('top', 'both'))) {
                echo '<div class="pagenav_top">' . $pageNav->writePagesLinks('index.php?option=' . $option . '&cid=' . $row->id . '&Itemid=' . $wbgItemid) . '</div>';
            }
            // Image Lightbox
            if ($params->get('img_link', 'lightbox') == 'lightbox' || $params->get('img_name_link', 'lightbox') == 'lightbox') {
                $mainframe->addCustomHeadTag('<script type="text/javascript">var path="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/";</script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/prototype.js"></script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/scriptaculous.js?load=effects"></script>');
                $mainframe->addCustomHeadTag('<script type="text/javascript" src="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/js/lightbox.js"></script>');
                $mainframe->addCustomHeadTag('<link rel="stylesheet" href="' . $mainframe->getCfg('live_site') . '/components/' . $option . '/lightbox/css/lightbox.css" type="text/css" media="screen" />');
            }
            // Get Image Size Path
            $imgPath = wbGalleryDB_img::getImagePath($params->get('img_size', 'thumb'));
            $lboxImgPath = wbGalleryDB_img::getImagePath($params->get('lightbox_img_size', 'large'));
            // Render Images
            echo '<div class="wbgImgList">';
            $count = 1;
            $cols = $params->get('img_cols', 3);
            echo '<div class="ncpr' . $cols . '">';
            foreach ($imgs as $img) {
                $link = sefRelToAbs('index.php?option=' . $option . '&id=' . $img->id . '&Itemid=' . $wbgItemid);
                $imgFile = $imgPath . $img->file;
                $lboxFile = $lboxImgPath . $img->file;
                $lboxName = $img->name . ($params->get('img_price', 0) ? ' ' . $wbGallery_common->formatPrice($img->price) : '');
                ?>
          <span class="wbgImg">
            <span class="block">
              <span class="pad">
                <?php 
                if ($params->get('img_name', 1)) {
                    if ($params->get('img_name_link', 'view') == 'view') {
                        echo '<div class="name"><a href="' . $link . '">' . $img->name . '</a></div>';
                    } elseif ($params->get('img_name_link') == 'lightbox') {
                        echo '<div class="name"><a href="' . $lboxFile . '" rel="lightbox[' . $row->name . ']" title="' . $lboxName . '">' . $img->name . '</a></div>';
                    } elseif ($params->get('img_name_link') == 'load') {
                        echo '<div class="name"><a href="' . $lboxFile . '" title="' . $lboxName . '">' . $img->name . '</a></div>';
                    } elseif ($params->get('img_name_link') == 'load_pop') {
                        echo '<div class="name"><a href="' . $lboxFile . '" title="' . $lboxName . '" target="_blank">' . $img->name . '</a></div>';
                    } else {
                        echo '<div class="name">' . $img->name . '</div>';
                    }
                }
                if ($params->get('img_image', 1)) {
                    if ($params->get('img_link', 'lightbox') != 'lightbox') {
                        $alt_link = null;
                        if ($params->get('lightbox_alternate', 'view') == 'view') {
                            $alt_link = $link;
                        } elseif (in_array($params->get('lightbox_alternate'), array('load', 'load_pop'))) {
                            $alt_link = $lboxFile;
                        }
                        ?>
                    <a href="<?php 
                        echo is_null($alt_link) ? 'javascript:void(0);' : $alt_link;
                        ?>
" title="<?php 
                        echo $lboxName;
                        ?>
" <?php 
                        echo $params->get('lightbox_alternate') == 'load_pop' ? 'target="_blank"' : '';
                        ?>
 class="img"><span style="background-image:url('<?php 
                        echo $imgFile;
                        ?>
');"><img src="<?php 
                        echo $imgFile;
                        ?>
" border="0" /></span></a>
                    <?php 
                    } else {
                        ?>
                    <a href="<?php 
                        echo $lboxFile;
                        ?>
" rel="lightbox[<?php 
                        echo $row->name;
                        ?>
]" title="<?php 
                        echo $lboxName;
                        ?>
" class="img"><span style="background-image:url('<?php 
                        echo $imgFile;
                        ?>
');"><img src="<?php 
                        echo $imgFile;
                        ?>
" border="0" /></span></a>
                    <?php 
                    }
                }
                if ($params->get('img_sku', 0)) {
                    echo '<div class="sku"><span>' . $WBG_LANG->_('SKU_TITLE') . '</span> ' . (strlen($img->sku) ? $img->sku : $WBG_LANG->_('SKU_NA')) . '</div>';
                }
                if ($params->get('img_price', 0)) {
                    echo '<div class="price"><span>' . $WBG_LANG->_('PRICE_TITLE') . '</span> ' . $wbGallery_common->formatPrice($img->price) . '</div>';
                }
                if ($params->get('img_photog', 0)) {
                    echo '<div class="photog"><span>' . $WBG_LANG->_('PHOTOGRAPHER_TITLE') . '</span> ' . (strlen($img->photographer) ? $img->photographer : $WBG_LANG->_('PHOTOGRAPHER_NA')) . '</div>';
                }
                if ($params->get('img_desc', 0)) {
                    echo '<div class="desc">' . $img->description . '</div>';
                }
                ?>
              </span>
            </span>
          </span>
          <?php 
                if (!($count++ % $cols)) {
                    echo '<div class="clr"></div>';
                }
                $countImg++;
            }
            echo '</div>';
            if (--$count % $cols) {
                echo '<div class="clr"></div>';
            }
            echo '</div>';
            // Page Navigation
            if (in_array($params->get('show_pagenav', 'both'), array('bottom', 'both'))) {
                echo '<div class="pagenav_bottom">' . $pageNav->writePagesLinks('index.php?option=' . $option . '&cid=' . $row->id . '&Itemid=' . $wbgItemid) . '</div>';
            }
        }
        // Nothing Displayed? Post Error...
        if (!$countCat && !$countImg) {
            echo '<h2 class="alert_msg">' . $WBG_LANG->_('ALERT_NODISPLAY') . '</h1>';
        }
    }