function chack_validation(val)
{
	var alpha="+-01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`'\"()";
	var found=false;
	for(i=0;i<val.length;i++)
	{
		if(alpha.indexOf(val.charAt(i),0)!=-1)
		 {
			found=true;
			break;
		 }
	}
	
	if(found)
		return false;
	else
		return true;
}

function new_student_validation()
{
	if(frm.username.value=="" || chack_validation(frm.username.value))
	 {
		alert("Please enter the username");
		frm.username.focus();
		return false;
	 }
	 
	 if(frm.password.value=="" || chack_validation(frm.password.value))
	 {
		alert("Please enter the password");
		frm.password.focus();
		return false;
	 }
	
	if(frm.confirm_password.value=="" || chack_validation(frm.confirm_password.value))
	 {
		alert("Please retype your password");
		frm.confirm_password.focus();
		return false;
	 }
	 	
	if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
	 {
		alert("The confirmation password doesn't match the origin one");
		frm.confirm_password.value="";
		frm.confirm_password.focus();
		return false;
	 }
	
	if(frm.first_name.value=="" || chack_validation(frm.first_name.value))
	 {
		alert("Please enter the first name");
		frm.first_name.focus();
		return false;
	 }
	 	 
	if(frm.last_name.value=="" || chack_validation(frm.last_name.value))
	 {
		alert("Please enter the last name");
		frm.last_name.focus();
		return false;
	 }
	
	if(isNaN(frm.ssn.value)) 
	 {
		alert("Invalid ssn value");
		frm.ssn.focus();
		return false;
	 }
	
	if(frm.gender.value=="")
	 {
		alert("Please select the gender");
		frm.gender.focus();
		return false;
	 }
	
	if(frm.date_of_birth.value=="" || frm.date_of_birth.value=="YYYY-MM-DD")
	 {
		alert("Please enter the date of birth");
		frm.date_of_birth.focus();
		return false;
	 }
	 
    if(frm.date_of_birth.value!="")
	 {
	 	var mydate=new Date() 
		var year=mydate.getYear() 
	 	birth_date_array=new Array();
		birth_date=frm.date_of_birth.value;
		birth_date_array=birth_date.split("-");
		if(birth_date_array.length!=3)
		 {
			alert("Invalid date format, date of birth must be in format of (YYYY-MM-DD)");
			frm.date_of_birth.focus();
			return false;
		 }
		else
		if(birth_date_array[0]<1900 || birth_date_array[0]>year || birth_date_array[1]<1 || birth_date_array[1]>12 || birth_date_array[2]<1 || birth_date_array[2]>31 )
		 {
			alert("Invalid date, please enter a valid date of birth");
			frm.date_of_birth.focus();
			return false;
		 }
	 }
	
	
	if(frm.address.value=="" || chack_validation(frm.address.value)) 
	{
		alert("Please enter the address");
		frm.address.focus();
		return false;
	 }
	 
   if(frm.city.value=="" || chack_validation(frm.city.value)) 
	{
		alert("Please enter the city");
		frm.city.focus();
		return false;
	 }
	 
   if(frm.state.value=="" && frm.country.value=="United States") 
	{
		alert("Please select the state");
		frm.state.focus();
		return false;
	}
	
  if(frm.state.value!="" && frm.country.value!="United States") 
   {
		alert("You can't select a state inside United States if destination located outside United States");
		frm.state.focus();
		return false;
   }
	    
  if(isNaN(frm.zip.value)) 
	{
		alert("Invalid zipcode value");
		frm.zip.focus();
		return false;
	}
	
	if(frm.country.value=="") 
	{
		alert("Please select the country");
		frm.country.focus();
		return false;
	}
	
	if(frm.nationality.value=="" || chack_validation(frm.nationality.value)) 
	{
		alert("Please enter the nationality");
		frm.nationality.focus();
		return false;
	}
	
	if(frm.phone.value=="") 
	 {
		alert("Please enter the phone");
		frm.phone.focus();
		return false;
	 }
	 
   if(isNaN(frm.phone.value)) 
	{
		alert("Invalid phone value");
		frm.phone.focus();
		return false;
	}
	
	if(isNaN(frm.fax.value)) 
	 {
		alert("Invalid fax value");
		frm.fax.focus();
		return false;
	 }
	 
	if(isNaN(frm.sms.value)) 
	 {
		alert("Invalid sms value");
		frm.sms.focus();
		return false;
	 }
	
	if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
		
	if(frm.sub_major_id.value=="") 
	{
		alert("Please select the major");
		frm.sub_major_id.focus();
		return false;
	}
	
	if(frm.authentication_number.value=="") 
	{
		alert("Please enter image code");
		frm.authentication_number.focus();
		return false;
	}
}

function new_professor_validation()
{
	if(frm.username.value=="")
	 {
		alert("Please enter the username");
		frm.username.focus();
		return false;
	 }
	 
	 if(frm.password.value=="")
	 {
		alert("Please enter the password");
		frm.password.focus();
		return false;
	 }
	
	if(frm.confirm_password.value=="")
	 {
		alert("Please retype your password");
		frm.confirm_password.focus();
		return false;
	 }
	 	
	if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
	 {
		alert("The confirmation password doesn't match the origin one");
		frm.confirm_password.value="";
		frm.confirm_password.focus();
		return false;
	 }
	
	if(frm.first_name.value=="")
	 {
		alert("Please enter the first name");
		frm.first_name.focus();
		return false;
	 }
	 
	 if(frm.middle_initial.value=="")
	 {
		alert("Please enter the middle name");
		frm.middle_initial.focus();
		return false;
	 }
	 
	if(frm.last_name.value=="")
	 {
		alert("Please enter the last name");
		frm.last_name.focus();
		return false;
	 }
	
	if(frm.ssn.value=="")
	 {
		alert("Please enter the ssn");
		frm.ssn.focus();
		return false;
	 }
	
	if(frm.gender.value=="")
	 {
		alert("Please select the gender");
		frm.gender.focus();
		return false;
	 }
	
	if(frm.date_of_birth.value=="" || frm.date_of_birth.value=="YYYY-MM-DD")
	 {
		alert("Please enter the date of birth");
		frm.date_of_birth.focus();
		return false;
	 }
	 
    if(frm.date_of_birth.value!="")
	 {
	 	var mydate=new Date() 
		var year=mydate.getYear() 
	 	birth_date_array=new Array();
		birth_date=frm.date_of_birth.value;
		birth_date_array=birth_date.split("-");
		if(birth_date_array.length!=3)
		 {
			alert("Invalid date format, date of birth must be in format of (YYYY-MM-DD)");
			frm.date_of_birth.focus();
			return false;
		 }
		else
		if(birth_date_array[0]<1900 || birth_date_array[0]>year || birth_date_array[1]<1 || birth_date_array[1]>12 || birth_date_array[2]<1 || birth_date_array[2]>31 )
		 {
			alert("Invalid date, please enter a valid date of birth");
			frm.date_of_birth.focus();
			return false;
		 }
	 }
	
	if(frm.religion.value=="") 
	{
		alert("Please enter the religion");
		frm.religion.focus();
		return false;
	 }
	
	if(frm.address.value=="") 
	{
		alert("Please enter the address");
		frm.address.focus();
		return false;
	 }
	 
   if(frm.city.value=="") 
	{
		alert("Please enter the city");
		frm.city.focus();
		return false;
	 }
	 
   if(frm.state.value=="" && frm.country.value=="United States") 
	{
		alert("Please select the state");
		frm.state.focus();
		return false;
	}
	
  if(frm.state.value!="" && frm.country.value!="United States") 
   {
		alert("You can't select a state inside United States if destination located outside United States");
		frm.state.focus();
		return false;
   }
	 
	if(frm.zip.value=="") 
	 {
		alert("Please enter the zipcode");
		frm.zip.focus();
		return false;
	 }
	 
	if(isNaN(frm.zip.value)) 
	{
		alert("Invalid zipcode value");
		frm.zip.focus();
		return false;
	}
	
	if(frm.country.value=="") 
	{
		alert("Please select the country");
		frm.country.focus();
		return false;
	}
	
	if(frm.nationality.value=="") 
	{
		alert("Please enter the nationality");
		frm.nationality.focus();
		return false;
	}
	
	if(frm.phone.value=="") 
	 {
		alert("Please enter the phone");
		frm.phone.focus();
		return false;
	 }
	 
	if(frm.fax.value=="") 
	 {
		alert("Please enter the fax");
		frm.fax.focus();
		return false;
	 }
	 	
	if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.qualifications.value=="")
	 {
		alert("Please enter qualifications");
		frm.qualifications.focus();
		return false;
	}
	
	if(frm.experience.value=="") 
	{
		alert("Please select the experience");
		frm.experience.focus();
		return false;
	}
	
	if(frm.authentication_number.value=="") 
	{
		alert("Please enter image code");
		frm.authentication_number.focus();
		return false;
	}
}

function edit_student_validation()
{
	 if(frm.old_password.value!="")
	 {
		if(frm.password.value=="" || chack_validation(frm.password.value))
		 {
			alert("Please enter the password");
			frm.password.focus();
			return false;
		 }
		
		if(frm.confirm_password.value=="" || chack_validation(frm.password.value))
		 {
			alert("Please retype your password");
			frm.confirm_password.focus();
			return false;
		 }
			
		if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
		 {
			alert("The confirmation password doesn't match the origin one");
			frm.confirm_password.value="";
			frm.confirm_password.focus();
			return false;
		 }
	 }
	 
	if(frm.password.value!="" && frm.old_password.value=="")
	 {
		alert("Please enter the old password");
		frm.old_password.focus();
		return false;
	 }
	
	if(frm.first_name.value=="" || chack_validation(frm.first_name.value))
	 {
		alert("Please enter the first name");
		frm.first_name.focus();
		return false;
	 }
	 	 
	if(frm.last_name.value=="" || chack_validation(frm.last_name.value))
	 {
		alert("Please enter the last name");
		frm.last_name.focus();
		return false;
	 }
	
	if(isNaN(frm.ssn.value)) 
	{
		alert("Invalid ssn value");
		frm.ssn.focus();
		return false;
	}
	
	if(frm.gender.value=="")
	 {
		alert("Please select the gender");
		frm.gender.focus();
		return false;
	 }
	
	if(frm.date_of_birth.value=="" || frm.date_of_birth.value=="YYYY-MM-DD")
	 {
		alert("Please enter the date of birth");
		frm.date_of_birth.focus();
		return false;
	 }
	 
    if(frm.date_of_birth.value!="")
	 {
	 	var mydate=new Date() 
		var year=mydate.getYear() 
	 	birth_date_array=new Array();
		birth_date=frm.date_of_birth.value;
		birth_date_array=birth_date.split("-");
		if(birth_date_array.length!=3)
		 {
			alert("Invalid date format, date of birth must be in format of (YYYY-MM-DD)");
			frm.date_of_birth.focus();
			return false;
		 }
		else
		if(birth_date_array[0]<1900 || birth_date_array[0]>year || birth_date_array[1]<1 || birth_date_array[1]>12 || birth_date_array[2]<1 || birth_date_array[2]>31 )
		 {
			alert("Invalid date, please enter a valid date of birth");
			frm.date_of_birth.focus();
			return false;
		 }
	 }
	
	
	if(frm.address.value=="" || chack_validation(frm.address.value)) 
	{
		alert("Please enter the address");
		frm.address.focus();
		return false;
	 }
	 
   if(frm.city.value=="" || chack_validation(frm.city.value)) 
	{
		alert("Please enter the city");
		frm.city.focus();
		return false;
	 }
	 
   if(frm.state.value=="" && frm.country.value=="United States") 
	{
		alert("Please select the state");
		frm.state.focus();
		return false;
	}
	
  if(frm.state.value!="" && frm.country.value!="United States") 
   {
		alert("You can't select a state inside United States if destination located outside United States");
		frm.state.focus();
		return false;
   }
	 	 
	if(isNaN(frm.zip.value)) 
	{
		alert("Invalid zipcode value");
		frm.zip.focus();
		return false;
	}
	
	if(frm.country.value=="" || chack_validation(frm.country.value)) 
	{
		alert("Please select the country");
		frm.country.focus();
		return false;
	}
	
	if(frm.nationality.value=="" || chack_validation(frm.nationality.value)) 
	{
		alert("Please enter the nationality");
		frm.nationality.focus();
		return false;
	}
	
	if(frm.phone.value=="" || chack_validation(frm.phone.value)) 
	 {
		alert("Please enter the phone");
		frm.phone.focus();
		return false;
	 }
	 
	if(isNaN(frm.phone.value)) 
	{
		alert("Invalid phone value");
		frm.phone.focus();
		return false;
	}
	
	if(isNaN(frm.fax.value)) 
	{
		alert("Invalid fax value");
		frm.fax.focus();
		return false;
	}
	 	
	if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(isNaN(frm.sms.value)) 
	{
		alert("Invalid sms value");
		frm.sms.focus();
		return false;
	}
			
	if(frm.sub_major_id.value=="") 
	{
		alert("Please select the major");
		frm.sub_major_id.focus();
		return false;
	}
}


function edit_student_validation_admin()
{
	 
	if(frm.password.value!="")
	 {
		if(frm.confirm_password.value=="" || chack_validation(frm.password.value))
		 {
			alert("Please retype your password");
			frm.confirm_password.focus();
			return false;
		 }
			
		if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
		 {
			alert("The confirmation password doesn't match the origin one");
			frm.confirm_password.value="";
			frm.confirm_password.focus();
			return false;
		 }
	 }
	
	if(frm.first_name.value=="" || chack_validation(frm.first_name.value))
	 {
		alert("Please enter the first name");
		frm.first_name.focus();
		return false;
	 }
	 	 
	if(frm.last_name.value=="" || chack_validation(frm.last_name.value))
	 {
		alert("Please enter the last name");
		frm.last_name.focus();
		return false;
	 }
	
	if(isNaN(frm.ssn.value)) 
	{
		alert("Invalid ssn value");
		frm.ssn.focus();
		return false;
	}
	
	if(frm.gender.value=="")
	 {
		alert("Please select the gender");
		frm.gender.focus();
		return false;
	 }
	
	if(frm.date_of_birth.value=="" || frm.date_of_birth.value=="YYYY-MM-DD")
	 {
		alert("Please enter the date of birth");
		frm.date_of_birth.focus();
		return false;
	 }
	 
    if(frm.date_of_birth.value!="")
	 {
	 	var mydate=new Date() 
		var year=mydate.getYear() 
	 	birth_date_array=new Array();
		birth_date=frm.date_of_birth.value;
		birth_date_array=birth_date.split("-");
		if(birth_date_array.length!=3)
		 {
			alert("Invalid date format, date of birth must be in format of (YYYY-MM-DD)");
			frm.date_of_birth.focus();
			return false;
		 }
		else
		if(birth_date_array[0]<1900 || birth_date_array[0]>year || birth_date_array[1]<1 || birth_date_array[1]>12 || birth_date_array[2]<1 || birth_date_array[2]>31 )
		 {
			alert("Invalid date, please enter a valid date of birth");
			frm.date_of_birth.focus();
			return false;
		 }
	 }
	
	
	if(frm.address.value=="" || chack_validation(frm.address.value)) 
	{
		alert("Please enter the address");
		frm.address.focus();
		return false;
	 }
	 
   if(frm.city.value=="" || chack_validation(frm.city.value)) 
	{
		alert("Please enter the city");
		frm.city.focus();
		return false;
	 }
	 
   if(frm.state.value=="" && frm.country.value=="United States") 
	{
		alert("Please select the state");
		frm.state.focus();
		return false;
	}
	
  if(frm.state.value!="" && frm.country.value!="United States") 
   {
		alert("You can't select a state inside United States if destination located outside United States");
		frm.state.focus();
		return false;
   }
	 	 
	if(isNaN(frm.zip.value)) 
	{
		alert("Invalid zipcode value");
		frm.zip.focus();
		return false;
	}
	
	if(frm.country.value=="" || chack_validation(frm.country.value)) 
	{
		alert("Please select the country");
		frm.country.focus();
		return false;
	}
	
	if(frm.nationality.value=="" || chack_validation(frm.nationality.value)) 
	{
		alert("Please enter the nationality");
		frm.nationality.focus();
		return false;
	}
	
	if(frm.phone.value=="" || chack_validation(frm.phone.value)) 
	 {
		alert("Please enter the phone");
		frm.phone.focus();
		return false;
	 }
	 
	if(isNaN(frm.phone.value)) 
	{
		alert("Invalid phone value");
		frm.phone.focus();
		return false;
	}
	
	if(isNaN(frm.fax.value)) 
	{
		alert("Invalid fax value");
		frm.fax.focus();
		return false;
	}
	 	
	if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(isNaN(frm.sms.value)) 
	{
		alert("Invalid sms value");
		frm.sms.focus();
		return false;
	}
			
	if(frm.sub_major_id.value=="") 
	{
		alert("Please select the major");
		frm.sub_major_id.focus();
		return false;
	}
}

function edit_professor_validation()
{
	 if(frm.old_password.value!="")
	 {
		if(frm.password.value=="")
		 {
			alert("Please enter the password");
			frm.password.focus();
			return false;
		 }
		
		if(frm.confirm_password.value=="")
		 {
			alert("Please retype your password");
			frm.confirm_password.focus();
			return false;
		 }
			
		if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
		 {
			alert("The confirmation password doesn't match the origin one");
			frm.confirm_password.value="";
			frm.confirm_password.focus();
			return false;
		 }
	 }
	
	if(frm.password.value!="" && frm.old_password.value=="")
	 {
		alert("Please enter the old password");
		frm.old_password.focus();
		return false;
	 }
	
	if(frm.first_name.value=="")
	 {
		alert("Please enter the first name");
		frm.first_name.focus();
		return false;
	 }
	 
	 if(frm.middle_initial.value=="")
	 {
		alert("Please enter the middle name");
		frm.middle_initial.focus();
		return false;
	 }
	 
	if(frm.last_name.value=="")
	 {
		alert("Please enter the last name");
		frm.last_name.focus();
		return false;
	 }
	
	if(frm.ssn.value=="")
	 {
		alert("Please enter the ssn");
		frm.ssn.focus();
		return false;
	 }
	
	if(frm.gender.value=="")
	 {
		alert("Please select the gender");
		frm.gender.focus();
		return false;
	 }
	
	if(frm.date_of_birth.value=="" || frm.date_of_birth.value=="YYYY-MM-DD")
	 {
		alert("Please enter the date of birth");
		frm.date_of_birth.focus();
		return false;
	 }
	 
    if(frm.date_of_birth.value!="")
	 {
	 	var mydate=new Date() 
		var year=mydate.getYear() 
	 	birth_date_array=new Array();
		birth_date=frm.date_of_birth.value;
		birth_date_array=birth_date.split("-");
		if(birth_date_array.length!=3)
		 {
			alert("Invalid date format, date of birth must be in format of (YYYY-MM-DD)");
			frm.date_of_birth.focus();
			return false;
		 }
		else
		if(birth_date_array[0]<1900 || birth_date_array[0]>year || birth_date_array[1]<1 || birth_date_array[1]>12 || birth_date_array[2]<1 || birth_date_array[2]>31 )
		 {
			alert("Invalid date, please enter a valid date of birth");
			frm.date_of_birth.focus();
			return false;
		 }
	 }
	
	if(frm.religion.value=="") 
	{
		alert("Please enter the religion");
		frm.religion.focus();
		return false;
	 }
	
	if(frm.address.value=="") 
	{
		alert("Please enter the address");
		frm.address.focus();
		return false;
	 }
	 
   if(frm.city.value=="") 
	{
		alert("Please enter the city");
		frm.city.focus();
		return false;
	 }
	 
   if(frm.state.value=="" && frm.country.value=="United States") 
	{
		alert("Please select the state");
		frm.state.focus();
		return false;
	}
	
  if(frm.state.value!="" && frm.country.value!="United States") 
   {
		alert("You can't select a state inside United States if destination located outside United States");
		frm.state.focus();
		return false;
   }
	 
	if(frm.zip.value=="") 
	 {
		alert("Please enter the zipcode");
		frm.zip.focus();
		return false;
	 }
	 
	if(isNaN(frm.zip.value)) 
	{
		alert("Invalid zipcode value");
		frm.zip.focus();
		return false;
	}
	
	if(frm.country.value=="") 
	{
		alert("Please select the country");
		frm.country.focus();
		return false;
	}
	
	if(frm.nationality.value=="") 
	{
		alert("Please enter the nationality");
		frm.nationality.focus();
		return false;
	}
	
	if(frm.phone.value=="") 
	 {
		alert("Please enter the phone");
		frm.phone.focus();
		return false;
	 }
	 
	if(frm.fax.value=="") 
	 {
		alert("Please enter the fax");
		frm.fax.focus();
		return false;
	 }
	 	
	if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.qualifications.value=="")
	 {
		alert("Please enter the qualifications");
		frm.qualifications.focus();
		return false;
	}
	
	if(frm.experience.value=="") 
	{
		alert("Please select the experience");
		frm.experience.focus();
		return false;
	}
	
}

function check_student_subjects()
{
	if(frm.subject_id.value=="") 
	{
		alert("Please select the subject");
		frm.subject_id.focus();
		return false;
	}
}

function check_student_login_validation()
{
   if(frm.student_username.value=="") 
	{
		alert("Please enter your user name");
		frm.student_username.focus();
		return false;
	}
   else
   if(frm.student_password.value=="") 
	{
		alert("Please enter your password");
		frm.student_password.focus();
		return false;
	}
   else
    {
   		frm.student_hidden_login.value=1;
		frm.submit();
	}
}

function send_student_password_validation()
{
   if(frm.student_username2.value=="") 
	{
		alert("Please enter your user name");
		frm.student_username2.focus();
		return false;
	}
   else
   if(frm.student_email_address.value=="") 
	{
		alert("Please enter your E-mail");
		frm.student_email_address.focus();
		return false;
	}
   else
   if(frm.student_email_address.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.student_email_address.focus();
		return false;
	}
   else
   if(frm.student_email_address.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.student_email_address.focus();
		return false;
	}
   else
   if(frm.student_email_address.value.indexOf("@",frm.student_email_address.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.student_email_address.focus();
		return false;
	}
   else
   if(frm.student_email_address.value.indexOf(".",frm.student_email_address.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.student_email_address.focus();
		return false;
	}
   else
    {
   		frm.student_hidden_send_password.value=1;
		frm.submit();
	}
}

function check_professor_login_validation()
{
   if(frm.professor_username.value=="") 
	{
		alert("Please enter your user name");
		frm.professor_username.focus();
		return false;
	}
   else
   if(frm.professor_password.value=="") 
	{
		alert("Please enter your password");
		frm.professor_password.focus();
		return false;
	}
   else
    {
   		frm.professor_hidden_login.value=1;
		frm.submit();
	}
}

function send_professor_password_validation()
{
   if(frm.professor_username2.value=="") 
	{
		alert("Please enter your user name");
		frm.professor_username2.focus();
		return false;
	}
   else
   if(frm.professor_email_address.value=="") 
	{
		alert("Please enter your E-mail");
		frm.professor_email_address.focus();
		return false;
	}
   else
   if(frm.professor_email_address.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.professor_email_address.focus();
		return false;
	}
   else
   if(frm.professor_email_address.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.professor_email_address.focus();
		return false;
	}
   else
   if(frm.professor_email_address.value.indexOf("@",frm.professor_email_address.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.professor_email_address.focus();
		return false;
	}
   else
   if(frm.professor_email_address.value.indexOf(".",frm.professor_email_address.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.professor_email_address.focus();
		return false;
	}
   else
    {
   		frm.professor_hidden_send_password.value=1;
		frm.submit();
	}
}


function change_password_validation()
{
	if(frm.password.value=="")
	 {
		alert("Please enter the password");
		frm.password.focus();
		return false;
	 }
	
	if(frm.confirm_password.value=="")
	 {
		alert("Please retype your password");
		frm.confirm_password.focus();
		return false;
	 }
	 	
	if(frm.password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.password.value)
	 {
		alert("The confirmation password doesn't match the origin one");
		frm.confirm_password.value="";
		frm.confirm_password.focus();
		return false;
	 }
}

function contact_us_validation()
{
   if(frm.email.value=="") 
	{
		alert("Please enter the E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",1)==0) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf("@",frm.email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.email.value.indexOf(".",frm.email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid E-mail address");
		frm.email.focus();
		return false;
	}
	
	if(frm.name.value=="") 
	{
		alert("Please enter the name");
		frm.name.focus();
		return false;
	}
	
	if(frm.data.value=="") 
	{
		alert("Please enter the data");
		frm.data.focus();
		return false;
	}
	
	if(frm.authentication_number.value=="") 
	{
		alert("Please enter the authentication number");
		frm.authentication_number.focus();
		return false;
	}	
}

function admin_account_validation()
{
	if(frm.username.value=="")
	 {
		alert("Please enter the user name");
		frm.username.focus();
		return false;
	 }
	
	if(frm.old_password.value=="")
	 {
		alert("Please enter the old password");
		frm.old_password.focus();
		return false;
	 }
	 
	if(frm.new_password.value=="")
	 {
		alert("Please enter the new password");
		frm.new_password.focus();
		return false;
	 }
	
	if(frm.confirm_password.value=="")
	 {
		alert("Please retype your password");
		frm.confirm_password.focus();
		return false;
	 }
	 	
	if(frm.new_password.value!="" && frm.confirm_password.value!="" && frm.confirm_password.value!=frm.new_password.value)
	 {
		alert("The confirmation password doesn't match the origin one");
		frm.confirm_password.value="";
		frm.confirm_password.focus();
		return false;
	 }
}

function website_configurations()
{
	if(frm.website_url.value=="")
	 {
		alert("Please enter the Website URL");
		frm.website_url.focus();
		return false;
	 }
	 
	 if(frm.website_name.value=="")
	 {
		alert("Please enter the Website name");
		frm.website_name.focus();
		return false;
	 }
	 
	 if(frm.title_bar.value=="")
	 {
		alert("Please enter the Title Bar Caption");
		frm.title_bar.focus();
		return false;
	 }
	 
	 if(frm.administrator_email.value=="")
	 {
		alert("Please enter the Administrator E-mail");
		frm.administrator_email.focus();
		return false;
	 }
	 
	if(frm.administrator_email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid Administrator E-mail address");
		frm.administrator_email.focus();
		return false;
	}
	
	if(frm.administrator_email.value.indexOf("@",1)==0) 
	{
		alert("Invalid Administrator E-mail address");
		frm.administrator_email.focus();
		return false;
	}
	
	if(frm.administrator_email.value.indexOf("@",frm.administrator_email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid Administrator E-mail address");
		frm.administrator_email.focus();
		return false;
	}
	
	if(frm.administrator_email.value.indexOf(".",frm.administrator_email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid Administrator E-mail address");
		frm.administrator_email.focus();
		return false;
	}
	
	if(frm.contact_email.value=="")
	 {
		alert("Please enter the Contact E-mail");
		frm.contact_email.focus();
		return false;
	 }
	 
	if(frm.contact_email.value.indexOf("@",1)==-1) 
	{
		alert("Invalid Contact E-mail address");
		frm.contact_email.focus();
		return false;
	}
	
	if(frm.contact_email.value.indexOf("@",1)==0) 
	{
		alert("Invalid Contact E-mail address");
		frm.contact_email.focus();
		return false;
	}
	
	if(frm.contact_email.value.indexOf("@",frm.contact_email.value.indexOf("@",1)+1)>-1) 
	{
		alert("Invalid Contact E-mail address");
		frm.contact_email.focus();
		return false;
	}
	
	if(frm.contact_email.value.indexOf(".",frm.contact_email.value.indexOf("@",1)+2)==-1)	
	{
		alert("Invalid Contact E-mail address");
		frm.contact_email.focus();
		return false;
	}
	 
	 if(frm.website_footer.value=="")
	 {
		alert("Please enter the Website Footer");
		frm.website_footer.focus();
		return false;
	 }
	 
	 if(frm.page_result.value=="")
	 {
		alert("Please enter the Main Result Per Page");
		frm.page_result.focus();
		return false;
	 }
	 
	if(isNaN(frm.page_result.value) || frm.page_result.value<1) 
	{
		alert("Invalid Main Result Per Page value, It must be integer over zero value");
		frm.page_result.focus();
		return false;
	}
	 
	 if(frm.box_result.value=="")
	 {
		alert("Please enter the Main Result Per Box");
		frm.box_result.focus();
		return false;
	 }
	 
	if(isNaN(frm.box_result.value) || frm.box_result.value<1) 
	{
		alert("Invalid Main Result Per Box value, It must be integer over zero value");
		frm.box_result.focus();
		return false;
	}
	
	if(frm.website_status.value==0 && frm.inactivation_message.value=="")
	 {
		alert("Please enter the Inactivation Message");
		frm.inactivation_message.focus();
		return false;
	 }
}

function student_login_box_validation()
{
   if(student_frm.student_box_username.value=="") 
	{
		alert("Please enter your user name");
		student_frm.student_box_username.focus();
		return false;
	}
   else
   if(student_frm.student_box_password.value=="") 
	{
		alert("Please enter your password");
		student_frm.student_box_password.focus();
		return false;
	}
}

function professor_login_box_validation()
{
   if(professor_frm.professor_box_username.value=="") 
	{
		alert("Please enter your user name");
		professor_frm.professor_box_username.focus();
		return false;
	}
   else
   if(professor_frm.professor_box_password.value=="") 
	{
		alert("Please enter your password");
		professor_frm.professor_box_password.focus();
		return false;
	}
}

//-------------News------------------------------
function news_validation()
{
	if(frm.title.value=="")
	{
		alert("Please enter the TITLE of news");
		frm.title.focus();
		return false;
	}
	if(frm.rte1.value=="")
	{
		alert("Please enter the Description of news");
		return false;
	}
}

//-------------Announcements------------------------------
function announcements_validation()
{
	if(frm.title.value=="")
	{
		alert("Please enter the TITLE of Announcement");
		frm.title.focus();
		return false;
	}
	if(frm.rte1.value=="")
	{
		alert("Please enter the Description of Announcement");
		return false;
	}
}
function faq_validation()
{
	if(frm.question.value=="") 
	{
		alert("Please enter the question");
		frm.question.focus();
		return false;
	}
	
   if(frm.rte1.value=="") 
	{
		alert("Please enter the answer");
		return false;
	}
}

function semester_subject_validation()
{
	
	if(frm.subject_id.value=="") 
	{
		alert("Please select the subject");
		frm.subject_id.focus();
		return false;
	}
	
	if(frm.subject_fees.value=="") 
	{
		alert("Please enter the subject fees");
		frm.subject_fees.focus();
		return false;
	}
}

function semester_professor_subject_validation()
{
	
	if(frm.semester_subject_id.value=="") 
	{
		alert("Please select the subject");
		frm.semester_subject_id.focus();
		return false;
	}
}