function addnav($text, $link = false, $priv = false, $pop = false, $popsize = "500x300")
{
    global $navsection, $navbysection, $translation_namespace, $navschema;
    global $block_new_navs;
    if ($block_new_navs) {
        return;
    }
    if ($link === false) {
        // Don't do anything if text is ""
        if ($text != "") {
            addnavheader($text);
        }
    } else {
        $args = func_get_args();
        if ($text == "") {
            //if there's no text to display, may as well just stick this on
            //the nav stack now.
            call_user_func_array("private_addnav", $args);
        } else {
            if (!isset($navbysection[$navsection])) {
                $navbysection[$navsection] = array();
            }
            $t = $args[0];
            if (is_array($t)) {
                $t = $t[0];
            }
            if (!array_key_exists($t, $navschema)) {
                $navschema[$t] = $translation_namespace;
            }
            array_push($navbysection[$navsection], array_merge($args, array("translate" => false)));
        }
    }
}
if (get_module_setting("navdisplay")) {
    if (get_module_pref("user_seeavatar") && get_module_pref("bought", "avatar", $args['acctid']) && get_module_pref("user_seeotheravatars")) {
        $set = get_module_pref("setname", "avatar", $args['acctid']);
        $race = strtolower($args['race']);
        if ($args['sex'] == SEX_MALE) {
            $gender = "male";
        } else {
            $gender = "female";
        }
        $image = avatar_getimage($race, $gender, $set, true, $args['acctid']);
        // Make the avatar image collapsible away.  Some people view the
        // game from work and having the avatar image makes it VERY
        // obviously a non-work site even in work-friendly skins
        // addnavheader("Avatar", false);
        addnavheader("Avatar");
        global $templatename;
        if ($templatename == "Classic.htm") {
            $image = "<tr><td>{$image}</td></tr>";
        }
        addnav("{$image}", "!!!addraw!!!", true);
    }
} elseif (get_module_setting("bioheaddisplay")) {
    if (get_module_pref("user_seeavatar") && get_module_pref("bought", "avatar", $args['acctid']) && get_module_pref("user_seeotheravatars")) {
        $set = get_module_pref("setname", "avatar", $args['acctid']);
        $race = strtolower($args['race']);
        if ($args['sex'] == SEX_MALE) {
            $gender = "male";
        } else {
            $gender = "female";
        }