function FAjax(url, sTarget){
	var tg = document.getElementById(sTarget);
	tg.innerHTML = "";
	if (window.XMLHttpRequest) {
		httpRequest = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
		  httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (eror) {
		  httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	httpRequest.open("GET", url, true);
	httpRequest.onreadystatechange= function () {processRequest(sTarget); } ;
	httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	httpRequest.send(null);
}

function processRequest(sTarget){

  if (httpRequest.readyState == 4)
  {
    if(httpRequest.status == 200)
    {
      var tg = document.getElementById(sTarget);
	  //var headers = httpRequest.getAllResponseHeaders(  );
	 // if(tg.style.visibility == 'hidden'){
		tg.style.visibility = 'visible';
		tg.innerHTML = httpRequest.responseText;
	  //}else{tg.style.visibility = 'hidden'; tg.innerHTML = "";}
    }
    else
    {
        alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
    }
  }
}

function OnOffAjaxWindows(sID){
  var ifNone = document.getElementById(sID).style.display
  if(ifNone == "none"){document.getElementById(sID).style.display = "";}else
  {document.getElementById(sID).style.display = "none";}
  //return ifNone;
}
//---------------------------------------------------------------------------------------------------------------------------------------------

function ViewFoto(nID, sFile, sTitle, sNote)
{
  var nWidth  = document.body.offsetWidth;
  var nHeight = document.body.offsetHeight + document.body.scrollHeight;
  
  document.getElementById("InfoWin").style.width   = nWidth  + "px";
  document.getElementById("InfoWin").style.height  = nHeight + "px";
  document.getElementById("InfoWin").style.display = "";
  var url = "./bigimg.php?id=" + nID + "&titlefoto=" + sTitle + "&notefoto=" + sNote + "&file=" + sFile + "&w=" + nWidth + "&h=" + nHeight;
  //alert(url);
  FAjax(url, "InfoWin" );
}
//---------------------------------------------------------------------------------------------------------------------------------------------

function Debug(txt)
{}
