var xmlHttp = createXmlHttpRequestObject(); 

function createXmlHttpRequestObject() 
{
  var xmlHttp;
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  else
  {
    try 
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }

  if (!xmlHttp)
    alert("Błąd podczas tworzenia obiektu XMLHttpRequest.");
  else 
    return xmlHttp;
}


function staty(idpage)
{
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
    strona =escape(document.referrer);
        
        p=navigator.platform;
        w=screen.height;
        s=screen.width;
         if(!navigator.browserLanguage){ jezyk=navigator.language;}else{jezyk=navigator.browserLanguage;}
        dane=strona+'&w='+w+'&s='+s+'&j='+idpage+','+jezyk+'&p='+p;
        
    xmlHttp.open("GET", "stat.php?adres=" + dane, true);  
    xmlHttp.onreadystatechange = handleServerResponse;
    xmlHttp.send(null);
  }
  else
    setTimeout('staty()', 1000);
}

function handleServerResponse() 
{
  if (xmlHttp.readyState == 4) 
  {
    if (xmlHttp.status == 200) 
    {
     
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttp.statusText);
    }
  }
}

