function append_html(the_id, content)
{
  if (document.getElementById)
    {                                          
      //explorer, netscape6
      document.getElementById(the_id).innerHTML += content;
    }
  else if (document.all)
    {                                               
      //explorer4
      document.all[the_id].innerHTML += content;
    }
  else if (document.layers)
    {                                            
      //netscape6
      document.layers[the_id].document.open();
      document.layers[the_id].document.write(content);
      document.layers[the_id].document.close();
    }
}

function background_color(src, color)
{
  src.style.backgroundColor = color;
}

function get_ref_to_id(div_id, o_doc)
{
  //Found here: http://www.howtocreate.co.uk/emails/DavidBerman.html
  if(!o_doc)
    {
      o_doc = document;
    }
  if(document.layers)
    {
      if(o_doc.layers[div_id])
        {
          return o_doc.layers[div_id]; 
        }
      else
        {
          //repeatedly run through all child layers
          for(var x = 0, y; !y && x < o_doc.layers.length; x++)
            {
              //on success, return that layer, else return nothing
              y = getRefToDiv(div_id, o_doc.layers[x].document); 
            }
          return y; 
        } 
    }
  if(document.getElementById)
    {
      return document.getElementById(div_id); 
    }
  if(document.all) 
    {
      return document.all[div_id];
    }
  return false;
}


function navigate(url)
{
  window.location = url;
}

function show_hide(div_id)
{
  div_ref = get_ref_to_id(div_id);

  if (div_ref)
    {
      if (div_ref.style)
        {
          div_ref = div_ref.style;
        }

      if (div_ref.display == "none")
        {
          div_ref.display = "";
        }
      else
        {
          div_ref.display = "none";
        }
    }
}

function show_hide_both(numerical_id)
{
  show_div_id = 'show_' + numerical_id;
  show_hide(show_div_id);

  hidden_div_id = 'hidden_' + numerical_id;
  show_hide(hidden_div_id);
}

function write_html(the_id, content)
{
  if (document.getElementById)
    {                                          
      //explorer, netscape6
      document.getElementById(the_id).innerHTML = content;
    }
  else if (document.all)
    {                                               
      //explorer4
      document.all[the_id].innerHTML = content;
    }
  else if (document.layers)
    {                                            
      //netscape6
      document.layers[the_id].document.open();
      document.layers[the_id].document.write(content);
      document.layers[the_id].document.close();
    }
}
