function getPopupLink($helper, $params, $window_name = '', $img_name = '', $title = '', $comment = '', $class = '')
{
    $ret = '';
    $popup_args = 'height=700, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no';
    $ret .= '<a href="#"';
    $class = trim($class);
    if (!empty($class)) {
        $ret .= ' class="' . htmlspecialchars($class, ENT_QUOTES) . '"';
    }
    if (!empty($comment)) {
        $ret .= 'title="' . htmlspecialchars($comment, ENT_QUOTES) . '"';
    }
    $href = makeHref(array('module' => 'popup', 'helper' => $helper) + makePageParams($params));
    $ret .= " onclick=\"window.open('{$href}', '{$window_name}', '{$popup_args}'); return false\">";
    if (!empty($img_name)) {
        $ret .= getImageHREF($img_name, $comment);
        if (!empty($title)) {
            $ret .= ' ';
        }
    }
    $ret .= $title;
    $ret .= '</a>';
    return $ret;
}
function showTabs($pageno, $tabno)
{
    global $tab, $page, $trigger;
    if (!isset($tab[$pageno]['default'])) {
        return;
    }
    echo "<div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
    foreach ($tab[$pageno] as $tabidx => $tabtitle) {
        // Hide forbidden tabs.
        if (!permitted($pageno, $tabidx)) {
            continue;
        }
        // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
        if (!isset($trigger[$pageno][$tabidx])) {
            $tabclass = 'std';
        } elseif (!strlen($tabclass = call_user_func($trigger[$pageno][$tabidx]))) {
            continue;
        }
        if ($tabidx == $tabno) {
            $tabclass = 'current';
        }
        // override any class for an active selection
        echo "<li><a class={$tabclass}";
        echo " href='" . makeHref(makePageParams(array('tab' => $tabidx)));
        echo "'>{$tabtitle}</a></li>\n";
    }
    echo "</ul></div>";
}