
function createXMLHttp()
	{
	if(typeof XMLHttpRequest != 'undefined') return new XMLHttpRequest();
	else if(window.ActiveXObject)
		{
		var ver = ['MSXML2.XMLHttp.5.0', 'MSXML2.XMLHttp.4.0', 'MSXML2.XMLHttp.3.0', 'MSXML2.XMLHttp', 'Microsoft.XMLHttp'];
		for (var i = 0; i < ver.length; i++)
			{
			try
				{
				var oXMLHttp = new ActiveXObject(ver[i]);
				return oXMLHttp;
				}
			catch(oError) {}
			}
		}
	throw new Error('XMLHttp nie jest obslugiwany.');
	}

function aGet(id, site)
	{
	var oXMLHttp = createXMLHttp();
	oXMLHttp.open('get', site, true);
	oXMLHttp.onreadystatechange = function()
		{
		if(oXMLHttp.readyState == 4)
			{
			if(oXMLHttp.status == 200)	
				{
				document.getElementById(id).innerHTML = oXMLHttp.responseText;
				
				}
			else document.getElementById(id).innerHTML = oXMLHttp.statusText;
			}
		}
	oXMLHttp.send(null);
	if(id == 'scrollAreaM2') document.getElementById('scrollAreaM2').scrollUpdate();
	if(id == 'scrollAreaM3') document.getElementById('scrollAreaM3').scrollUpdate();
	}

function markListaPF2(obj){
 var par = obj.offsetParent;
 for(var i = 0; i < par.childNodes.length; i++){
  if(par.childNodes[i].id == obj.id){
   par.childNodes[i].className = 'start_marked';
  } else {
   par.childNodes[i].className = 'start';
  }
 }
}
	
function pojemnosc_ceny(indeks, pojemnosc, cena)
	{
	aGet('lista_pojemnosc_ceny','wyswietlanie/dodaj_pojemnosc_ceny.php?indeks='+indeks+'&pojemnosc='+pojemnosc+'&cena='+cena);
	}
function ListaPF2(id)
	{
  //	document.getElementsByStyleClass('pf1_').style.backgroundColor = 'white';
//	document.getElementsByTagName('pf1_*').style.color = '#501A24';
	//aGet('scrollAreaM1','wyswietlanie/konie_pf1.php');
	aGet('scrollAreaM2A','wyswietlanie/pf2.php?id='+id);
	aGet('scrollAreaM3A','wyswietlanie/pusto.php');
	aGet('lista_mini', 'wyswietlanie/lista_mini.php?pf1='+id);
	document.getElementById('scrollAreaM2').scrollUpdate();
	
 //	aGet('navi', 'wyswietlanie/navigator.php?id_pf1='+id);
//	document.getElementById('pf1_1').innerHTML = '';
 //	document.getElementById('pf1_'+id).style.backgroundColor = '#501A24';
 //	document.getElementById('pf1_'+id).style.color = 'white';
	}
function ListaPF2_3(id)
	{
  //	document.getElementsByStyleClass('pf1_').style.backgroundColor = 'white';
//	document.getElementsByTagName('pf1_*').style.color = '#501A24';
	//aGet('scrollAreaM1','wyswietlanie/konie_pf1.php');
	aGet('scrollAreaM2A','wyswietlanie/pf2.php?id='+id);
	aGet('scrollAreaM3A','wyswietlanie/pusto.php');
	aGet('lista_mini', 'wyswietlanie/lista_mini3.php?pf1='+id);
	document.getElementById('scrollAreaM2').scrollUpdate();
	
 //	aGet('navi', 'wyswietlanie/navigator.php?id_pf1='+id);
//	document.getElementById('pf1_1').innerHTML = '';
 //	document.getElementById('pf1_'+id).style.backgroundColor = '#501A24';
 //	document.getElementById('pf1_'+id).style.color = 'white';
	}
function ListaPF2_1(id)
	{
  //	document.getElementsByStyleClass('pf1_').style.backgroundColor = 'white';
//	document.getElementsByTagName('pf1_*').style.color = '#501A24';
	//aGet('scrollAreaM1','wyswietlanie/konie_pf1.php');
	aGet('scrollAreaM2A','wyswietlanie/pf2.php?id='+id);
	aGet('scrollAreaM3A','wyswietlanie/pusto.php');
	aGet('lista_mini', 'wyswietlanie/lista_mini1.php?pf1='+id);
	document.getElementById('scrollAreaM2').scrollUpdate();
	
 //	aGet('navi', 'wyswietlanie/navigator.php?id_pf1='+id);
//	document.getElementById('pf1_1').innerHTML = '';
 //	document.getElementById('pf1_'+id).style.backgroundColor = '#501A24';
 //	document.getElementById('pf1_'+id).style.color = 'white';
	}
function ListaPF2_0(id)
	{
  //	document.getElementsByStyleClass('pf1_').style.backgroundColor = 'white';
//	document.getElementsByTagName('pf1_*').style.color = '#501A24';
	//aGet('scrollAreaM1','wyswietlanie/konie_pf1.php');
	aGet('scrollAreaM2A','wyswietlanie/pf2.php?id='+id);
	aGet('scrollAreaM3A','wyswietlanie/pusto.php');
	aGet('lista_mini', 'wyswietlanie/lista_mini0.php?pf1='+id);
	document.getElementById('scrollAreaM2').scrollUpdate();
	
 //	aGet('navi', 'wyswietlanie/navigator.php?id_pf1='+id);
//	document.getElementById('pf1_1').innerHTML = '';
 //	document.getElementById('pf1_'+id).style.backgroundColor = '#501A24';
 //	document.getElementById('pf1_'+id).style.color = 'white';
	}	
function ListaProduktow(id)
	{
	aGet('scrollAreaM3A','wyswietlanie/produkty_pf.php?id='+id);
	document.getElementById('scrollAreaM3').scrollUpdate();
	//setTimeout(document.getElementById('scrollAreaM3').scrollUpdate(),1000); 
  //	document.getElementById('pf2_'+id).style.backgroundColor = '#501A24';
  //	document.getElementById('pf2_'+id).style.color = 'white';
	}
function select_pf2(id)
	{
	aGet('selectpf2', 'wyswietlanie/select_pf2.php?id='+id);

	}
function select_pf22(id)
	{
	aGet('selectpf2', 'wyswietlanie/select_pf22.php?id='+id);
	}
	
function dodaj_pozycje(id_pf2, id)
	{
	aGet('pozycje', 'wyswietlanie/pozycje.php?id_pf2='+id_pf2+'&id='+id);
	}
function usun_pozycje(id, id_pf2)
	{
	aGet('pozycje', 'wyswietlanie/admin/usun_pf.php?id_p='+id+'&id='+id_pf2);
	}
function dodaj_pf10(nazwa)
	{
	aGet('pf1selekt','wyswietlanie/admin/dodajpf10.php?nazwa='+nazwa);
	document.pf1.nazwa.value = '';
	
	}
function dodaj_pf11(nazwa)
	{
	aGet('pf1selekt','wyswietlanie/admin/dodajpf11.php?nazwa='+nazwa);
	document.pf1.nazwa.value = '';
	
	}
function dodaj_pf12(nazwa)
	{
	aGet('pf1selekt','wyswietlanie/admin/dodajpf12.php?nazwa='+nazwa);
	document.pf1.nazwa.value = '';
	
	}
	function dodaj_pf13(nazwa)
	{
	aGet('pf1selekt','wyswietlanie/admin/dodajpf13.php?nazwa='+nazwa);
	document.pf1.nazwa.value = '';
	
	}
function dodaj_indeks_pojemnosc(id, indeks, pojemnosc)
	{
	aGet('indeks_pojemnosc','wyswietlanie/admin/dodaj_indeks_pojemnosc.php?id='+id+'&indeks='+indeks+'&pojemnosc='+pojemnosc);
	document.indeks_pojemnosc.indeks.value = '';
	document.indeks_pojemnosc.pojemnosc.value = '';	
	}
function dodaj_pf2(id, nazwa)
	{
	aGet('selectpf2','wyswietlanie/admin/dodajpf2.php?nazwa='+nazwa+'&id='+id);
	document.pf2.nazwa.value = '';
	}
   function aKartyStos(id_gry)
	{
	aGet('stos', 'pokaz_stos.php?id_gry='+id_gry);
	setTimeout(aKartyStos, 1000);
	}
function aPoloz(id_karty)
	{
	aGet('karty', 'poloz.php?id_karty='+id_karty);
	
	}
function aNastepny(id_gry)
	{
	aGet('gracze', 'nastepny.php?id_gry='+id_gry);
	aKarty_do_wziecia();
	}
function aWezKarte(id_gry)
	{
	aGet('karty', 'wez_karte.php?id_gry='+id_gry);
	}
function aKarty_do_wziecia()
	{
	aGet('operacje_na_kartach', 'karty_do_wziecia.php');
	setTimeout(aKarty_do_wziecia, 1000);
	}

