function outline_highlight_element( ElementID, Toggle )
{
  if( Toggle == 'on' )
    document.getElementById( 'Element_' + ElementID ).style.Border = '1px solid #990000';
  else
    document.getElementById( 'Element_' + ElementID ).style.Border = '1px solid #ffffff';
}

function document_highlight_element( ElementID, Toggle )
{
  if( Toggle == 'on' )
    document.getElementById( 'Element_' + ElementID ).style.BackgroundColor = '#e5e5e5';
  else
    document.getElementById( 'Element_' + ElementID ).style.BackgroundColor = '#ffffff';
}

function document_show_comment( ElementID )
{
  document.getElementById( 'CommentLink_' + ElementID ).style.display = 'none';
  document.getElementById( 'Comment_' + ElementID ).style.display = 'block';
  document.getElementById( 'Element_' + ElementID ).style.BackgroundColor = '#e5e5e5';
}

function document_hide_comment( ElementID )
{
  document.getElementById( 'CommentLink_' + ElementID ).style.display = 'inline';
  document.getElementById( 'Element_' + ElementID ).style.BackgroundColor = '#ffffff';
  document.getElementById( 'Comment_' + ElementID ).style.display = 'none';
}

function outline_edit_element( ElementID, ElementType )
{
  if( ElementType == 'Section' )
  {
    var SectionTitle = document.getElementById( 'SectionTitle_' + ElementID ).innerHTML;
    document.getElementById( 'Section_' + ElementID ).innerHTML = '<input id="Edit_' + ElementID + '" type="text" class="text" value="' + SectionTitle + '" style="height: 22px; font-size: 18px; font-weight: bold; width: 300px;" /> [<a href="#NULL" onclick="outline_save_element( ' + ElementID + ' );" />save changes</a>]';
  }
}

function outline_save_element( ElementID )
{
  var Content = document.getElementById( 'Edit_' + ElementID ).value;

  // Set the backend filename to process
  var filename = 'modules/Outline/ajax_save_content.php';

  // Get the current contents of the input field
  var txt_Body = document.getElementById( 'Edit_' + ElementID ).value.replace( /&/g, '%26' );

  // Create the AJAX parameters
  var params = "ElementID=" + ElementID + "&txt_Body=" + txt_Body;

  // Process the AJAX POST request
  AJAX_POST( filename, params );

  // Update the form when the AJAX process finishes
  xmlhttp.onreadystatechange = function()
  {
    if( (xmlhttp.readyState == 4) && (xmlhttp.status == 200) )
    {
      // Update the Display Types 
      document.getElementById( "Section_" + ElementID ).innerHTML = xmlhttp.responseText;
    }
  }


}

