﻿function pokaz(nazwa)
{
	document.getElementById(nazwa).style.display='';
}

function sprawdz_goscie2() {
	wzor = new RegExp("^.+@.+[\.].{2,}$");
	if (document.goscie.txtImie.value == "") {
		alert("Nie wypełniłeś wszystkich obowiązkowych pól!");
		document.goscie.txtImie.focus();
		document.goscie.txtImie.select();
		return false;
	}
	if (document.goscie.txtNazwisko.value == "") {
		alert("Nie wypełniłeś wszystkich obowiązkowych pól!");
		document.goscie.txtNazwisko.focus();
		document.goscie.txtNazwisko.select();
		return false;
	}
	wzor = new RegExp("^.+@.+[\.].{2,}$");
	if (!wzor.test(document.goscie.txtMail.value)) {
		alert("To nie jest poprawny adres e-mail!");
		document.goscie.txtMail.focus();
		document.goscie.txtMail.select();
		return false;
	}
	if (document.goscie.txtLogin.value.length < 3) {
		alert("Login musi mieć minimum 3 znaki!");
		document.goscie.txtLogin.focus();
		document.goscie.txtLogin.select();
		return false;
	}
	if ((document.goscie.txtHaslo.value.length < 6) || (document.goscie.verHaslo.value.length < 6)) {
		alert("Hasło musi mieć minimum 6 znaków!");
		document.goscie.txtHaslo.value="";
		document.goscie.verHaslo.value="";
		document.goscie.txtHaslo.focus();
		document.goscie.txtHaslo.select();
		return false;
	}
	if (document.goscie.txtHaslo.value != document.goscie.verHaslo.value) {
		alert("Niezgodne hasła!");
		document.goscie.txtHaslo.value="";
		document.goscie.verHaslo.value="";
		document.goscie.txtHaslo.focus();
		document.goscie.txtHaslo.select();
		return false;
	}
	if (!document.goscie.bitRegulamin.checked) {
		alert("Musisz zaakceptować regulamin!");
		return false;
	}
}

function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
}