   //On load page, init the timer which check if the there are anchor changes each 300 ms  
setInterval("checkAnchor()",300);

var currentAnchor = null;
//Function which chek if there are anchor changes, if there are, sends the ajax petition  

function checkAnchor(){  
//Check if it has changes  
    if(currentAnchor != document.location.hash)
    {  
        currentAnchor = document.location.hash;  
        params = currentAnchor.substring(2);
        if(params != '') pobierz('/zrealizowane_hires.php', 'hires', true, params);  
    }  
    
}  




wczytane=false;
function opis (opis, komorka)
{
document.getElementById(komorka).innerHTML = opis;
}


function pobierz(url, element_docelowy, napis, data)
{
if(data==null) data="";
zap = false;
        if (window.XMLHttpRequest) {

            zap = new XMLHttpRequest();
            
            if (zap.overrideMimeType) {

             }
        } else if (window.ActiveXObject) {
            try {
                zap = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    zap = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
wcz = napis;
el_docelowy = element_docelowy;
zap.onreadystatechange = zczytaj;
zap.open('POST', url, true);

zap.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
zap.setRequestHeader("Content-length", data.length);
zap.setRequestHeader("Connection", "close");

zap.send(data);
}

function zczytaj()
{
if (zap.readyState == 4)
   {
   if (zap.status==200)
      {
      wczytane=true;
      if(el_docelowy!=false) opis(zap.responseText, el_docelowy);
      if(zaznaczyc_obraz!=null) document.getElementById(zaznaczyc_obraz).checked=true;
      }
   }
   else
   {
   if(wcz==true) opis("<div style='text-align:center;'><img src='/ajax-loading.gif'></div>", el_docelowy);
   }
}


function blokada(pole)
{
if(document.getElementById(pole).disabled==true) document.getElementById(pole).disabled=false;
else  document.getElementById(pole).disabled=true;
}

 
function szufluj_ogolne(pole)
{
if(document.getElementById(pole).style.display == "none" || document.getElementById(pole).style.display == "")
  {
  document.getElementById(pole).style.display = "block"; 
  return 1;
  }
if(document.getElementById(pole).style.display == "block")   
  {
  document.getElementById(pole).style.display = "none";
  return 1;
  }
}


function ukryjPokaz(id1, id2)
{
if(document.getElementById(id1).style.display == "none")
	{
document.getElementById(id1).style.display = "block";
document.getElementById(id2).style.display = "none";
	}
else
	{
document.getElementById(id2).style.display = "block";
document.getElementById(id1).style.display = "none";
	}
}


