function openWindow(url,width,height)
{ window.open(url,"","toolbar=no,scrollbars=yes,location=no,status=no,width="+width+",height="+height+",resizable=1");
};

//vymaze hodnotu elementu (napr. onfocus="clearInput('mujinput','text');")
function clearInput(id, value) {
  if (document.getElementById(id).value == value) {
    document.getElementById(id).value = "";
  }
}

//nastavi hodnotu elentu (napr. onblur="fillInput('mujinput','text');")
function fillInput(id, value) {
  if (document.getElementById(id).value == "") {
    document.getElementById(id).value = value;
  }
}

/*
AJAX dotaz
id  - id dom objektu kam se vlozi vysledek
url - url volaneho scriptu 
*/
function setCount(id) {
    var url = '/lib/countdetail.php?id='+id;
    getText('count',url);
}
function getText(id,url) {    
    if (url != 0) {
	    if (window.ActiveXObject) {httpRequest = new ActiveXObject("Microsoft.XMLHTTP");}
        else {httpRequest = new XMLHttpRequest();}
            
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function() {processRequest(id); } ;
        httpRequest.send(null);
    }
    else {document.getElementById(id).innerHTML = "";}
}
function processRequest(id) {
	if (httpRequest.readyState == 4) {
	   if(httpRequest.status == 200) {
          var mistoZobrazeni = document.getElementById(id);
          mistoZobrazeni.innerHTML = httpRequest.responseText;
        }
        else {alert("Chyba pri nacitani stranky "+ httpRequest.status +" : "+ httpRequest.statusText);}
	}
}