function selfOpen(url)
{
	var win = window.open(url, 'studentWin', 'fullscreen=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
	if (!win || win.name == undefined)
	{
		if (self.location.href)
			self.location.href = url;
		else
			self.location = url;
	}
	else
		win.focus();

}

function showForm(type)
{
	document.getElementById("studentusername").value = "";
	document.getElementById("studentpassword").value = "";
	
	document.getElementById("parentname").value = "";
	document.getElementById("parentpassword").value = "";
	
	document.getElementById("teachername").value = "";
	document.getElementById("teacherpassword").value = "";
	
	loginFormNames = ["loginChooser", "studentlogin", "parentlogin", "teacherlogin"];
	for (i=0; i<loginFormNames.length; i++)
		document.getElementById(loginFormNames[i]).style.display = "none";
	
	document.getElementById(type).style.display = "";
	
	if (type != "loginChooser")
		springBack = setTimeout("showLoginChooser()", 1*60*1000);
}

function showLoginChooser()
{
	showForm("loginChooser");
}

function submitStudentLogin()
{
	var u    = document.getElementById("studentusername").value;
	var p    = document.getElementById("studentpassword").value;
	var url  = "http://auth.whizz.com/student/login.php"
	url += "?action=process&redirect=/login/loginerror.html&username="+u+"&password="+p;
	selfOpen(url);
}
