var xmlHttp = createXmlHttpRequestObject(); 
var newheight;
function newWind(zawart)
{
	window.open("./grafika/galeria/"+zawart,"Picutre","resizable=1,width=750,height=500");
}
function createXmlHttpRequestObject() 
{
  var xmlHttp;
  try
  {    
	xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
      "MSXML2.XMLHTTP.5.0",
      "MSXML2.XMLHTTP.4.0",
      "MSXML2.XMLHTTP.3.0",
      "MSXML2.XMLHTTP",
      "Microsoft.XMLHTTP");
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  if (!xmlHttp)
    alert("Błąd podczas tworzenia obiektu XMLHttpRequest.");
  else 
    return xmlHttp;
}
function changeContent(searchingpage)
{
	 document.getElementById('loading').style.display='';
    xmlHttp.open("GET", searchingpage, true);  
    xmlHttp.onreadystatechange = handleServerResponse;
    xmlHttp.send(null);
}
function handleServerResponse() 
{
 myDiv= document.getElementById('content');
  if (xmlHttp.readyState == 4) 
  {
    if (xmlHttp.status == 200) 
    {
      try
      {
			newheight=0;
			document.getElementById('content').style.height="100%";
        response = xmlHttp.responseText;
        myDiv.innerHTML = response;
	
		document.getElementById('loading').style.display="none";
		
		initLytebox();
      }
      catch(e)
      {
        alert("Błąd podczas odczytu odpowiedzi: " + e.toString());
      }
    } 
    else
    {
      alert("Pojawił się problem w uzyskaniu danych:\n" +
        xmlHttp.statusText);
    }
  }
}
