function admin_save_text( type )
{
  // Set the backend filename to process
  var filename = 'modules/Admin/content/ajax_save_text.php';

  // Get the text
  var text = document.getElementById( type ).value;

  // Format any ampersands with URL friendly characters
  text = text.replace( /&/g, '%26' );

  // Create the parameter list
  var params = "type=" + type + "&text=" + text;

  // Inform the user that the item is being submitted
  if( type == 'HomePage' )
  {
    document.getElementById('HomeSubmit').value = 'Saving Text';
    id = 'HomeSubmit';
  }
  else if( type == 'HomeImage' )
  {
    document.getElementById('HomeImageSubmit').value = 'Saving Text';
    id = 'HomeImageSubmit';
  }
  else
  {
    document.getElementById('AboutSubmit').value = 'Saving Text';
    id = 'AboutSubmit';
  }

  // 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) )
    {
      // Toggle the save button
      toggle_submit( id, 'Text Saved', 'Submit' );
    }
  }

}

function admin_save_blog( pk_ID )
{
  // Set the backend filename to process
  var filename = 'modules/Admin/content/ajax_save_blog.php';

  title = 'vc_Title[' + pk_ID + ']';

  // Get the text
  var vc_Title = document.getElementById( 'vc_Title[' + pk_ID + ']' ).value;
  var txt_Text = document.getElementById( 'txt_Text[' + pk_ID + ']' ).value;
  var vc_URL = document.getElementById( 'vc_URL[' + pk_ID + ']' ).value;

  // Format any ampersands with URL friendly characters
  vc_Title = vc_Title.replace( /&/g, '%26' );
  txt_Text = txt_Text.replace( /&/g, '%26' );
  vc_URL = vc_URL.replace( /&/g, '%26' );

  // Create the parameter list
  var params = "pk_ID=" + pk_ID + "&vc_Title=" + vc_Title + "&txt_Text=" + txt_Text + "&vc_URL=" + vc_URL;

  // 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) )
    {
      // Create the id variable
      id = "Blog_" + pk_ID;

      // Toggle the save button
      toggle_submit( id, 'Text Saved', 'Submit' );
    }
  }

}

