﻿function pokaz(nazwa) {
	if (document.getElementById(nazwa).style.display != '') {
		document.getElementById(nazwa).style.display='';
	} else {
		document.getElementById(nazwa).style.display='none';
	}
}

function pokaz2(nazwa) {
	if (document.getElementById(nazwa).style.display != '') {
		document.getElementById(nazwa).style.display='';
		nazwa1='p'+nazwa;
		document.getElementById(nazwa1).style.backgroundImage="url('grafika/btn_minus.png')";
	} else {
		document.getElementById(nazwa).style.display='none';
	}
}

function fZmienKolor(poziom1,poziom2,poziom3,aktywnosc) {
	if (aktywnosc==1) {
		//alert(nazwa);
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3).style.backgroundColor='#469FDC';
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3).style.backgroundImage='url(grafika/menu_gora_2_tlo_a.png)';
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo_a1.png)';
		if (poziom3==0) {
			if (poziom2==1) {
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_1').style.backgroundImage='url(grafika/menu_gora_0_tlo_a.png)';
			} else {
				poziom2 = poziom2 - 1;
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo_a2.png)';
			}
		} else {
			if (poziom3==1) {
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_1').style.backgroundImage='url(grafika/menu_gora_0_tlo_a.png)';
			} else {
				poziom3 = poziom3 - 1;
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo_a2.png)';
			}
		}
	} else {
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3).style.backgroundColor='#6688A3';
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3).style.backgroundImage='url(grafika/menu_gora_2_tlo.png)';
		document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo.png)';
		if (poziom3==0) {
			if (poziom2==1) {
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_1').style.backgroundImage='url(grafika/menu_gora_0_tlo.png)';
			} else {
				poziom2 = poziom2 - 1;
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo.png)';
			}
		} else {
			if (poziom3==1) {
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_1').style.backgroundImage='url(grafika/menu_gora_0_tlo.png)';
			} else {
				poziom3 = poziom3 - 1;
				document.getElementById('subgora_'+poziom1+'_'+poziom2+'_'+poziom3+'_3').style.backgroundImage='url(grafika/menu_gora_1_tlo.png)';
			}
		}
	}
}

function sprawdz_noclegi() {
	if (document.noclegi.nazwa.value == "") {
		alert("Nie wypełniłeś obowiązkowego pola nazwa!");
		document.noclegi.nazwa.focus();
		document.noclegi.nazwa.select();
		return false;
	}
	if (document.noclegi.wlasciciel.value == "") {
		alert("Nie wypełniłeś; obowiązkowego pola właściciel");
		document.noclegi.wlasciciel.focus();
		document.noclegi.wlasciciel.select();
		return false;
	}
	if (document.noclegi.ulica.value == "") {
		alert("Nie wypełniłeś obowiązkowego pola ulica");
		document.noclegi.ulica.focus();
		document.noclegi.ulica.select();
		return false;
	}
	wzor = new RegExp("^[0-9]{2}-[0-9]{3}$");
	if (!wzor.test(document.noclegi.kod.value)) {
		alert("To nie jest poprawny format kodu pocztowego!");
		document.noclegi.kod.focus();
		document.noclegi.kod.select();
		return false;
	}
	if (document.noclegi.miasto.value == "") {
		alert("Nie wypełniłeś obowiązkowego pola miasto");
		document.noclegi.miasto.focus();
		document.noclegi.miasto.select();
		return false;
	}
	if (document.noclegi.telefon.value == "") {
		alert("Nie wypełniłeś obowiązkowego pola telefon");
		document.noclegi.telefon.focus();
		document.noclegi.telefon.select();
		return false;
	}
}
