

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 pokazdymek(zdarzenie,idm) {
  obj = document.getElementById("slownikpojec");
  obj.style.visibility = "visible";
  zdarzenie = (zdarzenie)?zdarzenie:((window.event)?event:null);
  if (window.scrollX>=0) { // przesunięcie i wymiar okna dla Netscape, Firefox
    przesX = window.scrollX;
    przesY = window.scrollY;
    ekranX = window.innerWidth;
    ekranY = window.innerHeight;
  } else { // dla IE, Opery
    przesX = document.body.scrollLeft
    przesY = document.body.scrollTop
    ekranX = document.body.clientWidth;
    ekranY = document.body.clientHeight;
  }
  x = zdarzenie.clientX+przesX;
  y = zdarzenie.clientY+przesY;
 
  obj.style.left=przesX+Math.min(x,ekranX-obj.clientWidth)+"px";
  if (y<przesY+ekranY-obj.clientHeight) obj.style.top = y+"px";
  else obj.style.top = y-obj.clientHeight+"px";
  
show_progressbar('slownikpojec');
  if (xmlHttpfo.readyState == 4 || xmlHttpfo.readyState == 0)
  {
	xmlHttpfo.open("GET", "web/slownikpojec.php?idd=" + idm, true); 
    xmlHttpfo.onreadystatechange = function() {
		
	  if (xmlHttpfo.readyState == 4) 
  {
    if (xmlHttpfo.status == 200) 
    {
      helloMessage = xmlHttpfo.responseText;
      document.getElementById("slownikpojec").innerHTML = helloMessage;
    } 
    else 
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera: " + xmlHttpfo.statusText);
    }
  }	
	}
	
    xmlHttpfo.send(null);	
  }
}  
 
function dymekstop() {
    obj = document.getElementById("slownikpojec");
    obj.style.visibility = "hidden"
}

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';

