/*************************************************

************************************************/
/************************************
Forgot password

*************************************/
function check_forgot_password(txtmsg)
{
	//alert(txtmsg);
	var arrmsg =txtmsg.split("#");	
	var username =document.formForgetPassword.username;
	var useremail =document.formForgetPassword.email;
	if(username.value == '')
	{
		alert(arrmsg['0']);
		username.focus();
		return false;
	}
	if(useremail.value == '')
	{
		alert(arrmsg['1']);
		useremail.focus();
		return false;
	}

	if(useremail.value != '')
	{
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(useremail.value))
	{
	alert(arrmsg['2']);
	useremail.value='';
	useremail.focus();
	return false;
	}
	}
}
/************************************
Teacher Registration 
*************************************/

function check_teacher_registration_form(txtmsg)
{
	//alert(txtmsg);
	var arrmsg =txtmsg.split("#");	
	
	var access_code  =document.formTeacherRegistration.access_code;
	var username  =document.formTeacherRegistration.username;
	var password  =document.formTeacherRegistration.password;
	var cpassword =document.formTeacherRegistration.cpassword;
	var fname =document.formTeacherRegistration.fname;
	var lname =document.formTeacherRegistration.lname;
	var email =document.formTeacherRegistration.email;
	var lic_check =document.formTeacherRegistration.lic_check;
	//var subjectid =document.getElementById('subjectid');
	//var levelvalue =document.formTeacherRegistration.levelvalue;
	//var phone =document.formTeacherRegistration.phone;

	if(access_code.value == '')
	{
		alert(arrmsg['0']);
		access_code.focus();
		return false;
	}
	
	/*if(subjectid.value == '')
	{
		alert(arrmsg['1']);
		subjectid.focus();
		return false;
	}
	if(levelvalue.value == '')
	{
		alert(arrmsg['2']);
		levelvalue.focus();
		return false;
	}*/
	if(username.value == '')
	{
		alert(arrmsg['3']);
		username.focus();
		return false;
	}
	if(password.value == '')
	{
		alert(arrmsg['4']);
		password.focus();
		return false;
	}
	if(cpassword.value == '')
	{
		alert(arrmsg['5']);
		cpassword.focus();
		return false;
	}
	if((password.value != '') && (cpassword.value != ''))
	{
		if(password.value  != cpassword.value )
		{
			alert(arrmsg['6']);
			password.value='';
			cpassword.value='';
			password.focus();
			return false;
		}
	}
	if(fname.value == '')
	{
		alert(arrmsg['7']);
		fname.focus();
		return false;
	}
	if(lname.value == '')
	{
		alert(arrmsg['8']);
		lname.focus();
		return false;
	}

	if(email.value == '')
	{
		alert(arrmsg['9']);
		email.focus();
		return false;
	}

	if(email.value != '')
	{
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value))
	{
	alert(arrmsg['10']);
	email.value='';
	email.focus();
	return false;
	}
	}
	
	if(lic_check.checked=='')
	{
		alert(arrmsg['11']);
		lic_check.focus();
		return false;
	}
	/*if(phone.value == '')
	{
		alert(arrmsg['11']);
		phone.focus();
		return false;
	}*/
}//end of function.

/*******************************************
Student Registration
***********************************************/
function check_student_registration_form(txtmsg)
{
	var arrmsg =txtmsg.split("#");	
	var school_id  =document.formStudentRegistration.groupcode;
	var username  =document.formStudentRegistration.username;
	var password  =document.formStudentRegistration.password;
	var cpassword =document.formStudentRegistration.cpassword;
	var fname =document.formStudentRegistration.fname;
	var lname =document.formStudentRegistration.lname;
	var email =document.formStudentRegistration.email;
	var dob =document.formStudentRegistration.date;
	var mob =document.formStudentRegistration.month;
	var yob =document.formStudentRegistration.year;
	
	if(school_id.value == '')
	{
		alert(arrmsg['8']);
		school_id.focus();
		return false;
	}
	if(username.value == '')
	{
		alert(arrmsg['0']);
		username.focus();
		return false;
	}
	if(password.value == '')
	{
		alert(arrmsg['1']);
		password.focus();
		return false;
	}
	if(cpassword.value == '')
	{
		alert(arrmsg['2']);
		cpassword.focus();
		return false;
	}
	if((password.value != '') && (cpassword.value != ''))
	{
		if(password.value  != cpassword.value )
		{
			alert(arrmsg['3']);
			password.value='';
			cpassword.value='';
			password.focus();
			return false;
		}
	}
	if(fname.value == '')
	{
		alert(arrmsg['4']);
		fname.focus();
		return false;
	}
	if(lname.value == '')
	{
		alert(arrmsg['5']);
		lname.focus();
		return false;
	}
	
	if(dob.value == '')
	{
		alert(arrmsg['9']);
		dob.focus();
		return false;
	}
	
	if(mob.value == '')
	{
		alert(arrmsg['10']);
		mob.focus();
		return false;
	}

	if(mob.value != '' && dob.value != '')
	{
		if(mob.value==2 && dob.value>29)
		{
		alert(arrmsg['12']);
		dob.focus();
		return false;
		}
	}

	if(yob.value == '')
	{
		alert(arrmsg['11']);
		yob.focus();
		return false;
	}

	if(email.value == '')
	{
		alert(arrmsg['6']);
		email.focus();
		return false;
	}

	if(email.value != '')
	{
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value))
	{
	alert(arrmsg['7']);
	email.value='';
	email.focus();
	return false;
	}
	}
}//end of function.

