/*
 * register.js
 * This file is part of Profile Manager
 *
 * Copyright (C) 2005 Khader Abbeb N
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA 02111-1307, USA. 
 *
 */

	function fn_login()
	{
	  	var user_name,passwd;
  		user_name 	= document.login_form.uname.value;
		passwd    	= document.login_form.passwd.value;
		if(user_name==""||passwd=="") {
		    window.alert("Enter Username and Password");
		    return false;
		}
		return true;
	}

	function fn_validate()
	{
		document.reg_form.user_name.value = document.login_form.uname.value;
		document.reg_form.passwd.value    = document.login_form.passwd.value;

	  	var user_name,passwd,pass_confirm;
  		user_name 	    = document.reg_form.user_name.value;
		passwd    	    = document.reg_form.passwd.value;
		passwd_confirm  = document.reg_form.passwd_confirm.value;

		if(user_name=="" || passwd=="" || passwd_confirm=="")
		    window.alert("Missing value for mandatory field(s)");
		else if(passwd_confirm!=passwd)
		{
		    window.alert("Passwords are not same");
		    document.reg_form.passwd.value="";
		    document.login_form.passwd.value="";
		    document.reg_form.passwd_confirm.value="";
		}
		else if(passwd.length<6)
		{
		    window.alert("Password is too short");
		    document.login_form.passwd.value="";
		    document.reg_form.passwd.value="";
		    document.reg_form.passwd_confirm.value="";
		}
		else
		{
		    document.reg_form.sub_register.value="yes";
		    return true;
		}
		return false;
	}
