function submitAttend() {
  var attend = document.getElementById("txtAttend").value;
  var url = "UpdateAttend.asp";
  request.open("POST", url, true);
  request.onreadystatechange = replaceAttend;
  request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  request.send("attend=" + escape(attend));
}

function replaceAttend() {
  if (request.readyState == 4) {
    var mainDiv = document.getElementById("attend");
    var attendBody = document.getElementById("attendBody");
	var attendForm = document.getElementById("frmAttend");
    var attendCaption = document.getElementById("AttendCaption");

	pElement = document.createElement("p");
	sElement = document.createElement("span");
	
	if (request.status == 200) {
      var response = request.responseText;

      // Replace the form with the confirmation
		document.getElementById("VideoCaption").style.display = "block";
		document.getElementById("attendBody").style.display = "none";

	    var videoCaption = document.getElementById("VideoCaption");

      // Create some confirmation text
      textNode = document.createTextNode(" - Enjoy the Service!");
      videoCaption.appendChild(textNode);

	} else {
      var message = request.getResponseHeader("Status");
      if ((message == null) || (message.length <= 0)) {
		  textNode = document.createTextNode("Please enter a valid number of people.");
		  sElement.appendChild(textNode);
	
		  // Replace the form with the confirmation
		  attendBody.replaceChild(sElement, attendCaption);
      } else {
      textNode = document.createTextNode("Please enter a valid number of people.");
      sElement.appendChild(textNode);

      // Replace the form with the confirmation
      attendBody.replaceChild(sElement, attendCaption);
      }
    }
  }
}