function ge(d)
{
    if (document.getElementById)
    {
        // this is the way the standards work
        return document.getElementById(d);
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        return document.all[d];
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        return document.layers[d];
    }
    return null;
}

// this function will simple turn on or off the element found at 'd' (the param passed)
// this is a utility function which is used in lots of places
function toggle(d)
{
    var new_display = '';
    var elem = ge(d);
    if(elem)
    {
        new_display = elem.style.display? "":"block";
        elem.style.display = new_display;
    }
    return new_display;
}
// this method is called when load is completed... and will
// show or hide the right set of login or edit buttons.
function edit_settings()
{
    var edit = is_logged_in();
    if(edit == 1)
    {
        // user is logged in as edit
        toggle('edit_controls_si');
    }
    else
    {
        // user is not logged in as edit    
        toggle('edit_controls_so');
    }
}

// this is a utility function which is used elsewhere.
function is_logged_in()
{
    var full_cookie = document.cookie;
    var cooks = full_cookie.split(';');
    var ret_val = 0;
    for(var i = 0; i<cooks.length; i++)
    {
        var c = cooks[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        var pieces = c.split('=');
        if(pieces[0] == 'AMB::AuthCookie2_AMB')
        {
            ret_val = 1;
            break;
        }
    }
    return ret_val;
}