// JavaScript Document
var wr = /^[a-zA-Z0-9_\-\.!]+@[a-zA-Z0-9_\-\.!]+\.[a-zA-Z0-9_\-\.!]{2,}/g;
czywyslanie = true;

function pozaladowaniu() {
	//wyswietl('ladowanie0','none');
	//wyswietl('ladowanie1','block');
}

function kontakt_klik(ob) {
	if (ob.value=='Treść wiadomości' || ob.value=='wpisz swój adres email'){
		ob.value='';
	}
}

function sprawdz_kontakt(f) {
	il = 0;
	if (document.getElementById('tresc').value=='' || document.getElementById('tresc').value=='Treść wiadomości') {
		document.getElementById('komunikatKontakt').innerHTML = document.getElementById('kom3').value + '<br>';
		wyswietl ('komunikatKontakt','block');
			il++;
	} else {
		document.getElementById('komunikatKontakt').innerHTML = '';
			wyswietl ('komunikatKontakt','none');
	}
	if (document.getElementById('mail').value=='' || document.getElementById('mail').value=='wpisz swój adres email') {
		document.getElementById('komunikatKontakt').innerHTML += document.getElementById('kom1').value;
		wyswietl ('komunikatKontakt','block');
			il++;
	} else {
		if (!document.getElementById('mail').value.match(wr)) {
			document.getElementById('komunikatKontakt').innerHTML += document.getElementById('kom2').value;
			wyswietl ('komunikatKontakt','block');
			il++;
		} else {
			wyswietl ('komunikatKontakt','none');
			document.getElementById('komunikatKontakt').innerHTML = 'Proszę czekać...';
			wyswietl ('komunikatKontakt','block');

		return true;
		}
	}
	if (il>0) {return false;}
return false; 
	
}
function ustaw(id1) {
	if (document.getElementById('mID1')) {
		document.getElementById('mID1').value = id1;
		document.getElementById('f').submit();
	}
}

function ustawGaleria(sel) {
	if (sel.value!='') {
		location.href = sel.value;
	}
}
function pokazGal(nr) {
/*	imgS = document.getElementById('s'+nr);
	if (imgS){
		katG = document.getElementById('kat');
		katG = (katG && imgS.value!='') ? '/img_in/'+katG.value+'/srednie/'+imgS.value : '/img/dot.gif';
		wymien('sIMG',katG);
	}
	opisS = document.getElementById('op'+nr);
	if (opisS){
		if (document.getElementById('sOpis')){
			document.getElementById('sOpis').innerHTML = opisS.innerHTML;
		}
	}*/
}

function aaa() {
	
	alert ('p');
}

function pokazGalD(nr) {
	k1 = document.getElementById('kat');
	katalog = (k1) ? k1.value+'/' : 'galeria/duze/';
	czyPop = document.getElementById('d'+(nr-1));
	czyNas = document.getElementById('d'+(nr+1));
	czyBie = document.getElementById('d'+nr);

	tx = '<table id="daneGal" cellpadding="0" cellspacing="0" align="center"><tr id="navDG">';
    tx+= '<td id="lDG">';
		tx+='<span id="popDG">';
			if (czyPop) {tx+='<a onclick="ustawIMGDGal(\'/img_in/'+katalog+document.getElementById('d'+(nr-1)).value+'\','+(nr-1)+')" id="pDGal">&lt;&lt;poprzednia</a>';}
		tx+='</span>';
		tx+='<span id="nasDG">';
			if (czyNas) { tx+='<a onclick="ustawIMGDGal(\'/img_in/'+katalog+document.getElementById('d'+(nr+1)).value+'\','+(nr+1)+')" id="nDGal">nastepna&gt;&gt;</a>';}
		tx+='</span>';
	tx+= '</td>';
    tx+='<td id="pDG">';
	tx+= '<a onclick="ukryjIMGGal();" id="zamknij">zamknij</a></td></tr>';
    tx+= '<tr><td id="imgDG" colspan="2">';       
	if (czyBie) {tx+= '<img src="/img_in/'+katalog+document.getElementById('d'+nr).value+'" id="dGl" onclick="ukryjIMGGal();" alt="zamknij" />';}
	tx+= '</td></tr></table>';
	document.getElementById('duzaGal').innerHTML = tx;
	//alert (tx);
	wyswietl ('duzaGal','block');
	//}
}

function ustawIMGDGal(obr,nr) {
	k1 = document.getElementById('kat');
	katalog = (k1) ? k1.value+'/' : 'galeria/duze/';
	czyPop = document.getElementById('d'+(nr-1));
	czyNas = document.getElementById('d'+(nr+1));
	czyBie = document.getElementById('d'+nr);
	if (!czyPop) {
		document.getElementById('popDG').innerHTML='';
	} else {
		document.getElementById('popDG').innerHTML='<a onclick="ustawIMGDGal(\'/img_in/'+katalog+document.getElementById('d'+(nr-1)).value+'\','+(nr-1)+')" id="pDGal">&lt;&lt;poprzednia</a>';
	}
	if (!czyNas) {
		document.getElementById('nasDG').innerHTML='';
	} else {
		document.getElementById('nasDG').innerHTML='<a onclick="ustawIMGDGal(\'/img_in/'+katalog+document.getElementById('d'+(nr+1)).value+'\','+(nr+1)+')" id="nDGal">nastepna&gt;&gt;</a>';
	}
	wymien('dGl',obr);
	//wyswietl ('duzaGal','block');
}


function ukryjIMGGal() {
	document.getElementById('duzaGal').innerHTML = '';
	wyswietl('duzaGal','none');
}


function ustaw_aktualnosci(f,sel) {
	f.action = 'aktualnosci,0,'+sel.value+'.html';
	f.submit();
	
}

