

var xmlHttpfo = createXmlHttpRequestObject(); 
function createXmlHttpRequestObject() 
{
  var xmlHttpfo;
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttpfo = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttpfo = false;
    }
  }
  else
  {
    try 
    {
      xmlHttpfo = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttpfo = false;
    }
  }
  if (!xmlHttpfo)
    alert("Błąd podczas tworzenia obiektu XMLHttpRequest.");
  else 
    return xmlHttpfo;
}

function fotka(idd,nnr,ii,ikk) {
show_progressbar("jednafotka" + nnr);
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/gal/fotka.php?idd=" + idd + "&ii=" + ii + "&ikk=" + ikk, true);  
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("jednafotka" + nnr).innerHTML = helloMessage;
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}


function fotkoment(idd) {
document.getElementById('dodopisfot').style.display='block';
show_progressbar('dddodopisfotdoz');
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/gal/fotka.php?idd=" + idd + "&ic=kom", true);  
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("dddodopisfotdoz").innerHTML = helloMessage;
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}

function zapiszkomfot(idd,nnr,imie,tresc,suma) {
document.getElementById('dodopisfot').style.display='block';
show_progressbar('dddodopisfotdoz');
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/gal/fotka.php?idd=" + idd + "&imie=" + imie + "&tresc=" + tresc + "&suma=" + suma + "&ic=zapisz", true); 
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("dddodopisfotdoz").innerHTML = helloMessage;
	  if(imie!="" && tresc!="" && suma=="21") {
	  document.getElementById('dodopisfot').style.display='none';
	  fotka(idd,nnr,0);
	  } else {
		  var hh=idd;
		setTimeout("fotkoment("+ hh +")", 1000);  
	  }
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}


function multikoment(idm) {
document.getElementById('dodopismulti').style.display='block';
show_progressbar('dddodopismultidoz');
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/film/multimedia.php?idd=" + idm + "&ic=kom", true);  
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("dddodopismultidoz").innerHTML = helloMessage;
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}

function zapiszkommulti(idm,imie,tresc,suma) {
document.getElementById('dodopismulti').style.display='block';
show_progressbar('dddodopismultidoz');
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/film/multimedia.php?idd=" + idm + "&imie=" + imie + "&tresc=" + tresc + "&suma=" + suma + "&ic=zapisz", true); 
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("newmultikom").innerHTML = helloMessage;
	  if(imie!="" && tresc!="" && suma=="21") {
	  document.getElementById('dodopismulti').style.display='none';
	  fotka(idd,nnr,0);
	  } else {
		  var hhm=idm;
		setTimeout("multikoment("+ hhm +")", 1000);  
	  }
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}


function zamknijjad(jakisd) {
document.getElementById(jakisd).style.display='none';
}

function replace_html(coz, content) {
document.getElementById(coz).innerHTML = content;
}
function show_progressbar(coz) {
replace_html(coz, '<img src="../../img/loader4.gif" border="0" alt="Trwa ładowanie danych..." /><br /><h2>Trwa ładowanie danych...</h2>');
}
var progress_bar = new Image();
progress_bar.src = '../../img/loader4.gif';

