Hi..
I'm developing a site that needs a restricted area.
So I created a small javascript function to check user and password.
And then redirects to the homepage of the restricted area.

Code:
<script type="text/javascript">
function Login(){
	var done=0;
	var username=document.login.username.value;
	username=username.toLowerCase();
	var password=document.login.password.value;
	password=password.toLowerCase();
	if (username=="user" && password=="pass") {
		window.location="internal.php";
		done=1;
	}
	if (done==0) {
		alert("User or password incorrect.");
	}
}
</script>
Form:
Code:
<form name="login" method="post" action="">
<input name="username" class="campos" id="username" title="user" type="text" value="user" size="22" style="color:#666; background-color:transparent"  onblur="if (this.value=='') this.value='user'" onfocus="if (this.value=='user') this.value=''" />
<input name="password" class="campos" id="password" title="pass" type="password" value="pass" size="14" style="color:#666; background-color:transparent" onblur="if (this.value=='') this.value='pass'" onfocus="if (this.value=='pass') this.value=''" />
<input name="Submit" type="submit" class="botao" value="OK" style="color:#666; border-color:#CCC; background-color:transparent; border:1;" onclick="Login()"/>
</form>
When I type incorrect username or password, I get the error message, but when I type correct username and password does not redirect to page "internal.php" and will not appear error message also. Just stay in the same page.

Can anyone help me?