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 xmlhttpPost(u, a) {
    //alert(u);
//    document.getElementById(a).innerHTML = '&nbsp;&nbsp;&nbsp;обновление..';
    var xmlhttp = getXmlHttp()
    xmlhttp.open("GET", u, false); // синхронный запрос для примера
    xmlhttp.send(null);
if(!xmlhttp.getResponseHeader("Date")) {  // 1
  var cached = xmlhttp;
  xmlhttp = getXmlHttp()
  var ifModifiedSince = cached.getResponseHeader("Last-Modified");
  ifModifiedSince = (ifModifiedSince) ? ifModifiedSince : new Date(0); // January 1, 1970
  xmlhttp.open("GET", u, false);
  xmlhttp.setRequestHeader("If-Modified-Since", ifModifiedSince);

  xmlhttp.send(null);
  if(xmlhttp.status == 304)  {
    xmlhttp = cached;
  }
 }
  document.getElementById(a).innerHTML = xmlhttp.responseText
}




