function checklink(linkObject,parentWay)
{
 var domain = document.domain;
 var url = document.URL;
 var parentLink = 'http://'+domain+'/szukajB/'+parentWay+'/' + request_uri;
 var checklink = url.substr(0,linkObject.href.length); 
  
 if (checklink == linkObject.href) linkObject.href = 'http://'+domain+'/szukajB/'+parentWay+'/' + request_uri;
 
}
function AjaxPipe()
{
  processContent(ItemsArray[loopIndex]);
}
function processContent(cid)
{
 if (AjaxObject.readyState==4||AjaxObject.readyState==0)
 {
   today = new Date();
   //document.write(path+"hits/"+cid+"/"+AjaxKraj+"/"+AjaxWojewodztwo+"/"+AjaxPowiat+"/"+today.getTime()+"/");
   AjaxObject.open("GET",path+"hits/"+cid+"/"+AjaxKraj+"/"+AjaxWojewodztwo+"/"+AjaxPowiat+"/"+today.getTime()+"/",true);
   AjaxObject.onreadystatechange = handleServerResponseCompany;
   AjaxObject.send(null);
 }

}
function handleServerResponseCompany()
{
 try
 {
  if (AjaxObject.readyState == 4)
  {
    if (AjaxObject.status == 200)
    {
        var xmlResponse = AjaxObject.responseXML;
        var xmlDoc = xmlResponse.documentElement;
        var result = xmlDoc.getElementsByTagName('hits');
      
        var hits = result[0].childNodes[0].data;
        
        var companyHits = document.getElementById(ItemsArray[loopIndex]+'_company_count');
        companyHits.innerHTML = hits;
        if (loopIndex < ItemsArray.length -1) 
        {
         loopIndex++;
         AjaxPipe();
        } 
    }
    else
    {
     //alert('Error');
    }
  }
  }
 catch (e)
  {
  }
}
