function box() {
 document.getElementById("log").innerHTML = '<form name="form1" id="form1" method="post" action="log.php"><input class="pole" name="user" type="text" id="user" style="background-image:url('+"'images/login.gif'"+'); background-repeat: no-repeat; 	background-position:right" onmouseover="document.title='+"'Login'"+'" onmouseout="document.title='+"'Wycena nieruchomo&#347;ci'"+'" />&nbsp;<input class="pole" style="background-image:url('+"'images/haslo.gif'"+'); background-repeat: no-repeat; 	background-position:right" name="password" type="password" id="password" onmouseover="document.title='+"'Has&#322;o'"+'" onmouseout="document.title='+"'Wycena nieruchomo&#347;ci'"+'" />&nbsp;<input alt="Zaloguj" name="Send" class="send-btn" type="button" value="" id="Send" src="images/zaloguj.gif" onclick="logsign()" /></form>';
 document.getElementById("user").focus();
}

function reg() {
	if ((document.regforma.user.value.length > 2) && (document.regforma.user.value.length < 26)) {
		if (document.regforma.pass.value == document.regforma.pass2.value) {
			if (document.regforma.pass.value.length >5) {
				if (document.regforma.email.value != "") {
					if (document.regforma.token.value.length == 6) {
						if (document.regforma.regul.checked) {
							document.regforma.submit();
						} else alert("Aby się zarejestrować, konieczna jest akceptacja regulaminu.");					
					} else alert("Przepisz poprawnie kod.");				
				} else alert("Podaj swój email - umożliwi on odzyskanie zapomnianego hasła.");			
			} else alert("Hasło musi posiadać conajmniej 6 znaków.");		
		} else alert("Powtórzone hasła nie zgadzają się.");	
	} else alert("Login musi posiadać od 3 do 25 znaków oraz składać sie z liter małych/dużych lub/oraz cyfr.");
} 

function logsign() {
advAJAX.submit(document.getElementById("form1"), {
    onSuccess : function(obj) { 
	if (obj.responseText == 1)  window.location.href="index.php";     else
	if (obj.responseText == 0)  alert("Nieprawidłowy login/hasło.");  else
	if (obj.responseText == 2)  alert("Twoje konto zostało zablokowane z powodu złamania regulaminu."); },
    onError : function(obj) { alert("Spróbuj ponownie."); }
});	
}
