function box_prognoza_zmien(stacja) {
	nazwa_bloku_ukryj = "box_prognoza_stacja_" + box_prognoza_stacja_wybrana;
	box_prognoza_stacja_wybrana = stacja;
	nazwa_bloku_pokaz = "box_prognoza_stacja_" + box_prognoza_stacja_wybrana;
	
	document.getElementById(nazwa_bloku_ukryj).style.display = "none";
	document.getElementById(nazwa_bloku_pokaz).style.display = "block";
}

function box_pogoda_zmien(stacja) {
	nazwa_bloku_ukryj = "box_pogoda_stacja_" + box_pogoda_stacja_wybrana;
	box_pogoda_stacja_wybrana = stacja;
	nazwa_bloku_pokaz = "box_pogoda_stacja_" + box_pogoda_stacja_wybrana;
	
	document.getElementById(nazwa_bloku_ukryj).style.display = "none";
	document.getElementById(nazwa_bloku_pokaz).style.display = "block";
}

function box_warunki_turystyczne_zmien() {
	nazwa_bloku_ukryj = "box_warunki_turystyczne_stacja_" + box_warunki_turystyczne_stacja_wybrana;
	box_warunki_turystyczne_stacja_wybrana++;
	if (box_warunki_turystyczne_stacja_wybrana > box_warunki_turystyczne_stacja_ilosc) box_warunki_turystyczne_stacja_wybrana = 1;
	nazwa_bloku_pokaz = "box_warunki_turystyczne_stacja_" + box_warunki_turystyczne_stacja_wybrana;
	
	setTimeout("jQuery('#"+nazwa_bloku_ukryj+"').fadeTo(1000, 0)", 5000);
	setTimeout("jQuery('#"+nazwa_bloku_pokaz+"').fadeTo(1000, 1, box_warunki_turystyczne_zmien)", 5000);
}

function box_warunki_narciarskie_zmien() {
	nazwa_bloku_ukryj = "box_warunki_narciarskie_stacja_" + box_warunki_narciarskie_stacja_wybrana;
	box_warunki_narciarskie_stacja_wybrana++;
	if (box_warunki_narciarskie_stacja_wybrana > box_warunki_narciarskie_stacja_ilosc) box_warunki_narciarskie_stacja_wybrana = 1;
	nazwa_bloku_pokaz = "box_warunki_narciarskie_stacja_" + box_warunki_narciarskie_stacja_wybrana;
	
	setTimeout("jQuery('#"+nazwa_bloku_ukryj+"').fadeTo(1000, 0)", 5000);
	setTimeout("jQuery('#"+nazwa_bloku_pokaz+"').fadeTo(1000, 1, box_warunki_narciarskie_zmien)", 5000);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function okno(plik, szer, wys) {
	window.open(plik, "", "left=10, top=10, width="+szer+", height="+wys+", directories=0, location=0, menubar=0, scrollbars=0, status=0, toolbar=0, resizable=0")
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function formularz_szukaj_wyczysc(input) {
	if (input.value == "Szukaj") input.value = '';
}

function formularz_szukaj_submit(id) {
	if (document.getElementById(id).value == "") return false;
	if (document.getElementById(id).value == "Szukaj") return false;
	window.location = sciezka + 'szukaj.php?q=' + encodeURIComponent(document.getElementById(id).value);
	return false;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function fomularz_trim(inputString) {
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { 
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { 
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1) { 
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
	}
	return retValue;
}

function fomularz_checkl(formularz, inp) {
	tmp = fomularz_trim(document.forms[formularz].elements[inp].value); 
	if(tmp.length == 0) return false; else return true;
}

function fomularz_mail(formularz, inp) {
	Wzor=/^[-_0-9a-zA-Z.]+\@[-0-9a-zA-Z]+\.[-0-9a-zA-Z.]{2,}$/;
	OK=(Wzor.test(document.forms[formularz].elements[inp].value));
	if(OK) return true; else
	return false;
}

function formularz_komunikat(formularz, tresc) {
	nazwa_bloku = formularz + "_komunikat";
	
	document.getElementById(nazwa_bloku).innerHTML = tresc;
}
