function getXmlHttp()
{
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function single_submit(postData, okRoutine, input)
{
    var xmlhttp = getXmlHttp()
    xmlhttp.open('POST', document.location, true);
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
    xmlhttp.onreadystatechange = function() 
    {
      if (xmlhttp.readyState == 4) 
      {
         if(xmlhttp.status == 200) 
         {
            if (xmlhttp.responseText.substr(0, 10) == 'Location: ')
                document.location = xmlhttp.responseText.substr(10);
           okRoutine();
         }
      }
    };
    if (input)
        postData += '&' + input.name + '=' + input.value;
    xmlhttp.send(postData + '&r=' + Math.random());
}
