
// Function to hide the standard Relibase menu bar at the top of the current
// page if it is being displayed within a frameset and it is not the proper
// "top_frame_menu_bar" frame.
function hide_menu_if_in_frame()
{
    // Check whether frames are being used. If they are and this frame is not
    // the proper top frame that should display the menu bar, don't display it...
    if ( frames_are_being_used() && self.name != "top_frame_menu_bar" )
    {
        toggle_element_display("logo_menu_bar");
        toggle_element_display("buttons_menu_bar");
        toggle_element_display("title_menu_bar");
    }
}


/*
  Toggles all checkbox states in a form.
  If any checkboxes are off, turns checkboxes all on.
  If all checkboxkes are on, turns checkboxes all off
*/
function toggle_checkboxes(form_name)
{
    var f = get_compatible_element(form_name);
    
    var bool = false;
    
    // Check if any checkboxes turned off.
    for (var i = 0; i < f.length; i++)
    {
        var e = f.elements[i];
 
        if (e.type == "checkbox")
        {
            if ( !is_checked(e) )
            {
                bool = true;
                break;
            }
        }
    }
    
    for (var i = 0; i < f.length; i++)
    {
        var e = f.elements[i];
        
        if (e.type == "checkbox")
        {
            if(bool == true)
                e.checked = true;
            else
                e.checked = false;
        }
    }
}

// Reset the current domain selection 
function reset_selected_domains_cookie()
{
    document.cookie = "relibase_domains=default" +
                      "; expires=" + 0 +
                      "; path=/";
}

function reset_selected_hitlist_cookie()
{
    document.cookie = "relibase_hitlist=default" +
                      "; expires=" + 0 +
                      "; path=/";
}

