/* 
  $Id: pnloginp.js,v 1.2 2006/11/21 13:20:25 yayun Exp $
  Name: pnloginp.js
  Author: Yayun Sun
  Copyright: (c) Metafour UK Ltd. 2006
  
  Description: 
  Javascript functions needed for the party leader to login.
*/

var emailRegex = /.+@.+\..+/;

/*
	This function validates the input of the login page.
*/
function validateLogin() {
	var alertMsg = "";
	
	//Validate the presence of the email address and the password
	if (document.frmLogin.txtEmail.value == "")
		alertMsg += "Please enter your email address.\n";
	if (document.frmLogin.txtPassword.value == "")
		alertMsg += "Please enter your password.\n";
		
	if (document.frmLogin.txtEmail.value != "" && !document.frmLogin.txtEmail.value.match(emailRegex))
		alertMsg += "Please type your email address in the following format: yourname@example.com\n";
		
	//Show alert if there is one
	if (alertMsg != "") {
		alert(alertMsg);
		return;
	}	
	
	document.frmLogin.submit();	
		
}
/*
	This function displays a small window for the user to get the password
*/
function showPasswdReminder() {
	window.open("http://82.133.13.36/pinnpax/pngtpswd.php", "_blank", "directories=no, height=250, width=480");
}
/*
	This function closes the password reminder
*/
function closeWindow() {
	window.close();
}