function event_verify_new()
{
  // Initialize a variable for the integrity of the form
  ValidForm = true;

  // Get the variables we're checking on from the document
  var vc_Name = document.getElementById('vc_Name').value;
  var vc_Location = document.getElementById('vc_Location').value;

  // Make sure that the Event Name is valid
  if( vc_Name == "" )
  {
    // Set the Event Name warning
    document.getElementById('req_Name').style.color = '#990000';

    // Toggle the flag
    ValidForm = false;
  }
  else
  {
    // Make sure that the color is switched back if it has changed
    document.getElementById('req_Name').style.color = '#666666';
  }

  // Mke sure that the Event Location is valid
  if( vc_Location == "" )
  {
    // Set the Event Location warning
    document.getElementById('req_Location').style.color = '#990000';

    // Toggle the flag
    ValidForm = false;
  }
  else
  {
    // Make sure that the color is switched back if it has changed
    document.getElementById('req_Location').style.color = '#666666';
  }

  // If the form is still valid after the form checking, process
  // the form and save the Event
  if( ValidForm )
    document.getElementById('EventForm').submit();

}

function event_remove( EventID, row )
{
  // Get confirmation of the request
  var remove = confirm( 'Are you sure you want to remove this Event?\n\nThis cannot be undone.' );

  // Remove the page if requested
  if( remove == true )
  {
    // Set the backend filename to process
    var filename = 'modules/Events/ajax_remove_event.php';

    // Create the parameter list
    var params = "EventID=" + EventID;

    // 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) )
      {
        // Hide the row from the Event List
        document.getElementById( 'EventRow' + row ).style.display = 'none';
      }
    }

  } // end if remove == true

} // end function event_remove()


function event_save_comment( EventID )
{
  // First inform the user that the message is being saved
  //document.getElementById( 'MessageStatus' ).style.display = 'block';

  // Disable the text field
  document.getElementById( 'txt_Comment' ).readOnly = true;

  // Set the backend filename to process
  var filename = 'modules/Events/ajax_save_comment.php';

  // Get the new message body
  var txt_Comment = document.getElementById('txt_Comment').value;

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

  // Create the parameter list
  var params = "EventID=" + EventID + "&txt_Comment=" + txt_Comment;

  // 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) )
    {
      // Get the row we will insert before
      var Prepend = document.getElementById('EventComment');

      // Create the new DIV section node
      var EventComment = document.createElement("DIV");

      // Fix the properties of the new div
      EventComment.setAttribute( 'id', 'EventComment' );
      EventComment.style.paddingBottom = '10px';

      // Assign the contents of the AJAX POST to the DIV
      EventComment.innerHTML = xmlhttp.responseText;

      // Prepend the new element to the document
      document.getElementById( 'EventComments' ).insertBefore( EventComment, Prepend );

      // Clear the contents of the text field and enable it
      document.getElementById( 'txt_Comment' ).value = "";
      document.getElementById( 'txt_Comment' ).readOnly = false;

    }
  }


} // end function event_save_comment()
