var xmlHttp

function func(counter){
   
   xmlHttp=GetXmlHttpObject();
   if (xmlHttp==null){
      alert("Browser not HTTP");
      return;
   }
   counter++;
   xmlHttp.onreadystatechange=stateChanged;
   xmlHttp.open("GET","/scripts/ushki.php",true);
   xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded, charset=windows-1251");
   xmlHttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
   xmlHttp.send(null);

   id=setTimeout('func('+counter+')',20000); //через каждые 20сек. выполнять func()
}

function stateChanged(){
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="comlete"){
      document.getElementById("result_ushi").innerHTML=xmlHttp.responseText;
   }
}

function GetXmlHttpObject() {
   var objXMLHttp=null;
   if (window.XMLHttpRequest){
      objXMLHttp=new XMLHttpRequest();
   }
   else if(window.ActiveXOblect || navigator.appName=="Microsoft Internet Explorer"){
      objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   return objXMLHttp;
}


