function olc_href_link($page = '', $parameters = '', $connection = NONSSL, $add_session_id = true, $search_engine_safe = true, $create_ajax_link = true, $force_server_inclusion = false, $allow_ssl = true)
{
    global $session_started, $http_domain, $https_domain, $use_catalog_link, $request_type, $make_onclick_link;
    global $box_assignments, $box_relations, $box_constants, $currencies;
    global $seo_categories, $seo_search, $seo_replace, $smarty, $breadcrumb;
    if (olc_not_null($page)) {
        $separator = QUESTION;
        if (olc_not_null($parameters)) {
            /*
            if (!USE_SEO)
            {
            	if (strpos($parameters,HTML_AMP)===false)
            	{
            		$parameters=str_replace(AMP,HTML_AMP,$parameters);
            	}
            }
            */
            $link = $page . $separator . $parameters;
            $separator = AMP;
        } else {
            $link = $page;
        }
        $server = HTTP_SERVER;
        if ($connection == SSL || getenv(HTTPS) != null) {
            if (IS_ADMIN_FUNCTION) {
                $allow_ssl = true;
            } else {
                $allow_ssl = ENABLE_SSL;
            }
            if ($allow_ssl) {
                $server = HTTPS_SERVER;
            }
        }
        /*
        if (strpos($page,'http')===false)
        {
        	if (IS_ADMIN_FUNCTION && !$use_catalog_link)
        	{
        		$link_dir = DIR_WS_ADMIN;
        	}
        	else
        	{
        		$link_dir = DIR_WS_CATALOG;
        	}
        	$link=$link_dir.$link;
        }
        */
        if (NOT_IS_ADMIN_FUNCTION) {
            if (ADD_SESSION_ID) {
                if ($add_session_id) {
                    if (defined('SID') && olc_not_null(SID)) {
                        $sid = SID;
                    } elseif ($server) {
                        if ($http_domain != $https_domain) {
                            $sid = session_name() . '=' . session_id();
                        }
                    }
                }
            }
            if (strpos($_SERVER['PHP_SELF'], SLASH . "admin") === false) {
                // User mode!
                // Add the session id when moving from different HTTP and HTTPS servers, or when SID is defined
                if (olc_check_agent()) {
                    $sid = NULL;
                }
                if (isset($sid)) {
                    $link .= $separator . $sid;
                }
                if ($search_engine_safe) {
                    if (strpos($link, DIR_WS_PRODUCT_IMAGES) == false) {
                        $link = olc_seo_url($link);
                    }
                }
                //W. Kaiser - AJAX
                if (!defined('USE_AJAX')) {
                    // include the AJAX-related code
                    require DIR_WS_INCLUDES . 'ajax' . PHP;
                }
            }
        }
        $not_is_pop_up_link = strpos($parameters, "pop_up") === false;
        if (USE_AJAX) {
            //			$link=str_replace(DIR_WS_CATALOG,EMPTY_STRING,$link);
            /*
            if ($create_ajax_link)
            {
            //				$check_link=strpos($page,FILENAME_PRODUCT_INFO)!==false;
            //				if (!$check_link)
            //				{
            //				if (NOT_IS_ADMIN_FUNCTION)
            //				{
            //				$check_link=strpos($page,FILENAME_DEFAULT)!==false;
            //				}
            //				}
            //				if ($check_link)
            //				{
            //				$onclick="javascript:onclick="javascript:;
            //				if (strpos($page,AJAX_REQUEST)===false)
            //				{
            //
            //				}
            //				}
            }
            */
        } else {
            //$link=$server.$link;
            if ($make_onclick_link) {
                if ($not_is_pop_up_link) {
                    $link = "document.location.href='" . $link . APOS;
                }
                $make_onclick_link = false;
            }
        }
        //W. Kaiser - AJAX
        if (IS_MULTI_SHOP) {
            $link = olc_set_multi_shop_dir_info($link);
        }
        $link = str_replace(HTML_AMP, AMP, $link);
        $link = str_replace(AMP . AMP, AMP, $link);
        $link = str_replace(QUESTION . AMP, QUESTION, $link);
        $link = str_replace(AMP, HTML_AMP, $link);
        return $link;
    } else {
        my_error_handler(E_USER_ERROR, TEXT_ERROR_LINK_NOT_DEFINED);
    }
}
function olc_href_link_catalog($page = '', $parameters = '', $connection = NONSSL, $add_session_id = true, $search_engine_safe = true, $create_ajax_link = true)
{
    global $request_type, $session_started, $http_domain, $https_domain;
    if (olc_not_null($page)) {
        $link = HTTP_SERVER . DIR_WS_CATALOG;
        if (olc_not_null($parameters)) {
            $link .= $page . '?' . $parameters;
            //$separator = AMP;
        } else {
            $link .= $page;
            //$separator = '?';
        }
        while (substr($link, -1) == AMP || substr($link, -1) == '?') {
            $link = substr($link, 0, -1);
        }
        // Add the session id when moving from different HTTP and HTTPS servers, or when SID is defined
        if ($search_engine_safe) {
            return olc_seo_url($link);
        }
    } else {
        $die_error_text = '</td></tr></table></td></tr></table><br/><br/><font color="#ff0000">".
			"<b>Fehler!</b></font><br/><br/><b>Der Link ist nicht definiert!<br/><br/>';
        die($die_error_text);
    }
}