onload=function(){
  	
	if(document.getElementById('marquee'))new marquee('marquee','left');
	if(window.ktora_galeria) blackBox = new blackBox(ktora_galeria);
}

function blackBox(xml){
	var req,zdjecia=[];
	if (window.XMLHttpRequest) req = new XMLHttpRequest();
	else if (window.ActiveXObject)
		try { req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {}}
	req.onreadystatechange = parsuj;
try{	req.open('GET','/images/photo_tour/xml/'+xml+'.xml',true);}catch(e){};
try{	req.send();}catch(e){} // funkin IE6
	
	function parsuj(){
		if(req.readyState != 4) return;
		if(req.status != 200){ alert(req.status); throw('Wystąpił błąd z zapytaniem');}
		
		var odp = req.responseText.match(/<photo>.*?<\/photo>/g);
		var kont = document.createElement('div');
			kont.style.display = 'none';
			document.getElementById('bialy_box_dol').getElementsByTagName('div')[2].appendChild(kont);
		for(var i=0,x,a,img,p;x=odp[i++];){
			p = '/images/photo_tour/'+xml+'/'+/<photo>(.*?)<\/photo>/.exec(x)[1];
			a = document.createElement('a');
				a.href = p+'.jpg';
				a.rel = 'lightbox[phototour]';
			img = document.createElement('img');
				img.src = p+'_small.jpg';
			a.appendChild(img);
			zdjecia.push(a);
			kont.appendChild(a);
		}
		initLightbox();
	}
	function wyswietl(nr){
		zdjecia[nr].onclick();
	}
	return wyswietl;
}

