function tep_href_link($page = '', $parameters = '', $connection = '', $add_session_id = true, $search_engine_safe = true, $url_encode = true)
{
    extract(tep_load('defs', 'sessions'));
    //-MS- SEO-G Added
    global $g_seo_url;
    //-MS- SEO-G Added EOM
    $sid = '';
    $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
    if ($connection == 'SSL' && ENABLE_SSL == true) {
        $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
    } else {
        $connection = 'NONSSL';
    }
    if ($page == FILENAME_DEFAULT) {
        $page = '';
    }
    if (!empty($parameters)) {
        $parameters = tep_sort_parameter_string($parameters);
        $link .= $page . '?' . tep_output_string($parameters);
        $separator = '&';
    } else {
        $link .= $page;
        $separator = '?';
    }
    rtrim($link, '?&');
    // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
    if (defined('SESSION_FORCE_COOKIE_USE') && SESSION_FORCE_COOKIE_USE == 'false' && $add_session_id == true && $cSessions->has_started()) {
        $sid = $cSessions->get_string();
        if (empty($sid) && ($cDefs->request_type == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL == true || $cDefs->request_type == 'SSL' && $connection == 'NONSSL')) {
            if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
                $sid = $cSessions->get_string(true);
            }
        }
    }
    //-MS- SEO-G Added
    if (isset($g_seo_url) && is_object($g_seo_url)) {
        if ($connection == 'NONSSL' || SEO_PROCESS_SSL == 'true') {
            $link = $g_seo_url->get_seo_url($link, $separator, $search_engine_safe);
        }
    }
    //-MS- SEO-G Added EOM
    if (!empty($sid)) {
        $link .= $separator . $sid;
    }
    if ($url_encode && !empty($parameters)) {
        $link = str_replace('&', '&', $link);
    }
    return $link;
}
function tep_catalog_href_link($page = '', $parameters = '', $connection = 'NONSSL', $url_encode = true)
{
    $link = HTTP_CATALOG_SERVER;
    if ($connection == 'SSL' && defined('ENABLE_SSL_CATALOG') && ENABLE_SSL_CATALOG == 'true') {
        $link = HTTPS_CATALOG_SERVER;
    }
    $link .= DIR_WS_CATALOG . $page;
    if (!empty($parameters)) {
        $parameters = tep_sort_parameter_string($parameters);
        $link .= '?' . tep_output_string($parameters);
    }
    rtrim($link, '?&');
    if ($url_encode) {
        $link = str_replace('&', '&', $link);
    }
    return $link;
}