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

