  var updateInProgress = false;
  var rootDivs         = null;
  var divIndex         = -1;
  
  var ajaxReq          = null;
  var ajaxDoc          = null;
  var aForumForm       = null;
  var aForumMessageUrl = null;
  var aCreateUrl       = null;
  var forumSubmitParams = null;
	var IE;
	
  
  
  function doDelay(Amount) { 
   d = new Date(); //today's date 
   while (1) { 
     mill = new Date(); // Date Now 
     diff = mill-d; //difference in milliseconds 
     if( diff > Amount ) { 
       break; 
     } 
   } 
 } 
         
  function newRequest() {
    if (IE == true)  {
      return new ActiveXObject("Microsoft.XMLHTTP");    
    } else {
      return new XMLHttpRequest();
    }
  } // newRequest()
  
  function processAjax() {
    if ((ajaxReq.readyState == 4) && (ajaxReq.status == 200)) {
      ajaxDoc           = ajaxReq.responseText;
      aForumMessageUrl  = ajaxDoc;
      checkForm();
    }
  } // processAjax()  
  
  function processAjaxForumSubmit() {
    if ((ajaxReq.readyState == 4) && ((ajaxReq.status == 200) || (ajaxReq.status == 404))) {
      ajaxDoc           = ajaxReq.responseText;
      doDelay(2000);
      lStr = window.location.href;
      if (lStr.indexOf("frompost=1") == -1)
      {
        lStr = window.location.href + '&frompost=1';
        window.location = lStr;
      }else{    
        window.location.reload();
      }
    }
  } // processAjaxPollResult()

  function processForumSubmit() {
    try {
      ajaxReq = newRequest();
      ajaxReq.onreadystatechange = processAjaxForumSubmit;
      ajaxReq.open("POST", aForumMessageUrl, true);
      ajaxReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      ajaxReq.setRequestHeader("Content-length", forumSubmitParams.length);
      ajaxReq.setRequestHeader("Connection", "close");       
      ajaxReq.send(forumSubmitParams);
    } catch(e) {
      alert(e);  
    }  
  }  // processPollMiniResult()

  function checkForm() {	
  	formErrors      = true;
  	aForm           = document.getElementById(aForumForm);
    var getstr = '';
    for (i=0; i<aForm.childNodes.length; i++) {
       if (aForm.childNodes[i].tagName == "INPUT"){
          if (aForm.childNodes[i].type == "text") {
             getstr += aForm.childNodes[i].name + "=" + escape(aForm.childNodes[i].value) + "&";
          }
          if (aForm.childNodes[i].type == "checkbox") {
             if (aForm.childNodes[i].checked) {
                getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";
             } else {
                getstr += aForm.childNodes[i].name + "=&";
             }
          }
          if (aForm.childNodes[i].type == "radio") {
             if (aForm.childNodes[i].checked) {
                getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";
             }
          }
       } 
       if (aForm.childNodes[i].tagName == "TEXTAREA"){
         getstr += aForm.childNodes[i].name + "=" + escape(aForm.childNodes[i].value) + "&";       
      }
       if (aForm.childNodes[i].tagName == "SELECT") {
          var sel = aForm.childNodes[i];
          getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
       }
       if (aForm.childNodes[i].type == "hidden") {
         getstr += aForm.childNodes[i].name + "=" + aForm.childNodes[i].value + "&";       
       }
    }
    forumSubmitParams = getstr;
    ajaxReq = null;
    processForumSubmit();
  }  

 
  function processForum() {
    try {
        ajaxReq                    = newRequest();
        ajaxReq.onreadystatechange = processAjax;
        ajaxReq.open("GET", aCreateUrl, true);
        ajaxReq.send(null);
    } catch(e) {
      alert(e);  
    }  
  } // processPollMini()


  