// 
function chk_length()
{
var x=document.frm2.fname.value.length;
var y=document.frm2.lname.value.length;
  if(x<=1)
  {
    document.frm2.fname1.value=document.frm2.fname.value + '%';
  }
  else
  {
    document.frm2.fname1.value=document.frm2.fname.value + '%';
  }

  if(y<=1)
  {
    document.frm2.lname1.value=document.frm2.lname.value + '%';
  }
  else
  {
    document.frm2.lname1.value=document.frm2.lname.value + '%';
  }
}


//trim function

function trim1(obj)
{
while(''+obj.value.charAt(0)==' ')
{
obj.value=obj.value.substring(1,obj.value.length);
}
//alert("|"+obj.value.charAt(obj.value.length-1)+"|");
while(''+obj.value.charAt(obj.value.length-1)==' ')
{
obj.value=obj.value.substring(0,obj.value.length-1);
}
}


//validation for tutor registration page1
function validate_tutreg1()
{
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.email);
   trim1(document.frm.password);

   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;

   if(fname=="")
        {
	alert("Incorpore El Nombre De Frist..");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
	alert("Incorpore El Nombre Pasado.." );
        document.frm.lname.focus();
	return false;
	}
	if(email=="")
	{
	alert("Incorpore la Identificación Del Email.." );
        document.frm.email.focus();
	return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("La identificación del email no es apropiada..");
     		document.frm.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Incorpore La Contraseña..");
		document.frm.password.focus();
		return false;
	 }
return true;    
}




// validation for update tutor qualification

function chk_rate3()
{
  if(document.frm.hour_rate.value!="")
  {
    if(isNaN(document.frm.hour_rate.value))
     {
      alert("Rate must be number.");
      document.frm.hour_rate.select();
      return false;
     }

    var str=document.frm.hour_rate.value;
    var pos=str.indexOf(".");

    if(!(document.frm.hour_rate.value.length==2 && pos==-1))
     {
      if(pos!=2)
       {
        alert("Enter value in this format(##.##)");
        document.frm.hour_rate.select();
        return false;
       }
      if(!(document.frm.hour_rate.value.length-2==pos-1))
       {
        alert("Enter value in this format(##.##)");
        document.frm.hour_rate.select();
        return false;
       }
     }
  }
else return true;
}


// validation for update tutor qualification

function chk_rate2()
{
if(document.frm.hour_rate.value!="")
{

     if(isNaN(document.frm.hour_rate.value))
      {
       alert("La tarifa debe ser número.");
       document.frm.hour_rate.select();
       return false;
      }
if(document.frm.hour_rate.value.length > 2)
{

//var dot=document.frm.hour_rate.charAt(0);
     if(document.frm.hour_rate.value.length != 5)
      {
       alert("La tarifa no es formato del valor ##.## del proper(enter).");
       document.frm.hour_rate.select();
       return false;
      }
    var dot=document.frm.hour_rate.value.charAt(2);

     if(dot!=".")
      {
       alert("La tarifa no es formato del valor ##.## del proper(enter).");
       document.frm.hour_rate.select();
       return false;
      }

}

}
return true;
}




// validation for update tutor qualification


function chk_rate()
{
  if(document.frm.hour_rate.value=="")
  {
   document.frm.hour_rate.value=99.99;
   return true;
  }
  if(isNaN(document.frm.hour_rate.value))
  {
   alert("Rate should be number.")
   document.frm.hour_rate.select();
   return false;
  }
if(document.frm.hour_rate.value < 0.00 || document.frm.hour_rate.value > 99.99)
  {
   alert("Value must be between 0.00 and 99.99");
   document.frm.hour_rate.select();
   return false;
  }
return true;
}







// validation for tutor search

function chk_rate_tutor()
{
  if(document.frm.hour_rate.value=="")
  {
   document.frm.hour_rate1.value=99.99;
   return true;
  }
  if(isNaN(document.frm.hour_rate.value))
  {
   alert("Rate should be number.")
   document.frm.hour_rate.select();
   return false;
  }
if(document.frm.hour_rate.value < 0.00 || document.frm.hour_rate.value > 99.99)
  {
   alert("Value must be between 0.00 and 99.99");
   document.frm.hour_rate.select();
   return false;
  }

   document.frm.hour_rate1.value=document.frm.hour_rate.value;
   return true;
}


//open browser window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//password reminder english
function pwd_reminder_sp()
{
var email=document.frm.email.value;

  if(email=="")
  {
    alert("Incorpore por favor la identificación del email." );
    document.frm.email.focus();
    return false;
  }
  if(email!="")
  {
    var space=email.indexOf(" ",0)
    var num=email.indexOf("@",0)
    var num1=email.indexOf(".",0)
    var ch=email.charAt(num+1);
    var ch1=email.charAt(num1+1);

     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 	alert("La identificación del E-mail no es apropiada.");
     		document.frm.email.select();
     		return false;
     	}
  }
return true;
}

//password reminder spanish
function pwd_reminder_en()
{
var email=document.frm.email.value;

  if(email=="")
  {
    alert("Enter your Email ID." );
    document.frm.email.focus();
    return false;
  }
  if(email!="")
  {
    var space=email.indexOf(" ",0)
    var num=email.indexOf("@",0)
    var num1=email.indexOf(".",0)
    var ch=email.charAt(num+1);
    var ch1=email.charAt(num1+1);

     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 	alert("Email ID is not proper.");
     		document.frm.email.select();
     		return false;
     	}
  }
return true;
}


//update tutor account
function update_tutorprof()
{
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;
   
   if(fname=="")
        {
	alert("Incorpore por favor el nombre.");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
	alert("Incorpore por favor el nombre pasado." );
        document.frm.lname.focus();
	return false;
	}
	if(email=="")
	{
	alert("Incorpore por favor la identificación del email." );
        document.frm.email.focus();
	return false;
	}
     if(email!="")
        {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("La identificación del E-mail no es apropiada.");
     		document.frm.email.select();
     		return false;
     	}
          
        }
	if(pwd=="")
	{
	 	alert("Incorpore por favor la contraseña.");
		document.frm.password.focus();
		return false;
	}
	if(cpwd=="")
	{
	 	alert("Confirme Por favor La Contraseña.");
		document.frm.rpassword.focus();
		return false;
	}
	if(pwd!=cpwd)
	{
	alert("La confirmación de la contraseña no es apropiada");
        document.frm.rpassword.select();
	return false;
	}
return true;    
}


//tutor registration update
function update_tutorreg()
{
  trim1(document.frm.fname);
  trim1(document.frm.lname);

  if(document.frm.fname.value=="")
  {
    alert("Enter First Name.");
    document.frm.fname.focus();
    return false;
  }
  if(document.frm.lname.value=="")
  {
    alert("Enter Last Name.");
    document.frm.lname.focus();
    return false;
  }
return true;
}

//school registration update
function update_schoolreg()
{
  trim1(document.frm.school);
  trim1(document.frm.fname);
  trim1(document.frm.lname);


  if(document.frm.school.value=="")
  {
    alert("Enter School Name.");
    document.frm.school.focus();
    return false;
  }
  if(document.frm.fname.value=="")
  {
    alert("Enter First Name.");
    document.frm.fname.focus();
    return false;
  }
  if(document.frm.lname.value=="")
  {
    alert("Enter Last Name.");
    document.frm.lname.focus();
    return false;
  }
return true;
}

// tell a friend

function tell_a_friend()
{
var email=document.frm.recipient.value;
var referrer_name=document.frm.referrer_name.value;

  if(email=="")
  {
    alert("Enter Recipient Email ID.");
    document.frm.recipient.focus();
    return false;
  }
  if(email!="")
  {
    var space=email.indexOf(" ",0);
    var num=email.indexOf("@",0);
    var num1=email.indexOf(".",0);
    var ch=email.charAt(num+1);
    var ch1=email.charAt(num1+1);
    if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    {
      alert("E-mail id is not proper..");
      document.frm.recipient.select();
      return false;
    }
  }
  if(referrer_name=="")
  {
    alert("Enter Your Name.");
    document.frm.referrer_name.focus();
    return false;
  }
 
return true;
}

//search tutor by name

function search_tutor()
{
  if(document.tutor_list.fname.value=="")
  {
    alert("Enter First Name.");
    document.tutor_list.fname.focus();
    return false;
  }
  if(document.tutor_list.lname.value=="")
  {
    alert("Enter Last Name.");
    document.tutor_list.lname.focus();
    return false;
  }
return true;
}

//validation for login page
function validate_login()
{
trim1(document.login.username);
trim1(document.login.password);
	var userid=document.login.username.value;
	var password=document.login.password.value;
	
	if(userid=="")
	{
		alert("Please enter Username.");
		document.login.username.focus();
		return false;
	}
	if(password=="")
	{
		alert("Please enter Password.");
		document.login.password.focus();
		return false;
	}
return true;
}


//validation for login page in spanish
function validate_login_sp()
{
trim1(document.login.username);
trim1(document.login.password);

	var userid=document.login.username.value;
	var password=document.login.password.value;
	
	if(userid=="")
	{
		alert("Incorpore por favor la identificación del usuario..");
		document.login.username.focus();
		return false;
	}
	if(password=="")
	{
		alert("Incorpore por favor la contraseña..");
		document.login.password.focus();
		return false;
	}
return true;
}


//validation for school registration page1
function validate_schoolreg1()
{
   trim1(document.frm.school);
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.email);
   trim1(document.frm.password);
   trim1(document.frm.rpassword);

   var school=document.frm.school.value;
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;
   
   
   if(school=="")
        {
	alert("Incorpore por favor el nombre de la escuela.");
        document.frm.school.focus();
        return false;
        }
   if(fname=="")
        {
	alert("Incorpore por favor el nombre.");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
	alert("Incorpore por favor el nombre pasado." );
        document.frm.lname.focus();
	return false;
	}
	if(email=="")
	{
	alert("Incorpore por favor la identificación del email." );
        document.frm.email.focus();
	return false;
	}
     if(email!="")
        {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("La identificación del E-mail no es apropiada.");
     		document.frm.email.select();
     		return false;
     	}
          
        }
	if(pwd=="")
	{
	 	alert("Incorpore por favor la contraseña.");
		document.frm.password.focus();
		return false;
	}
	if(cpwd=="")
	{
	 	alert("Confirme Por favor La Contraseña.");
		document.frm.rpassword.focus();
		return false;
	}
	if(pwd!=cpwd)
	{
	alert("La confirmación de la contraseña no es apropiada");
        document.frm.rpassword.select();
	return false;
	}
return true;    
}

//validation for tutor registration page1
function validate_tutorreg1()
{
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.email);
   trim1(document.frm.password);
   trim1(document.frm.rpassword);

   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;
   
   
   if(fname=="")
   if(fname=="")
        {
	alert("Incorpore por favor el nombre.");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
	alert("Incorpore por favor el nombre pasado." );
        document.frm.lname.focus();
	return false;
	}
	if(email=="")
	{
	alert("Incorpore por favor la identificación del email." );
        document.frm.email.focus();
	return false;
	}
     if(email!="")
        {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("La identificación del E-mail no es apropiada.");
     		document.frm.email.select();
     		return false;
     	}
          
        }
	if(pwd=="")
	{
	 	alert("Incorpore por favor la contraseña.");
		document.frm.password.focus();
		return false;
	}
	if(cpwd=="")
	{
	 	alert("Confirme Por favor La Contraseña.");
		document.frm.rpassword.focus();
		return false;
	}
	if(pwd!=cpwd)
	{
	alert("La confirmación de la contraseña no es apropiada");
        document.frm.rpassword.select();
	return false;
	}
return true;    
}



//validation for registration page1
function validate_reg1()
{
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.member_name);
   trim1(document.frm.email);
   trim1(document.frm.password);
   trim1(document.frm.rpassword);
   trim1(document.frm.employee_id);
   
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var member_name=document.frm.member_name.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;
   var associated=document.frm.associated_school.value;
//   var dept=document.frm.dept.value;
   var employee_id=document.frm.employee_id.value;
   
   if(fname=="")
        {
		alert("Please enter First Name..");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
		alert("Please enter Last Name.." );
        document.frm.lname.focus();
		return false;
	}
        if(member_name=="")
        {
	        alert("Please enter a Member Name..");
                document.frm.member_name.focus();
                return false;
        }
	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.frm.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.frm.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.frm.password.focus();
		return false;
	 }
	 if(cpwd=="")
	 {
	 	alert("Please Confirm Password..");
		document.frm.rpassword.focus();
		return false;
	 }
	 if(pwd!=cpwd)
	 {
	 	alert("Password confirmation is not proper..");
        document.frm.rpassword.select();
		return false;
	 }
	 if(associated!="select")
	 {
//		 if(dept=="select")
//		 {
//			alert("Select a Department..");
//			document.frm.dept.focus();
//			return false;
//		 }
		 if(dept!="select" && employee_id=="")
		 {
		 	alert("Plese enter Student or Employee ID..");
			document.frm.employee_id.focus();
			return false;
		 }
	 }
return true;    
}


//validation for registration page2
function validate_reg2()
{
   var cardType=document.frm.cc_type.value;
   var cardNum=document.frm.cc_no.value;
   var cc_exp_mm=document.frm.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.frm.cc_exp_date_yy.value;
   var add1=document.frm.billing_address_1.value;
   var city=document.frm.billing_city.value;
   var state=document.frm.billing_state.value;
   var zip=document.frm.billing_zip.value;
   var pay_pal_id=document.frm.pay_pal_id.value;
   var cc_exp_date_mm=document.frm.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.frm.cc_exp_date_yy.value;
   var phone=document.frm.tel_1.value;
   
   
  if(cardType=="")
   {
    alert("Select a Card Type..");
    document.frm.cc_type.focus();
    return false;
   }
  if(cardNum=="")
   {
     alert("Enter Card Number");
     document.frm.cc_no.focus();
     return false;
   }
  if(cc_exp_date_mm=="")
   {
    alert("Enter Card expire month..");
    document.frm.cc_exp_date_mm.focus();
    return false;
   }
  if(isNaN(cc_exp_date_mm))
   {
    alert("Month must be a number..");
    document.frm.cc_exp_date_mm.select();
    return false;
   }
  if(cc_exp_date_yy=="")
   {
    alert("Enter Card expire year..");
    document.frm.cc_exp_date_yy.focus();
    return false;
   }
  if(isNaN(cc_exp_date_yy))
   {
    alert("Year must be a number..");
    document.frm.cc_exp_date_yy.select();
    return false;
   }
  if(add1=="")
   {
    alert("You must enter your address..");
    document.frm.billing_address_1.focus();
    return false;
   }
  if(city=="")
   {
    alert("Enter City..");
    document.frm.billing_city.focus();
    return false;
   }
  if(state=="")
   {
    alert("Enter State..");
    document.frm.billing_state.focus();
    return false;
   }
  if(zip=="")
   {
    alert("Enter Postal Code..");
    document.frm.billing_zip.focus();
    return false;
   }
  if(isNaN(zip))
   {
    alert("Postal Code must be a number..");
    document.frm.billing_zip.select();
    return false;
   }
  if(isNaN(phone))
   {
    alert("Phone must be number..");
    document.frm.tel_1.select();
    return false;
   }
  if(pay_pal_id=="")
   {
    alert("Enter Pay Pal ID..");
    document.frm.pay_pal_id.focus();
    return false;
   }
return true;    
}

//validation for registration page4
function updateprof()
{

	var fname=document.frm1.fname.value;
	var lname=document.frm1.lname.value;
	var member_name=document.frm1.member_name.value;
	
	if(fname=="")
	{
		alert("Enter first name..");
		document.frm1.fname.focus();
		return false;
	}
	
	if(lname=="")
	{
		alert("Enter last name..");
		document.frm1.lname.focus();
		return false;
	}
	if(member_name=="")
	{
		alert("Enter Member Name..");
		document.frm1.member_name.focus();
		return false;
	}
return true;
}



//validation for student edit profile page
function editprof()
{
   
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var rpwd=document.frm.rpassword.value;
   
   

   if(fname=="")
        {
		alert("Please enter First Name..");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
		alert("Please enter Last Name.." );
        document.frm.lname.focus();
		return false;
	}
	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.frm.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.frm.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.frm.password.focus();
		return false;
	 }
	 if(rpwd=="")
	 {
	 	alert("Please retype Password..");
		document.frm.rpassword.focus();
		return false;
	 }
	 if(pwd != rpwd)
	 {
	 	alert("Please retype Password properly..");
		document.frm.rpassword.select();
		return false;
	 }

return true;
}


function validate_attended()
{
	var amount=document.frm.amount.value;
	var topic=document.frm.topic.value;
	
	if(amount=="")
	{
		alert("Enter Amount..");
		document.frm.amount.focus();
		return false;
	}
	if(isNaN(amount))
	{
		alert("Enter numeric value..");
		document.frm.amount.select();
		return false;
	}
	if(topic=="")
	{
		alert("Enter Amount..");
		document.frm.topic.focus();
		return false;
	}
	if(isNaN(topic))
	{
		alert("Enter numeric value..");
		document.frm.topic.select();
		return false;
	}
return true;
}




//validation for university registration page1
function validate_univreg1()
{
   trim1(document.frm.university);
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.email);
   trim1(document.frm.password);
   trim1(document.frm.rpassword);

   var university=document.frm.university.value;
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;
   
   
	 if(university=="")
	 {
	 	alert("Please Enter University..");
		document.frm.university.focus();
		return false;
	 }
   if(fname=="")
        {
		alert("Please enter First Name..");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
		alert("Please enter Last Name.." );
        document.frm.lname.focus();
		return false;
	}
	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.frm.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.frm.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.frm.password.focus();
		return false;
	 }
	 if(cpwd=="")
	 {
	 	alert("Please Confirm Password..");
		document.frm.rpassword.focus();
		return false;
	 }
	 if(pwd!=cpwd)
	 {
	 	alert("Password confirmation is not proper..");
        document.frm.rpassword.select();
		return false;
	 }
return true;    
}



//validation for university confirm order 
function update_univprof()
{
        trim1(document.frm1.university);
        trim1(document.frm1.fname);
        trim1(document.frm1.lname);


	var university=document.frm1.university.value;
	var fname=document.frm1.fname.value;
	var lname=document.frm1.lname.value;
	
	if(university=="")
	{
		alert("Enter University/Corporate name..");
		document.frm1.university.focus();
		return false;
	}
	if(fname=="")
	{
		alert("Enter first name..");
		document.frm1.fname.focus();
		return false;
	}
	
	if(lname=="")
	{
		alert("Enter last name..");
		document.frm1.lname.focus();
		return false
	}
return true;
}



//validation for university employee page
function validate_updemployee()
{
	//var employee=document.frm1.employee.value;
	var date=document.frm1.date.value;
	//var id=document.frm1.id.value;

	if(date=="")
	{
		alert("Enter Date..");
		document.frm1.date.focus();
		return false;
	}
return true;
}



//validation for university department page (upload)
function validate_upldemployee()
{
	var upload=document.frm2.upload.value;
	
	if(upload=="")
	{
	alert("Enter a Student/Employee..");
	document.frm2.upload.focus();
	return false;
	}
return true;
}

//validation for university department page
function validate_updclass()
{
	var department=document.frm1.department.value;
	var date=document.frm1.date.value;
	var child_email_id=document.frm1.child_email_id.value;
	
	if(department=="")
	{
		alert("Enter Department..");
		document.frm1.department.focus();
		return false;
	}
	if(date=="")
	{
		alert("Enter Date..");
		document.frm1.date.focus();
		return false;
	}
	if(child_email_id=="")
	{
		alert("Enter ID Number..");
		document.frm1.child_email_id.focus();
		return false;
	}
return true;
}


//validation for university department page (upload)
function validate_uplddepartment()
{
	var upload=document.frm2.upload.value;
	
	if(upload=="")
	{
	alert("Enter a Class/Department..");
	document.frm2.upload.focus();
	return false;
	}
return true;
}




//validation for university student page
function validate_updstudent()
{
	var department=document.frm1.department.value;
	var date=document.frm1.date.value;
	var child_email_id=document.frm1.child_email_id.value;
	
	if(department=="")
	{
		alert("Enter First Name ...");
		document.frm1.department.focus();
		return false;
	}
	if(date=="")
	{
		alert("Enter Last Name ...");
		document.frm1.date.focus();
		return false;
	}
	if(child_email_id=="")
	{
		alert("Enter ID Number..");
		document.frm1.child_email_id.focus();
		return false;
	}
return true;
}




//validation for department registration page1
function validate_deptreg1()
{
   trim1(document.frm.department);
   trim1(document.frm.fname);
   trim1(document.frm.lname);
   trim1(document.frm.email);
   trim1(document.frm.password);
   trim1(document.frm.rpassword);

   var department=document.frm.department.value;
   var fname=document.frm.fname.value;
   var lname=document.frm.lname.value;
   var email=document.frm.email.value;
   var pwd=document.frm.password.value;
   var cpwd=document.frm.rpassword.value;

   if(department=="")
        {
		alert("Please enter Department Name..");
        document.frm.department.focus();
        return false;
        }
   if(fname=="")
        {
		alert("Please enter First Name..");
        document.frm.fname.focus();
        return false;
        }
	if(lname=="")
	{
		alert("Please enter Last Name.." );
        document.frm.lname.focus();
		return false;
	}
	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.frm.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.frm.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.frm.password.focus();
		return false;
	 }
	 if(cpwd=="")
	 {
	 	alert("Please Confirm Password..");
		document.frm.rpassword.focus();
		return false;
	 }
	 if(pwd!=cpwd)
	 {
	 	alert("Password confirmation is not proper..");
        document.frm.rpassword.select();
		return false;
	 }
return true;    
}


//validation for department registration page2
function validate_deptreg2()
{
  trim1(document.frm.university_charge);
  var university=document.frm.university_charge.value;

  if(university=="")
  {
  alert("Enter University/Corporate Name to charge..");
  document.frm.university_charge.focus();
  return false;
  }
return true;    
}


//validation for department registration page4
function validate_updatedeptreg()
{
        trim1(document.frm1.department);
        trim1(document.frm1.fname);
        trim1(document.frm1.lname);

        var department=document.frm1.department.value;
	var fname=document.frm1.fname.value;
	var lname=document.frm1.lname.value;
	
	if(department=="")
	{
		alert("Enter Class/Department name..");
		document.frm1.department.focus();
		return false;
	}
	if(fname=="")
	{
		alert("Enter first name..");
		document.frm1.fname.focus();
		return false;
	}
	
	if(lname=="")
	{
		alert("Enter last name..");
		document.frm1.lname.focus();
		return false
	}
return true;
}




//validation for department registration page4
function validate_deptreg4()
{
   var university=document.frm.university.value;
   var cardType=document.frm.cc_type.value;
   var cardNum=document.frm.cc_no.value;
   var cc_exp_mm=document.frm.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.frm.cc_exp_date_yy.value;
   var add1=document.frm.billing_address_1.value;
   var city=document.frm.billing_city.value;
   var state=document.frm.billing_state.value;
   var zip=document.frm.billing_zip.value;
   var pay_pal_id=document.frm.pay_pal_id.value;
   var cc_exp_date_mm=document.frm.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.frm.cc_exp_date_yy.value;
   
   
  if(university=="")
  {
  alert("Enter University/Corporation name..");
  document.frm.university.focus();
  return false;
  }
  if(cardType=="" && pay_pal_id=="")
  {
  alert("Select a Card Type or Enter Pay Pal ID..");
  document.frm.cc_type.focus();
  return false;
  }
   if(cardType!="")
	{
	//alert("Select a Card Type");
	//document.studentreg2.cc_type.focus();
	//return false;
		if(cardNum=="")
		{
			alert("Enter Card Number");
			document.frm.cc_no.focus();
			return false;
		}
		if(cc_exp_date_mm=="")
		{
			alert("Enter Card expire month..");
			document.frm.cc_exp_date_mm.focus();
			return false;
		}
		if(isNaN(cc_exp_date_mm))
		{
			alert("Month must be a number..");
			document.frm.cc_exp_date_mm.select();
			return false;
		}
		if(cc_exp_date_yy=="")
		{
			alert("Enter Card expire year..");
			document.frm.cc_exp_date_yy.focus();
			return false;
		}
		if(isNaN(cc_exp_date_yy))
		{
			alert("Year must be a number..");
			document.frm.cc_exp_date_yy.select();
			return false;
		}
		 if(add1=="")
		 {
			alert("You must enter your address..");
			document.frm.billing_address_1.focus();
			return false;
		 }
		 if(city=="")
		 {
			alert("Enter City..");
			document.frm.billing_city.focus();
			return false;
		 }
		 if(state=="")
		 {
			alert("Enter State..");
			document.frm.billing_state.focus();
			return false;
		 }
		 if(zip=="")
		 {
			alert("Enter Postal Code..");
			document.frm.billing_zip.focus();
			return false;
		 }
		 if(isNaN(zip))
		 {
			alert("Postal Code must be a number..");
			document.frm.billing_zip.select();
			return false;
		 }
		 if(isNaN(phone))
		 {
			alert("Phone must be number..");
			document.frm.tel_1.select();
			return false;
		 }
  }
return true;    
}


//********************************************************************************************************//




//validation for edit_ccard page
function update_ccard()
{
	var cc_no=document.cc_update.cc_no.value;
	var exp_mm=document.cc_update.exp_mm.value;
	var exp_yy=document.cc_update.exp_yy.value;
	var fname=document.cc_update.fname.value;
	var lname=document.cc_update.lname.value;
	var billing_address_1=document.cc_update.billing_address_1.value;
	var city=document.cc_update.city.value;
	var state=document.cc_update.state.value;
	var zip=document.cc_update.zip.value;
	var phone=document.cc_update.phone.value;
	
	if(cc_no=="")
	{
		alert("Please enter Credit Card Number..");
		document.cc_update.cc_no.focus();
		return false;
	}
	if(exp_mm=="")
	{
		alert("Please enter expiration month..");
		document.cc_update.exp_mm.focus();
		return false;
	}
	if(isNaN(exp_mm))
	{
		alert("Month must be number..");
		document.cc_update.exp_mm.select();
		return false
	}
	if(isNaN(exp_yy))
	{
		alert("Year must be number..");
		document.cc_update.exp_yy.select();
		return false
	}
	if(exp_yy=="")
	{
		alert("Please enter expiration year..");
		document.cc_update.exp_yy.focus();
		return false;
	}
	if(fname=="")
	{
		alert("Enter Cardholder's first name..");
		document.cc_update.fname.focus();
		return false;
	}
	
	if(lname=="")
	{
		alert("Enter Cardholder's last name..");
		document.cc_update.lname.focus();
		return false
	}
	if(billing_address_1=="")
	{
		alert("Enter Billing Address..");
		document.cc_update.billing_address_1.focus();
		return false
	}
	if(city=="")
	{
		alert("Enter City..");
		document.cc_update.city.focus();
		return false
	}
	if(state=="")
	{
		alert("Enter State..");
		document.cc_update.state.focus();
		return false
	}
	if(zip=="")
	{
		alert("Enter Postal Code..");
		document.cc_update.zip.focus();
		return false
	}
	if(isNaN(zip))
	{
		alert("Postal Code must be number..");
		document.cc_update.zip.select();
		return false
	}
	if(isNaN(phone))
	{
		alert("Phone must be number..");
		document.cc_update.phone.select();
		return false
	}
return true;
}

//validation for university login page
function validate_university_login()
{
	var userid=document.university_login.uname.value;
	var password=document.university_login.password.value;
	
	if(userid=="")
	{
		alert("Please enter User ID..");
		document.university_login.uname.focus();
		return false;
	}
	if(password=="")
	{
		alert("Please enter Password..");
		document.university_login.password.focus();
		return false;
	}
return true;
}

//validation for university registration page


//validation for student registration page
function validate_universityreg()
{
   
   var university=document.universityreg.university.value;
   var fname=document.universityreg.fname.value;
   var lname=document.universityreg.lname.value;
   var email=document.universityreg.email.value;
   var pwd=document.universityreg.password.value;
   var cpwd=document.universityreg.rpassword.value;

   
   if(university=="")
        {
		alert("Please enter University Name..");
        document.universityreg.university.focus();
        return false;
        }
   if(fname=="")
        {
		alert("Please enter First Name..");
        document.universityreg.fname.focus();
        return false;
        }
	if(lname=="")
	{
		alert("Please enter Last Name.." );
        document.universityreg.lname.focus();
		return false;
	}
	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.universityreg.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.universityreg.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.universityreg.password.focus();
		return false;
	 }
	 if(cpwd=="")
	 {
	 	alert("Please Confirm Password..");
		document.universityreg.rpassword.focus();
		return false;
	 }
	 if(pwd!=cpwd)
	 {
	 	alert("Password confirmation is not proper..");
        document.universityreg.rpassword.select();
		return false;
	 }
return true;    
}

//validation for university registration2 page
function validate_universityreg2()
{
   var cardType=document.universityreg2.cc_type.value;
   var cardNum=document.universityreg2.cc_no.value;
   var cc_exp_date_mm=document.universityreg2.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.universityreg2.cc_exp_date_yy.value;
   var cc_exp_mm=document.universityreg2.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.universityreg2.cc_exp_date_yy.value;
   var add1=document.universityreg2.billing_address_1.value;
   var city=document.universityreg2.billing_city.value;
   var state=document.universityreg2.billing_state.value;
   var zip=document.universityreg2.billing_zip.value;
   var phone=document.universityreg2.tel_1.value;
   var pay_pal_id=document.universityreg2.pay_pal_id.value;
   
   
  if(cardType=="" && pay_pal_id=="")
  {
  alert("Select a Card Type or Enter Pay Pal ID..");
  document.universityreg2.cc_type.focus();
  return false;
  }
   if(cardType!="")
	{
	//alert("Select a Card Type");
	//document.studentreg2.cc_type.focus();
	//return false;
		if(cardNum=="")
		{
			alert("Enter Card Number");
			document.universityreg2.cc_no.focus();
			return false;
		}
		if(cc_exp_date_mm=="")
		{
			alert("Enter Card expire month..");
			document.universityreg2.cc_exp_date_mm.focus();
			return false;
		}
		if(isNaN(cc_exp_date_mm))
		{
			alert("Month must be a number..");
			document.universityreg2.cc_exp_date_mm.select();
			return false;
		}
		if(cc_exp_date_yy=="")
		{
			alert("Enter Card expire year..");
			document.universityreg2.cc_exp_date_yy.focus();
			return false;
		}
		if(isNaN(cc_exp_date_yy))
		{
			alert("Year must be a number..");
			document.universityreg2.cc_exp_date_yy.select();
			return false;
		}
		 if(add1=="")
		 {
			alert("You must enter your address..");
			document.universityreg2.billing_address_1.focus();
			return false;
		 }
		 if(city=="")
		 {
			alert("Enter City..");
			document.universityreg2.billing_city.focus();
			return false;
		 }
		 if(state=="")
		 {
			alert("Enter State..");
			document.universityreg2.billing_state.focus();
			return false;
		 }
		 if(zip=="")
		 {
			alert("Enter Postal Code..");
			document.universityreg2.billing_zip.focus();
			return false;
		 }
		 if(isNaN(zip))
		 {
			alert("Postal Code must be a number..");
			document.universityreg2.billing_zip.select();
			return false;
		 }
		 if(isNaN(phone))
		 {
			alert("Phone must be number..");
			document.universityreg2.tel_1.select();
			return false;
		 }
  }
return true;    
}

//validation for university registration4 page
function validate_universityprof()
{
	var university=document.Update_universityprof.university.value;
	var fname=document.Update_universityprof.fname.value;
	var lname=document.Update_universityprof.lname.value;
	var email=document.Update_universityprof.email.value;
	var pwd=document.Update_universityprof.password.value;
	var cpwd=document.Update_universityprof.rpassword.value;
	
	if(university=="")
	{
		alert("Enter University name..");
		document.Update_universityprof.university.focus();
		return false;
	}
	if(fname=="")
	{
		alert("Enter first name..");
		document.Update_universityprof.fname.focus();
		return false;
	}
	
	if(lname=="")
	{
		alert("Enter last name..");
		document.Update_universityprof.lname.focus();
		return false
	}

	if(email=="")
	{
		alert("Please enter Email ID.." );
        document.Update_universityprof.email.focus();
		return false;
	}
     if(email!="")
     {
		 var space=email.indexOf(" ",0)
		 var num=email.indexOf("@",0)
		 var num1=email.indexOf(".",0)
		 var ch=email.charAt(num+1);
		 var ch1=email.charAt(num1+1);
     	if(space >=0 || num < 0 || num1 < 0 || ch=="" || ch=="." || ch1 =="")
    	{
	 		alert("E-mail id is not proper..");
     		document.Update_universityprof.email.select();
     		return false;
     	}
          
     }
	 if(pwd=="")
	 {
	 	alert("Please enter Password..");
		document.Update_universityprof.password.focus();
		return false;
	 }
	 if(cpwd=="")
	 {
	 	alert("Please Confirm Password..");
		document.Update_universityprof.rpassword.focus();
		return false;
	 }
	 if(pwd!=cpwd)
	 {
	 	alert("Password confirmation is not proper..");
        document.Update_universityprof.rpassword.select();
		return false;
	 }
return true;
}


//validation for university registration4 page
function validate_universityreg4()
{
   var cardType=document.universityreg4.cc_type.value;
   var cardNum=document.universityreg4.cc_no.value;
   var cc_exp_date_mm=document.universityreg4.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.universityreg4.cc_exp_date_yy.value;
   var cc_exp_mm=document.universityreg4.cc_exp_date_mm.value;
   var cc_exp_date_yy=document.universityreg4.cc_exp_date_yy.value;
   var add1=document.universityreg4.billing_address_1.value;
   var city=document.universityreg4.billing_city.value;
   var state=document.universityreg4.billing_state.value;
   var zip=document.universityreg4.billing_zip.value;
   var phone=document.universityreg4.tel_1.value;
   var pay_pal_id=document.universityreg4.pay_pal_id.value;
   //var accept_agreement=document.universityreg4.accept_agreement.value;
   
   
  if(cardType=="" && pay_pal_id=="")
  {
  alert("Select a Card Type or Enter Pay Pal ID..");
  document.universityreg4.cc_type.focus();
  return false;
  }
   if(cardType!="")
	{
	//alert("Select a Card Type");
	//document.studentreg2.cc_type.focus();
	//return false;
		if(cardNum=="")
		{
			alert("Enter Card Number");
			document.universityreg4.cc_no.focus();
			return false;
		}
		if(cc_exp_date_mm=="")
		{
			alert("Enter Card expire month..");
			document.universityreg4.cc_exp_date_mm.focus();
			return false;
		}
		if(isNaN(cc_exp_date_mm))
		{
			alert("Month must be a number..");
			document.universityreg4.cc_exp_date_mm.select();
			return false;
		}
		if(cc_exp_date_yy=="")
		{
			alert("Enter Card expire year..");
			document.universityreg4.cc_exp_date_yy.focus();
			return false;
		}
		if(isNaN(cc_exp_date_yy))
		{
			alert("Year must be a number..");
			document.universityreg4.cc_exp_date_yy.select();
			return false;
		}
		 if(add1=="")
		 {
			alert("You must enter your address..");
			document.universityreg4.billing_address_1.focus();
			return false;
		 }
		 if(city=="")
		 {
			alert("Enter City..");
			document.universityreg4.billing_city.focus();
			return false;
		 }
		 if(state=="")
		 {
			alert("Enter State..");
			document.universityreg4.billing_state.focus();
			return false;
		 }
		 if(zip=="")
		 {
			alert("Enter Postal Code..");
			document.universityreg4.billing_zip.focus();
			return false;
		 }
		 if(isNaN(zip))
		 {
			alert("Postal Code must be a number..");
			document.universityreg4.billing_zip.select();
			return false;
		 }
		 if(isNaN(phone))
		 {
			alert("Phone must be number..");
			document.universityreg4.tel_1.select();
			return false;
		 }
		 if(accept_agreement=="")
		 {
			alert("Do you accept the agreement..");
			document.universityreg4.accept_agreement.select();
			return false;
		 }
  }
return true;    
}


//accept agreement checkbox
function agreesubmit(el)
{
var checkobj;
checkobj=el
if (document.all||document.getElementById)
	{
for (i=0;i<checkobj.form.length;i++)
		{  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
		}
	}
}

function agreesubmit2(el)
{
var checkobj;
checkobj=el
if (document.all||document.getElementById)
	{
for (i=0;i<checkobj.form.length;i++)
		{  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!(!checkobj.checked)
		}
	}
}

/*
function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}
*/

//validation for university employee page
function validate_update_employee()
{
	var employee=document.update_employees.employee.value;
	var date=document.update_employees.date.value;
	var id=document.update_employees.id.value;
	
	if(employee=="")
	{
		alert("Enter Stydent/Employee..");
		document.update_employees.employee.focus();
		return false;
	}
	if(date=="")
	{
		alert("Enter Date..");
		document.update_employees.date.focus();
		return false;
	}
	if(id=="")
	{
		alert("Enter ID Number..");
		document.update_employees.id.focus();
		return false;
	}
return true;
}

//validation for university department page (update)
function validate_upload_employee()
{
	var upload=document.upload_employees.upload.value;
	
	if(upload=="")
	{
	alert("Enter a Student/Employee..");
	document.upload_employees.upload.focus();
	return false;
	}
return true;
}


//popup window

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//school registration payment validation
function validate_tutpayment()
  {
    if(document.frm.pay_pal_id.value=="")
     {
      alert("Enter Pay Pal ID..");
      document.frm.pay_pal_id.focus();
      return false;
     }
return true;
  }