var ipstore="";

function xmlhttpPost(strURL,qstr) {
    var xmlHttpReq=false;
    var self=this;
    if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); }
    else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); }
    self.xmlHttpReq.open('POST',strURL,true);
    self.xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if(self.xmlHttpReq.readyState==4)
        {
          if(self.xmlHttpReq.status==200) useLoc(self.xmlHttpReq.responseText);
          else useLoc("<span class=\"err\">no answer :-(</span>");
        }
    }
    self.xmlHttpReq.send(qstr);
}

function useLoc(l) {
  if(typeof l !='string'||l=="") { document.getElementById('weatherbox').innerHTML="<span class=\"err\">no response :(</span>"; }
  else { document.getElementById('weatherbox').innerHTML=l; }
}

function getWth(ip)
{
  if(ipstore=="") ipstore=ip;
  xmlhttpPost("aip.php",'i='+ipstore);
  setTimeout('getWth()',600000);
}
