
//*****************************************************
//Created By:     	Shubhangi D
//Date Created:  	23.03.2004
//This Java script contains HTML code to add header links
//*****************************************************

function valGetQuoteForm(me)
{


if(me.order_quantity.value=="" )
		{
		alert("Please enter quantity");
		
                        me.order_quantity.focus();
		return false;

		}


            if (isInteger(me.order_quantity)==false)
                    {
                        alert("Please enter valid quantity");
                        me.order_quantity.focus();
                        return false;          
                     }

	if(me.txtName.value=="" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.txtName.focus();
		return false;
		}

		if (val_email(me.txtEmailId.value)==false)
		{
		val_email(me.txtEmailId.value);
		alert("Please enter valid email Id.");
		me.txtEmailId.focus();
		return false;
		}


            if (isInteger(me.txtContactNo)==false)
                    {
                        alert("Please enter valid contact no.");
                        me.txtContactNo.focus();
                        return false;          
                     }
		

return true;

}

/// New quick reg form with recommend inst, driving leson enquiry page. Used on default.asp AND in 2pass advt theory-test_co_uk
function val2pass_quick_reg_form(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 15;

      
       //Checking for the Postcode validation
		
      	 
		if(me.user_name.value=="" || me.user_name.value=="User Name" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}
        if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}
		
		if (me.password.value=="" || me.password.value=="password")
		{
		alert("Please enter password.");	 
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}
		
        if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

	
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id2.value=="")
		{
		alert("Please re-enter email id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same email id, your email id are not matching .");
		me.email_id2.focus();
		return false;
		}
				
		if(me.post_code.value=="" || me.post_code.value=="Post Code")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}		
		
		if(me.f_name.value=="" || me.f_name.value=="First Name")
		{
		alert("Please enter first name.");
		me.f_name.value="";
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		//Mobile validation
		
  
        if(me.mobile_no.value =="")
		{
		alert("Please enter mobile number.");
		me.mobile_no.focus();
		return false;
		}
	
		if(me.mobile_no.value !="")
		{
		 
		    if (checkUKTelephone(me.mobile_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile_no.focus();
		        return false;
		    }
    			
		}
		
		//Landline validation

         if (me.landline_no.value == '')
            {
                alert("Please enter landline no.");
                me.landline_no.focus();
                return false;
            }
            
            if (isInteger(me.landline_no)==false)
                    {
                        alert("Please enter valid landline number.");
                        me.landline_no.focus();
                        return false;          
                     }
		
		
	 
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;			
		}
		
	    //Confirming for the user name and password
		var strpassword=me.password.value
		var strshow_password='**'+(strpassword.substring(2,strpassword.length))
		
		if (me.post_code.type == "hidden")
		{
		    var strconfirmval=confirm('your user name is: '+ me.user_name.value +'\n and your password is: '+ strshow_password +'\n Press OK to continue. ')
		}
		else
		{
		    var strconfirmval=confirm(' your user name is: '+ me.user_name.value +',\n your password is: '+ strshow_password +'\n and your email is : '+ me.email_id.value + '\n\n Press OK to continue. ')
		}
        if (strconfirmval==true)
        {
            return true;
        }
        else
        {
            return false;
        }
        //end of confirmation
	return true; 
}
//val2pass ends

//function added to validate the recommend instructor form 28-june-07
function validaterecommend_inst(me)
	{
         var minLength = 6; // Minimum length of password & login id
        var maxLength = 40;
        
        if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}
        
        if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		
        if(me.inst_name.value=="")
		{
		alert("Please enter instructor/driving school name.");
		me.inst_name.focus();
		return false;
		}

		
         if (me.inst_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.inst_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.inst_name.value) !=true)
		{
		alert ("Your instructor name/school name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.inst_name.focus();
		return false;
		}
		
		//validating post code
	     if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		me.post_code.focus();
		return false;
		} 
      //validating mobile no
		if(me.mobile_no.value =="")
		{
		alert("Please enter mobile number.");
		me.mobile_no.focus();
		return false;
		}
	
		if(me.mobile_no.value !="")
		{
		 
		    if (checkUKTelephone(me.mobile_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile_no.focus();
		        return false;
		    }
    		
		   		
		}
			//Validation email id
		if(me.email_id.value=="")
		{
		    alert("Please enter email id.");
		    me.email_id.focus();
		    return false;
		}
		if (val_email(me.email_id.value)==false)
		{
		    val_email(me.email_id.value);
		    alert("Please enter valid Email Id.");
		    me.email_id.focus();
		    return false;
		} 		
		//validation for telephone number
		
		if(me.tel_no.value =="")
		{
		alert("Please enter telephone number.");
		me.tel_no.focus();
		return false;
		}
			
			if (isInteger(me.tel_no.value)==false)
            {
                alert("Please enter valid telephone number.");
                me.tel_no.focus();
                return false;          
             }	 		
		
			
		if(me.message.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message.focus();
		return false;
		}
	
		
 	return true;  
	}



//function added to validate the driving info page (lesson_enquiry_info)after clicking yes to floating bar.
function validateDrvInfoform(me)
	{
         var minLength = 6; // Minimum length of password & login id
         var maxLength = 15;
        
       	if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}

		
         if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
	      
      
		if(me.tel_no.value =="")
		{
		alert("Please enter mobile number.");
		me.tel_no.focus();
		return false;
		}
	
		
		if(me.tel_no.value !="")
		{
		 
		    if (checkUKTelephone(me.tel_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.tel_no.focus();
		        return false;
		    }
    		
		    if (me.tel_no.value.length > maxLength)
		    {
		        alert('Telephone no should not be more than ' + maxLength +' characters');
		        me.tel_no.focus();
		        return false;
		    }
		
		}
		
		if(me.landline_no.value =="")
		{
		alert("Please enter landline number.");
		me.landline_no.focus();
		return false;
		}
			
			if (isInteger(me.landline_no.value)==false)
            {
                alert("Please enter valid landline number.");
                me.landline_no.focus();
                return false;          
             }	 		
			 		
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		 
		me.post_code.focus();
		return false;
		}
		//validate date
		if(me.tentative_lesson_start_date.value=="")
		{
		alert("Please enter tentative lesson start date.");
		me.tentative_lesson_start_date.focus();
		return false;
		}
		if(me.vehicle_type.value=="0")
		{
		alert("Please select a vehicle type.");
		me.vehicle_type.focus();
		return false;
		}		
		 if(me.Vehicle_catg_for_lesson.value=="0")
		{
		alert("Please select a vehicle category for lesson.");
		me.Vehicle_catg_for_lesson.focus();
		return false;
		}		
     
	     if(me.inst_gender_preferred.value=="0")
		{
		alert("Please select a instructor gender preference.");
		me.inst_gender_preferred.focus();
		return false;
		}	
		
		//message  if (me.f_name.value.length > maxLength)
		if(me.message.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message.focus();
		return false;
		}
 	return true;  
	}
/** validateDrvInfoform ends here**/


//function added to validate the driving inst enquiry form 14-May-07
function validateEnqForm(me)
	{
         var minLength = 6; // Minimum length of password & login id
        var maxLength = 15;
        
        
        if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}

		
         if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
	      
      
		if(me.tel_no.value =="")
		{
		alert("Please enter mobile number.");
		me.tel_no.focus();
		return false;
		}
	
		
		if(me.tel_no.value !="")
		{
		 
		    if (checkUKTelephone(me.tel_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.tel_no.focus();
		        return false;
		    }
    		
		    if (me.tel_no.value.length > maxLength)
		    {
		        alert('Telephone no should not be more than ' + maxLength +' characters');
		        me.tel_no.focus();
		        return false;
		    }
		
		}
				 		
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}
		
			//message  if (me.f_name.value.length > maxLength)
		if(me.message.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message.focus();
		return false;
		}
	
		
 	return true;  
	}

//trimming functions start
function ltrim(argvalue) {

  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}

function rtrim(argvalue) {

  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }

  return argvalue;
}

function trim(argvalue) {
  var tmpstr = ltrim(argvalue);

  return rtrim(tmpstr);

}


// trimming functions end

//function added to validate the driving inst enquiry form 14-May-07
function validateDrvEnqform(me)
	{
         var minLength = 6; // Minimum length of password & login id
        var maxLength = 15;
        
        
        if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}

		
         if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		
        
        if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		
		if(me.tel_no.value =="")
		{
		alert("Please enter mobile number.");
		me.tel_no.focus();
		return false;
		}
	
		
		if(me.tel_no.value !="")
		{
		 
		    if (checkUKTelephone(me.tel_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.tel_no.focus();
		        return false;
		    }
    		
		    if (me.tel_no.value.length > maxLength)
		    {
		        alert('Telephone no should not be more than ' + maxLength +' characters');
		        me.tel_no.focus();
		        return false;
		    }
		
		}
				 		
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}
		
			//message  if (me.f_name.value.length > maxLength)
		if(me.message.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message.focus();
		return false;
		}
	
		
 	return true;  
	}

/** validateDrvEnqform ends here**/


//Added by Rohit on 11-Apr for driving instructor page

function validatepost_code(me)
{
		//Checking for the Postcode validation
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		if (validate_postcode(me.post_code.value) !=true)
		{
		
		alert("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}
		return true;
}


function validate_postcode(valpost_code)
{     
     
     
     var matchArray =/^[\w]{1,8}(( |-)[\w]{1,4})?$/;
     if(valpost_code.match(matchArray) == null)  
     {
          return false; 
     }
          else
     {
          return true;          
     }
        
     
}

// Newly added functions

//function added to validate the cd_registration form 19.06.06
function validateCdRegform(me)
	{

        var minLength = 6; // Minimum length of password & login id
        var maxLength = 15;

		if(me.name.value=="")
		{
		alert("Please enter user name.");
		me.name.focus();
		return false;
		}

//		if (me.name.value.length < minLength || me.name.value.length > maxLength) 
//		{
//		alert('Your user name must be at least ' + minLength + ' characters long and must be less than' + maxLength + ' characters.');
//		me.name.focus();
//		return false;
//		}

		// check for spaces invalid chars
		if (validateChars(me.name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.name.focus();
		return false;
		}

    	if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		//validate alternate_email_id if any		
		//if (me.alternate_email_id.value != "")
		//{
		if (me.alternate_email_id.value!="" )
		{
		       if (val_email(me.alternate_email_id.value)==false)
		        {
		        val_email(me.alternate_email_id.value);
		        alert("Please enter valid alternate Email Id.");
		        me.alternate_email_id.focus();
		        return false;
		        }
        		
		        if (me.alternate_email_id.value.length > 50)
		        {
		        alert('Email Id should not be more than 50 characters');
		        me.alternate_email_id.focus();
		        return false;
		        }
		  }
		//}
		
		if (me.street.value !=" ")
		{
		if (validateChars(me.street.value)!=true)
		{
		        alert("Please enter valid Street name.");
		        me.street.focus();
		        return false;
		       
		}
		}
		if (me.city.value !=" ")
		{
		if (validateChars(me.city.value)!=true)
		{
		        alert("Please enter valid City name.");
		        me.city.focus();
		        return false;
		       
		}
		}
			
		if(me.post_code.value !=" ")
		{
		        if (checkInternationalPhone(me.post_code.value) !=true)
		        {
		        alert("Please enter valid Post code.");
		        me.post_code.focus();
		        return false;
		        }
        		
		        if (me.post_code.value.length > 8)
		        {
		        alert('post_code should not be more than ' + 8 +' characters');
		        me.post_code.focus();
		        return false;
		        }		
		}
		
		if(me.tel_no.value !=" ")
		{
		        if (checkInternationalPhone(me.tel_no.value) !=true)
		        {
		        alert("Please enter valid telephone no.");
		        me.tel_no.focus();
		        return false;
		        }
        		
		        if (me.tel_no.value.length > maxLength)
		        {
		        alert('Telephone no should not be more than ' + maxLength +' characters');
		        me.tel_no.focus();
		        return false;
		        }		
		}
		
		return true;  
	}

/** validateCdRegform ends here**/



//function for validating user edit_profile form
function validateEditProfileform(me)
	{

	var minLength = 6; // Minimum length of password & login id
	var maxLength = 15;

		 
		if (me.password.value=="")
		{
		alert("Please enter the Old password.");
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}
 
		 		
		if( me.password2.value.length!=0)
				 
		{


			if (me.password2.value.length < minLength || me.password2.value.length > maxLength)  
			{
			alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
			me.password2.focus();
			return false;
			}
	
			// check for spaces invalid chars
			if (validateChars(me.password2.value) !=true)
			{
			alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
			me.password2.focus();
			return false;
			}

       		}	



		if (me.password2.value != me.password3.value)
		{
		alert("Please re-enter the same New password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

		
          if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
				
		if (me.email_id2.value=="")
		{
		alert("Please re-enter Email Id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same Email Id, your Email Ids are not matching .");
		me.email_id2.focus();
		return false;
		}

		if(me.pwd_reminder_ans.value=="")
		{
		alert("Please enter password  reminder answer.");
		me.pwd_reminder_ans.focus();
		return false;
		}
		if (me.pwd_reminder_ans.value.length > maxLength)
		{
		alert('Password  reminder answer should not be more than ' + maxLength +' characters');
		me.pwd_reminder_ans.focus();
		return false;
		}
		
		 
		if (validateChars(me.pwd_reminder_ans.value) !=true)
		{
		alert ("Your password reminder answer has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.pwd_reminder_ans.focus();
		return false;
		}
		
		if(me.mnuTheoryTestPlannedTime.value=="0")
		{
		alert("Please select planned time for the theory test.");
		me.mnuTheoryTestPlannedTime.focus();
		return false;
		}
		
		
             
             if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}

		
         if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		
		
		if(me.surname.value=="")
		{
		alert("Please enter last name.");
		me.surname.focus();
		return false;
		}
		if (me.surname.value.length > maxLength)
		{
		alert('Last name should not be more than ' + maxLength +' characters');
		me.surname.focus();
		return false;
		}
		
		// check for spaces invalid chars
		if (validateChars(me.surname.value) !=true)
		{
		alert ("Your last name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.surname.focus();
		return false;
		}

		if(me.tel_no.value !=" ")
		{
		if (checkInternationalPhone(me.tel_no.value) !=true)
		{
		alert("Please enter valid telephone no.");
		me.tel_no.focus();
		return false;
		}
		
		if (me.tel_no.value.length > maxLength)
		{
		alert('Telephone no should not be more than ' + maxLength +' characters');
		me.tel_no.focus();
		return false;
		}
		
		}		
	return true;  
	}
	
	
//function for validating Instructor registration form
function validateInstructRegform(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 30;


		
		/*if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}*/

		if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		
		
		/*if(me.l_name.value=="")
		{
		alert("Please enter last name.");
		me.l_name.focus();
		return false;
		}*/
		if (me.l_name.value.length > maxLength)
		{
		alert('Last name should not be more than ' + maxLength +' characters');
		me.l_name.focus();
		return false;
		}
		
		// check for spaces invalid chars
		if (validateChars(me.l_name.value) !=true)
		{
		alert ("Your last name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.l_name.focus();
		return false;
		}

		if(me.mobile.value !="")
		{
		    if (checkUKTelephone(me.mobile.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile.focus();
		        return false;
		    }
    		
		    if (me.mobile.value.length > maxLength)
		    {
		        alert('Telephone no should not be more than ' + maxLength +' characters');
		        me.mobile.focus();
		        return false;
		    }
		
		}
		if(me.email_id.value=="")
		{
		alert("Please enter email id.");
		me.email_id.focus();
		return false;
		}
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
			

//		if(me.drive_sch.value=="")
//		{
//		alert("Please enter driving school name.");
//		me.drive_sch.focus();
//		return false;
//		}
		if (me.drive_sch.value.length > 50)
		{
		alert('Driving school name should not be more than 50 characters');
		me.drive_sch.focus();
		return false;
		}
		
		// check for spaces invalid chars
		if (validateChars(me.drive_sch.value) !=true)
		{
		alert ("Your driving school name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.drive_sch.focus();
		return false;
		}		
		
		if (me.texdrive_sch_desc.value.length > 500)
		{
		alert('Driving school descrption should not be more than 500 characters');
		me.texdrive_sch_desc.focus();
		return false;
		}
		if (me.driving_school_radio.checked)
		{
		var instructor_count= document.getElementById ("intstructno")
		if(instructor_count.value=="")
		{
		alert('Please enter the instructor count.');
		instructor_count.focus();
		return false;
		}
		
		if (isInteger(instructor_count.value)==false)
            {
                alert("Please enter valid number.");
                instructor_count.focus();
                return false;          
             }
		}
		/*if(me.county.value.indexOf("default")!=-1)
		{
		alert("Please select county.");
		me.county.focus();
		return false;
		}*/
		/*if(me.bank_no.value=="")
		{
		alert("Please enter bank account number.");
		me.bank_no.focus();
		return false;
		}
		if (me.bank_no.value.length > maxLength)
		{
		alert('Bank account number should not be more than ' + maxLength +' characters');
		me.bank_no.focus();
		return false;
		}*/
		
		// check for spaces invalid chars
//		if (validateChars(me.bank_no.value) !=true)
//		{
//		alert ("Your bank account number has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
//		me.bank_no.focus();
//		return false;
//		}		
//		
//		if(me.bank_code.value=="")
//		{
//		alert("Please enter bank sort code.");
//		me.bank_code.focus();
//		return false;
//		}
//		if (me.bank_code.value.length > maxLength)
//		{
//		alert('Bank sort code should not be more than ' + maxLength +' characters');
//		me.bank_code.focus();
//		return false;
//		}
//		
//		// check for spaces invalid chars
//		if (validateChars(me.bank_code.value) !=true)
//		{
//		alert ("Your bank sort code has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
//		me.bank_code.focus();
//		return false;
//		}	

       
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}

		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		return false;
		}


	return true;  
	}
//function for checking the instructor count

function get_instr_count(me,sender)
{
var tr= document.getElementById ("tr_instruct")
var instructor_count= document.getElementById ("intstructno")
if (sender=='instructor')
{
         { tr.style.display='none';
		    return false;
         }
}
else
{
        if(tr.style.display=='none') 
        {   
		    tr.style.display='inline';
		    instructor_count.focus();
		    return false;
		}
}

}

//function for validating login form
function validatelogin(me)
	{
			if(me.login.value=="")
		{
		alert("User name is required.");
		me.login.focus();
		return false;
		}
		if(me.password.value=="")
		{
		alert("Password is required.");
		me.password.focus();
		return false;
		}
	return true;
	}

//function for validating contact email form
function validate_email_form(me)
	{
	   
		if(me.name.value=="")
		{
		alert("Please enter name.");
		me.name.focus();
		return false;
		}
		
		
	if (validateChars(me.name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.name.focus();
		return false;
		}
		if (isInteger(me.name.value)==true)
            {
                alert("Please enter valid name.");
                me.name.focus();
                return false;          
             }
		if(me.tel_no.value !=" ")
		{
			if (checkInternationalPhone(me.tel_no.value) !=true)
			{
			alert("Please enter valid telephone no.");
			me.tel_no.focus();
			return false;
			}
		}
				
		if (val_email(me.email_id.value)==false)
		{
	 
		    alert("Please enter valid email Id.");
		    me.email_id.focus();
		    return false;
		 }
			
		 if (me.message.value.length == "")
	        {
	            alert("Please enter the message.");
                me.message.focus();
                return false;
	        }
	        
	      if (me.message.value.length > 3990)
	        {
	            alert("Message exceed the limit.");
                me.message.focus();
                return false;
	        }
	return true;  
	}

//function for validating tell a friend email form
function validate_tell_friend_form(me)
	{
		if(me.name.value=="")
		{
		alert("Please enter name.");
		me.name.focus();
		return false;
		}
		
		if (val_email(me.email_id.value)==false)
		{
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		var frnd_mail = me.friend_email_id.value;
		var arr_mail = frnd_mail.split(";");
		var i;
		for(i=0;i<arr_mail.length;i++)
		{
		  
	 
		    if (val_email(trim(arr_mail[i].toString()))==false)
		    {
		    alert("Please enter valid Email Id of your friend.");
		    me.friend_email_id.focus();
		    return false;
		    }
		}
		
	return true;  
	}


//function for validating tell a friend email form
function validate_book_order_form(me)
	{
		if(me.name.value=="")
		{
		alert("Please enter name1.");
		 
		me.name.focus();
		return false;
		}
		
		if (val_email(me.email_id.value)==false)
		{
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
	 
	if ((!me.ChkHighwayCode.checked) && (!me.ChkTTBook.checked))
	{
		alert("Please select atleast one book.");
		return false;
	}
	
		
	return true;  
	}

//function for validating tell a friend email form ends
	
//function for validating email form form
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;



function validateChars(str)
{
var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";	
  for (var i = 0; i < str.length; i++) {
  	if (iChars.indexOf(str.charAt(i)) != -1) {
  	  	return false;
  	}
  	
  }
  return true;
}
////




  //added on 10 may 
function validatename(str)
{
var iChars = "0123456789";	
  for (var i = 0; i < str.length; i++) {
  	if (iChars.indexOf(str.charAt(i)) != -1) {
  	  	return false;
  	}
  	
  }
  return true;
}
///////


//function for validating quick user registration form
function validatequickRegformindex(me)
	{


var minLength = 6; // Minimum length of password & login id
var maxLength = 15;



		if(me.user_name.value=="")
		{
		alert("Please enter user name.");
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}

		
		if (me.password.value=="")
		{
		alert("Please enter password.");
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}


		if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
				
		if (me.email_id2.value=="")
		{
		alert("Please re-enter Email Id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same Email Id, your Email Ids are not matching .");
		me.password2.focus();
		return false;
		}
		if(me.post_code.value=="")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}
		if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}
        
		if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length < 3)
		{
		alert('First name should not be less than 3 characters');
		me.f_name.focus();
		return false;
		}

     if(!validatename(me.f_name.value))
		{
		alert("Numbers not allowed in first name.");
		me.f_name.focus();
		return false;
		}

		
		
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}		
       
        if (checkUKTelephone(me.tel_no.value) !=true)
	    {
	    alert (telNumberErrors[telNumberErrorNo]);
	    me.tel_no.focus();
	    return false;
	    }
		
		if (me.tel_no.value.length > maxLength)
		{
		alert('Mobile no should not be more than ' + maxLength +' characters');
		me.tel_no.focus();
		return false;
		}
	
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		}
	return true; 
}




  //added on 10 may 
function validatename(str)
{
var iChars = "0123456789";	
  for (var i = 0; i < str.length; i++) {
  	if (iChars.indexOf(str.charAt(i)) != -1) {
  	  	return false;
  	}
  	
  }
  return true;
}
///////


	////postcode validation function//////
	    function validate_post_code(test,me)
		{ //check postcode format is valid
         //test = document.details.pcode.value; 
         size = test.length
         
         test = test.toUpperCase(); //Change to uppercase
         while (test.slice(0,1) == " ") //Strip leading spaces
          {test = test.substr(1,size-1);size = test.length
          }
         while(test.slice(size-1,size)== " ") //Strip trailing spaces
          {test = test.substr(0,size-1);size = test.length
          }
         //document.details.pcode.value = test; //write back to form field
         if (size < 6 || size > 8){ //Code length rule
          alert(test + " is not a valid postcode - wrong length");
          me.post_code.focus();
          return false;
          }
         if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
           alert(test + " is not a valid postcode - cannot start with a number");
           me.post_code.focus();
           return false;
          }
         if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
           alert(test + " is not a valid postcode - alpha character in wrong position");
           me.post_code.focus();
           return false;
          }
         if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
           alert(test + " is not a valid postcode - number in wrong position");
           me.post_code.focus();
           return false;
          }
         if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
           alert(test + " is not a valid postcode - number in wrong position");
           me.post_code.focus();
           return false;
          }
         if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
           alert(test + " is not a valid postcode - no space or space in wrong position");
           me.post_code.focus();
           return false;
           }
         count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
         if (count1 != count2){//only one space rule
           alert(test + " is not a valid postcode - only one space allowed");
           me.post_code.focus();
           return false;
          }
        //alert("Postcode Format OK");
        return true;
        }
	

//function for validating quick user registration form
function validatequickRegform(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 15;

       
       //Checking for the Postcode validation
		
       
				    
		if(me.user_name.value=="" || me.user_name.value=="User Name" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}

		
		if (me.password.value=="" || me.password.value=="password")
		{
		alert("Please enter password.");
		//me.password.value="";
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}

	
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
				
		if(me.post_code.value=="" || me.post_code.value=="Post Code")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_postcode(me.post_code.value) !=true)
		{
		alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}		
		
		if(me.f_name.value=="" || me.f_name.value=="First Name")
		{
		alert("Please enter first name.");
		me.f_name.value="";
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}
				
		
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		}
	    //Confirming for the user name and password
		var strpassword=me.password.value
		var strshow_password='**'+(strpassword.substring(2,strpassword.length))
		
		if (me.post_code.type == "hidden")
		{
		    var strconfirmval=confirm('your user name is: '+ me.user_name.value +'\n and your password is: '+ strshow_password +'\n Press OK to continue. ')
		}
		else
		{
		    var strconfirmval=confirm(' your user name is: '+ me.user_name.value +',\n your password is: '+ strshow_password +'\n and your email is : '+ me.email_id.value + '\n\n Press OK to continue. ')
		}
        if (strconfirmval==true)
        {
            return true;
            }
        else
            {
            return false;
        }
        //end of confirmation
	return true; 
}

function funsetval(strid, strvalue)
{   
     if(document.getElementById(strid).value == "" ) 
     {
         document.getElementById(strid).value = strvalue
     }

}

function emptypost_code()
{ 
   if(document.getElementById("post_code").value == "Post Code" ) 
   {
     funsetval("user_name","User Name")
     funsetval("password1","password")
     funsetval("email_id","Email Id")
     funsetval("f_name","First Name")
     document.getElementById("post_code").value = "" 
    }
}

function emptyuser_name()
{ 
   if(document.getElementById("user_name").value == "User Name" ) 
   {
     funsetval("post_code","Post Code")
     funsetval("password1","password")
     funsetval("email_id","Email Id")
     funsetval("f_name","First Name")
     document.getElementById("user_name").value = "" 
    }
}
function emptypassword()
{   
  if(document.getElementById("password1").type ="password" ) 
   {
     funsetval("post_code","Post Code")
     funsetval("user_name","User Name")
     funsetval("email_id","Email Id")
     funsetval("f_name","First Name")
     document.getElementById("password1").value = "" 
   }
}
function emptyemail_id()
{   
   if(document.getElementById("email_id").value == "Email Id" ) 
   {
     funsetval("post_code","Post Code")
     funsetval("user_name","User Name")
     funsetval("password1","password")
     funsetval("f_name","First Name")
     document.getElementById("email_id").value = "" 
   }
}
function emptyfirst_name()
{   
   if(document.getElementById("f_name").value == "First Name" ) 
   {
     funsetval("post_code","Post Code")
     funsetval("user_name","User Name")
     funsetval("password1","password")
     funsetval("email_id","Email Id")
     document.getElementById("f_name").value = "" 
    }
}

function funCat()
{
    
     funsetval("post_code","Post Code")
     funsetval("user_name","User Name")
     funsetval("password1","password")
     funsetval("email_id","Email Id")
     funsetval("f_name","First Name")
}

function funimg()
{
     document.getElementById('regsubmit').focus()
}







////
//function for validating user registration form
function validateRegform(me)
	{



var minLength = 6; // Minimum length of password & login id
var maxLength = 15;



		if(me.user_name.value=="")
		{
		alert("Please enter user name.");
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}

		
		if (me.password.value=="")
		{
		alert("Please enter password.");
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}


		if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid Email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
				
		if (me.email_id2.value=="")
		{
		alert("Please re-enter Email Id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same Email Id, your Email Ids are not matching .");
		me.password2.focus();
		return false;
		}

		if(me.pwd_reminder_ans.value=="")
		{
		alert("Please enter password  reminder answer.");
		me.pwd_reminder_ans.focus();
		return false;
		}
		if (me.pwd_reminder_ans.value.length > maxLength)
		{
		alert('Password  reminder answer should not be more than ' + maxLength +' characters');
		me.pwd_reminder_ans.focus();
		return false;
		}
		
		// check for spaces invalid chars
		if (validateChars(me.pwd_reminder_ans.value) !=true)
		{
		alert ("Your password reminder answer has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.pwd_reminder_ans.focus();
		return false;
		}
		
		if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}

		if(me.mnuTheoryTestPlannedTime.value=="0")
		{
		alert("Please select planned time for the theory test.");
		me.mnuTheoryTestPlannedTime.focus();
		return false;
		}
		
		if(me.f_name.value=="")
		{
		alert("Please enter first name.");
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('First name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		
		
		if(me.surname.value=="")
		{
		alert("Please enter last name.");
		me.surname.focus();
		return false;
		}
		if (me.surname.value.length > maxLength)
		{
		alert('Last name should not be more than ' + maxLength +' characters');
		me.surname.focus();
		return false;
		}
		
		// check for spaces invalid chars
		if (validateChars(me.surname.value) !=true)
		{
		alert ("Your last name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.surname.focus();
		return false;
		}

		if(me.tel_no.value !=" ")
		{
		if (checkInternationalPhone(me.tel_no.value) !=true)
		{
		alert("Please enter valid telephone no.");
		me.tel_no.focus();
		return false;
		}
		
		if (me.tel_no.value.length > maxLength)
		{
		alert('Telephone no should not be more than ' + maxLength +' characters');
		me.tel_no.focus();
		return false;
		}
		
		}
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		}


	return true;  
	}

//function for validating phone number

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) );
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

//validating email id
function val_email(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
var iChars = "!#$%^&*()+=[]\\\';,/{}|\":<>?";
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false;
		 }
	 
		  for (var i = 0; i < str.length; i++) 
	      {	  
	
			if (iChars.indexOf(str.charAt(i)) != -1) 
			{
			   return false;			
			}
	
	       }
		 		
 		return true;	
	}


//function for validating user id 
function forgot_pwd(me)
{
		if(me.user_id.value=="")
		{
		alert("Please enter user name.");
		me.user_id.focus();
		return false;
		}
		return true;
	}


//function for validating password answer
function pwd_reminder(me)
{

		if(me.pwd_ans.value=="")
		{
		alert("Please enter password hint answer.");
		me.pwd_ans.focus();
		return false;
		}
		return true;
	}

//function for opening the new window
 
function openNewWin(url)
{
//	alert('Now you will see questions in the new window.\nPlease be patient as this may take a minute.'); 
    var hWnd = window.open(url,"","width=925,height=700,left=0,top=0,resizable=yes,status=yes,scrollbars=yes");
   	if ((document.window != null) && (!hWnd.opener))
    hWnd.opener = document.window;
}



//function for fetching the selected values in the multiple selection combo box 
function ComboSelectList(lobj)
{
	var str ="";
	var i;
	
	var obj = document.getElementById(lobj);
	
	//If the first item, All, is selected make sure all others are not
	
	if ( !obj.options[0].selected )
	{		
		for (i = 1; i<obj.length; i++ )
			{
			if ( obj.options[i].selected )		
				str = str  + obj.options[i].value + ",";	
			}
		// if no menu is selected then select all
			if (str=="")		
				{
				for (i = 1; i<obj.length; i++ )
				str = str  + obj.options[i].value + ",";									
				}
	
	}
	else
	{	
		for (i = 1; i<obj.length; i++ )
			str = str  + obj.options[i].value + ","  ;
	}
return str.substring(0, str.length-1) ;			

} 



//function for redirection timer
function redirectionTimer(strURL,intTime) 
{
redirectionTime = intTime;
redirectionURL = strURL;
self.setTimeout("self.location.href = redirectionURL;",redirectionTime); 
 }
//  ends here



//Enlarging the image in new window
//features - New window adjusts ifself for height & height of the passed image path
//window get closed when user clicks outside the window.

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 200;
defaultHeight = 200;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

//image button link 
function goToURL(strURL)
{ 
	window.location = strURL; 
}


//Please note: This interface is only compatible with Internet Explorer version 5.5 and higher. 
// Browser Detection

function browserDetect()
{
isWindows =  (navigator.appVersion.indexOf("Win")!=-1)  ? true : false;
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;

isWindows = (navigator.appVersion.indexOf("Mac")!=-1) ? false : true;
isWindows =  (navigator.appVersion.indexOf("Mac")!=-1)  ? false : true;
isWindows =  (navigator.appVersion.indexOf("X11")!=-1)  ? false : true;
isWindows =  (navigator.appVersion.indexOf("Linux")!=-1)  ? false : true;

//IE on Mac
IEmac = ((document.all)&&(isMac)) ? true : false;

//Detect NetScape
isNetscape=false;
if (navigator.appVersion.indexOf("Netscape")!=-1)
isNetscape=true;

//Advance detection ,following is not used in code
//NS4 = (document.layers) ? true : false;
//NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1)
{
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
}
var strMessage;

strMessage = "<table class='tborder' cellpadding=4 cellspacing=0>";
strMessage = strMessage + "<tr bgcolor=red><td><font color =white><b>Please note</b></font> </td></tr>";
strMessage = strMessage + "<tr><td>Theory-test.co.uk is currently optimized for <b>Windows Internet Explorer 5.5 and higher.</b><br>";
strMessage = strMessage + "If you are using Macintosh or older version of IE or any other type of browsers (e.g. Netscape,Opera etc),";
strMessage = strMessage + "<br>please make sure that you can access free questions before using our paid service.<br>";
strMessage = strMessage + "<br>If you find difficulty accessing free questions,<a href ='http://www.microsoft.com/windows/ie/default.mspx'  target ='_blank'>click here</a> to upgrade to the latest version of Internet Explorer(IE).";
strMessage = strMessage + "</td></tr></table>";


if ((!isWindows) || (IEmac) || (version<=5.4) || (isNetscape))
{	
	return strMessage;
}
	return "";
	
}

	//Function for validating the URL 
//function valURL(valChk)
//{     
//      var matchArray = "/^http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$/";
//     if(valChk.match(matchArray) == null)  
//     {
//        return false;             
//     }
//    
//     return true;
//     
//}
//Validation function for the add_web_links.asp page
function validateadd_links(me)
	{
		if(me.txtsite_title.value=="")
		{
		alert("Site title is required.");
		me.txtsite_title.focus();
		return false;
		}
					
		if(me.txtyour_url.value=="")
		{
		alert("Your URL is required.");
		me.txtyour_url.focus();
		return false;
		}
//		if (valURL(me.txtyour_url.value)==false)
//		{
//		valURL(me.txtyour_url.value);
//		alert("Please enter valid URL.");
//		me.txtyour_url.focus();
//		return false;
//		}
		
		if (me.txtdescription.value.length > 250)
		{
		alert('Description should not be more than 250 characters');
		me.txtdescription.focus();
		return false;
		}
		if(me.txtdescription.value=="")
		{
		alert("Description is required.");
		me.txtdescription.focus();
		return false;
		}
		if(me.txtour_url.value=="")
		{
		alert("Our URL link is required.");
		me.txtour_url.focus();
		return false;
		}
		
		if(me.txtemail.value=="")
		{
		alert("Email id is required.");
		me.txtemail.focus();
		return false;
		}
	    if (me.txtemail.value.length > 50)
		{
		alert('Email id should not be more than 50 characters');
		me.txtemail.focus();
		return false;
		}
		if (val_email(me.txtemail.value)==false)
		{
		val_email(me.txtemail.value);
		alert("Please enter valid Email Id.");
		me.txtemail.focus();
		return false;
		}
		
	return true;
	}  

function admin_validateadd_links(me)
	{
		if(me.txtsite_title.value=="")
		{
		alert("Site title is required.");
		me.txtsite_title.focus();
		return false;
		}
					
		if(me.txtyour_url.value=="")
		{
		alert("Your URL is required.");
		me.txtyour_url.focus();
		return false;
		}
//		if (valURL(me.txtyour_url.value)==false)
//		{
//		valURL(me.txtyour_url.value);
//		alert("Please enter valid URL.");
//		me.txtyour_url.focus();
//		return false;
//		}
		
		if (me.txtdescription.value.length > 250)
		{
		alert('Description should not be more than 250 characters');
		me.txtdescription.focus();
		return false;
		}
		if(me.txtdescription.value=="")
		{
		alert("Description is required.");
		me.txtdescription.focus();
		return false;
		}
		
		
		
		
	return true;
	}  




function validateUnsubscribe(me)
{
var minLength = 6; // Minimum length of password & login id
var maxLength = 30;


		if(me.user_name.value=="")
		{
		alert("Please enter user name.");
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}
		
        if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}

}






function checkUKTelephone (telephoneNumber) {

    // Convert into a string and check that we were provided with something
    var telnum = telephoneNumber + " ";
    if (telnum.length == 1)  {
    telNumberErrorNo = 1;
    return false;
    }
    telnum.length = telnum.length - 1;

    // Don't allow country codes to be included (assumes a leading "+")
    var exp = /^(\+)[\s]*(.*)$/;
    if (exp.test(telnum) == true) {
    telNumberErrorNo = 2;
    return false;
    }

    // Remove spaces from the telephone number to help validation
    if (rtrim(telnum).indexOf(" ")!= -1)  
    {
    telNumberErrorNo = 5;
    return false;
     }

    // Remove spaces from the telephone number to help validation
    while (telnum.indexOf(" ")!= -1)  {
    telnum = telnum.slice (0,telnum.indexOf(" ")) + telnum.slice (telnum.indexOf(" ")+1)
    }

  // Remove hyphens from the telephone number to help validation
    if (telnum.indexOf("-")!= -1)
    {
    telNumberErrorNo = 5;
    return false;
    }
    


    // Remove hyphens from the telephone number to help validation
    while (telnum.indexOf("-")!= -1)  {
    telnum = telnum.slice (0,telnum.indexOf("-")) + telnum.slice (telnum.indexOf("-")+1)
    }  

    // Now check that all the characters are digits
    exp = /^[0-9]{11}$/
    if (exp.test(telnum) != true) {
    telNumberErrorNo = 3;
    return false;
    }

    // Now check that the first digit is 0
    exp = /^0[0-9]{10,11}$/
    if (exp.test(telnum) != true) {
    telNumberErrorNo = 4;
    return false;
    }

    // Finally check that the telephone number is appropriate.
    exp = /^(01|02|03|05|070|077|07624|078|079)[0-9]+$/;
    if (exp.test(telnum) != true) {
    telNumberErrorNo = 5;
    return false;
    }

    // Telephone number seems to be valid - return the stripped telehone number  
    return true;
    }
    var telNumberErrorNo = 0;
    var telNumberErrors = new Array ();
    telNumberErrors[0] = "Valid UK mobile number";
    telNumberErrors[1] = "Please enter mobile number";
    telNumberErrors[2] = "Please remove country code";
    telNumberErrors[3] = "Enter valid mobile number- should contain 11 digits and should start with zero. ";
    telNumberErrors[4] = "The mobile number should start with a 0";
    telNumberErrors[5] = "The mobile number is either invalid or inappropriate";







//function for validating recommend a driving school div on the driving instructor listing page.
function validate_recommend_school(me)
	{
	
		if(me.name.value=="")
		{
		alert("Please enter name.");
		me.name.focus();
		return false;
		}
		
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if(me.school_name.value=="")
		{
		alert("Please enter driving school name.");
		me.school_name.focus();
		return false;
		}
		if(me.message.value=="")
		{
		alert("Please enter driving school address.");
		me.message.focus();
		return false;
		}
//		if (valURL(me.website_url.value)==false)
//		{
//		valURL(me.website_url.value);
//		alert("Please enter valid URL.");
//		me.website_url.focus();
//		return false;
//		}
	return true;  
	}


//date validation dd/mm/yyyy
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;
 
function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dateStr) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("Date is not in a valid format.")
return false;
}
month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];
if (year > 2070)
{
alert("Please enter valid year");
return false;
}
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!")
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
return false;
   }
}
return true;  // date is valid
}


/// 04-Oct-07
//Modified version of val2pass_quick_reg_form
//reg form with recommend inst, driving leson enquiry page. Used on default.asp 
//The valiadtions for lesson enquiry and the recomm inst have been removed 
function valpass_quick_reg_form_no_comp(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 15;

      
       //Checking for the Postcode validation
		
      			    
		if(me.user_name.value=="" || me.user_name.value=="User Name" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}
        if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}
		
		if (me.password.value=="" || me.password.value=="password")
		{
		alert("Please enter password.");
		//me.password.value="";
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}
        if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

	
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id2.value=="")
		{
		alert("Please re-enter email id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same email id, your email id are not matching .");
		me.email_id2.focus();
		return false;
		}
				
		if(me.post_code.value=="" || me.post_code.value=="Post Code")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}		
		
		if(me.f_name.value=="" || me.f_name.value=="First Name")
		{
		alert("Please enter first name.");
		me.f_name.value="";
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		//Mobile validation
		
  
        if(me.mobile_no.value =="")
		{
		alert("Please enter mobile number.");
		me.mobile_no.focus();
		return false;
		}
	
		if(me.mobile_no.value !="")
		{
		 
		    if (checkUKTelephone(me.mobile_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile_no.focus();
		        return false;
		    }
    			
		}
		
		//Landline validation

         if (me.landline_no.value == '')
            {
                alert("Please enter landline no.");
                me.landline_no.focus();
                return false;
            }
            
            if (isInteger(me.landline_no)==false)
                    {
                        alert("Please enter valid landline number.");
                        me.landline_no.focus();
                        return false;          
                     }
		
		
		//Now if no radio button is clicked the further validation will carry on
		
		if(me.radio_no.checked)
		{
		    if (me.t_start_date.value !="")
		    {
			    if (isDate(me.t_start_date.value) !=true)

                    {
                    alert("Please enter valid tentative lesson start date.");
                    me.t_start_date.focus();
                    return false;
                    }
            
           	}
	     
            if (me.message.value.length > 250)
		    {
		    alert('Message should not be more than 250 characters');
		    me.message.focus();
		    return false;
		    }
		
		
		}
		else
		{
        //When radio button yes is clicked then the below validations will be checked.		
		
		 	if(( document.getElementById("tr_no").style.display=='none') && (document.getElementById("tr_yes").style.display=='inline')){      	
         if (me.inst_name.value.length > 50)
		{
		alert('Name should not be more than 50 characters');
		me.inst_name.focus();
		return false;
		}
		
			// check for spaces invalid chars
		if (validateChars(me.inst_name.value) !=true)
		{
		alert ("Your instructor name/school name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.inst_name.focus();
		return false;
		}
		
		//validating instructors post code
	    if (me.postcode.value !="")
	    {		
		if (validate_post_code(me.postcode.value,me) !=true)
		{
		me.postcode.focus();
		return false;
		} 
		}
      //validating  instructors mobile no
		
	
		if(me.mobileno.value !="")
		{
		 
		    if (checkUKTelephone(me.mobileno.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobileno.focus();
		        return false;
		    }    		
		   		
		}
			//Validation  instructors email id
		if(me.emailid.value !="")
		{
		if (val_email(me.emailid.value)==false)
		{
		    val_email(me.emailid.value);
		    alert("Please enter valid Email Id.");
		    me.emailid.focus();
		    return false;
		} 	
		}	
		//validation for instructors telephone number
		
					
			if (isInteger(me.telno.value)==false)
            {
                alert("Please enter valid telephone number.");
                me.telno.focus();
                return false;          
             }	 		
		
			
		if(me.message_text.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message_text.focus();
		return false;
		}
		/*if (me.inst_name.value=="")
		{
		
		    var strconfirmval= confirm('You have not recommended any instructor.\n Click ok to continue, cancel to recommend instructor\n ')
		    if (strconfirmval==false)
            {
            me.inst_name.focus();
            return false;
            }
        }*/
       
      
     
        //my if ends
        
		
		}
	}			
		
				
		
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		
		
		}
	    //Confirming for the user name and password
		var strpassword=me.password.value
		var strshow_password='**'+(strpassword.substring(2,strpassword.length))
		
		if (me.post_code.type == "hidden")
		{
		    var strconfirmval=confirm('your user name is: '+ me.user_name.value +'\n and your password is: '+ strshow_password +'\n Press OK to continue. ')
		}
		else
		{
		    var strconfirmval=confirm(' your user name is: '+ me.user_name.value +',\n your password is: '+ strshow_password +'\n and your email is : '+ me.email_id.value + '\n\n Press OK to continue. ')
		}
        if (strconfirmval==true)
        {
            return true;
            }
        else
            {
            return false;
        }
        //end of confirmation
	return true; 
}
//Modified function ends




/// 04-Oct-07
//Modified version of val2pass_quick_reg_form
//reg form with recommend inst, driving leson enquiry page. Used on default.asp 
//The valiadtions for lesson enquiry and the recomm inst have been removed 
function valpass_quick_reg_form_no_comp1(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 15;
 
if(me.radio_yes.checked) // Recommend inst YES
		{
		 
		 if(me.inst_name.value!="" )
		{
		 if (me.inst_name.value.length > 50)
		{
		alert('Name should not be more than 50 characters');
		me.inst_name.focus();
		return false;
		}
		
	    // check for spaces invalid chars
		if (validateChars(me.inst_name.value) !=true)
		{
		alert ("Your instructor name/school name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.inst_name.focus();
		return false;
		}

		}//inst not null 
		
	    if (me.postcode.value=="")
		{
		alert('Please enter the instructor post code');
		me.postcode.focus();
		return false;
		}
		//validating instructors post code
	    if (me.postcode.value !="")
	    {		
		if (validate_post_code(me.postcode.value,me) !=true)
		{
		me.postcode.focus();
		return false;
		} 
		}
		
		//Validation  instructors email id
		if(me.emailid.value !="")
		{
		    if (val_email(me.emailid.value)==false)
		    {
		        val_email(me.emailid.value);
		        alert("Please enter valid Email Id.");
		        me.emailid.focus();
		        return false;
		    } 	
		}	
      //validating  instructors mobile no
		
	
		if(me.mobileno.value !="")
		{
		 
		    if (checkUKTelephone(me.mobileno.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobileno.focus();
		        return false;
		    }    		
		   		
		}
		
		//validation for instructors telephone number	
					
			if (isInteger(me.telno.value)==false)
            {
                alert("Please enter valid telephone number.");
                me.telno.focus();
                return false;          
             }	 
             
            if( me.mobileno.value =="" && 	me.telno.value == "")
            {
                alert("Please enter instrcutor's either mobile no or landline no.");               
                return false;   
            }	
		
			
		if(me.message_text.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message_text.focus();
		return false;
		}
            
        }
        if(me.radio_lesson_yes.checked) // Lesson enq YES
		{
		    /*if(me.VehicleCatg.value == 0)
		    {
		    alert('Please select vehicle category');
		    me.VehicleCatg.focus();
		    return false;
		    }
		    
		    if(me.instructor_pref.value == 0)
		    {
		    alert('Please select instructor preference');
		    me.instructor_pref.focus();
		    return false;
		    }
		    
		     
		    if(me.vehicle_type.value == 0)
		    {
		    alert('Please select vehicle type');
		    me.vehicle_type.focus();
		    return false;
		    }
		    
		    if (me.t_start_date.value !="")
		    {   
			    if (isDate(me.t_start_date.value) !=true)

                    {
                    alert("Please enter valid tentative lesson start date.");
                    me.t_start_date.focus();
                    return false;
                    }
            
           	}
           	
           	if (me.message.value.length > 250)
		    {
		        alert('Message should not be more than 250 characters');
		        me.message.focus();
		        return false;
		    }
		  
*/
  if (me.t_start_date.value !="")
		    {   
			    if (isDate(me.t_start_date.value) !=true)

                    {
                    alert("Please enter valid tentative lesson start date.");
                    me.t_start_date.focus();
                    return false;
                    }
            
           	}
           	

		}//ends if(me.radio_lesson_yes.checked)
      
       //Checking for the Postcode validation
		
      			    
		if(me.user_name.value=="" || me.user_name.value=="User Name" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}
        if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}
		
		if (me.password.value=="" || me.password.value=="password")
		{
		alert("Please enter password.");
		//me.password.value="";
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}
        if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

	
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id2.value=="")
		{
		alert("Please re-enter email id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same email id, your email id are not matching .");
		me.email_id2.focus();
		return false;
		}
				
		if(me.post_code.value=="" || me.post_code.value=="Post Code")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}		
		
		if(me.f_name.value=="" || me.f_name.value=="First Name")
		{
		alert("Please enter first name.");
		me.f_name.value="";
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		//Mobile validation
		
  
        if(me.mobile_no.value =="")
		{
		alert("Please enter mobile number.");
		me.mobile_no.focus();
		return false;
		}
	
		if(me.mobile_no.value !="")
		{
		 
		    if (checkUKTelephone(me.mobile_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile_no.focus();
		        return false;
		    }
    			
		}
		
		//Landline validation

         if (me.landline_no.value == '')
            {
                alert("Please enter landline no.");
                me.landline_no.focus();
                return false;
            }
            
            if (isInteger(me.landline_no)==false)
                    {
                        alert("Please enter valid landline number.");
                        me.landline_no.focus();
                        return false;          
                     }
		
 
 	
		
			 
		
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		
		
		}
	    //Confirming for the user name and password
		var strpassword=me.password.value
		var strshow_password='**'+(strpassword.substring(2,strpassword.length))
		
		if (me.post_code.type == "hidden")
		{
		    var strconfirmval=confirm('your user name is: '+ me.user_name.value +'\n and your password is: '+ strshow_password +'\n Press OK to continue. ')
		}
		else
		{
		    var strconfirmval=confirm(' your user name is: '+ me.user_name.value +',\n your password is: '+ strshow_password +'\n and your email is : '+ me.email_id.value + '\n\n Press OK to continue. ')
		}
        if (strconfirmval==true)
        {
            return true;
            }
        else
            {
            return false;
        }
        //end of confirmation
	return true; 
}
//val2pass ends

/// 04-Oct-07
//Modified version of val2pass_quick_reg_form
//reg form with recommend inst, driving leson enquiry page. Used on default.asp 
//The valiadtions for lesson enquiry and the recomm inst have been removed 
function valpass_quick_reg_form_no_comp12(me)
	{

var minLength = 6; // Minimum length of password & login id
var maxLength = 15;
 
if(me.radio_yes.checked) // Recommend inst YES
		{
		 
		 if(me.inst_name.value!="" )
		{
		 if (me.inst_name.value.length > 50)
		{
		alert('Name should not be more than 50 characters');
		me.inst_name.focus();
		return false;
		}
		
	    // check for spaces invalid chars
		if (validateChars(me.inst_name.value) !=true)
		{
		alert ("Your instructor name/school name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.inst_name.focus();
		return false;
		}

		}//inst not null 
		
	    if (me.postcode.value=="")
		{
		alert('Please enter the instructor post code');
		me.postcode.focus();
		return false;
		}
		//validating instructors post code
	    if (me.postcode.value !="")
	    {		
		if (validate_post_code(me.postcode.value,me) !=true)
		{
		me.postcode.focus();
		return false;
		} 
		}
		
		//Validation  instructors email id
		if(me.emailid.value !="")
		{
		    if (val_email(me.emailid.value)==false)
		    {
		        val_email(me.emailid.value);
		        alert("Please enter valid Email Id.");
		        me.emailid.focus();
		        return false;
		    } 	
		}	
      //validating  instructors mobile no
		
	
		if(me.mobileno.value !="")
		{
		 
		    if (checkUKTelephone(me.mobileno.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobileno.focus();
		        return false;
		    }    		
		   		
		}
		
		//validation for instructors telephone number	
					
			if (isInteger(me.telno.value)==false)
            {
                alert("Please enter valid telephone number.");
                me.telno.focus();
                return false;          
             }	 
             
            if( me.mobileno.value =="" && 	me.telno.value == "")
            {
                alert("Please enter instrcutor's either mobile no or landline no.");               
                return false;   
            }	
		
			
		if(me.message_text.value.length > 255)
		{
		alert("Message should not be more than 255 characters.");
		me.message_text.focus();
		return false;
		}
            
        }
        if(me.radio_lesson_yes.checked) // Lesson enq YES
		{
		    /*if(me.VehicleCatg.value == 0)
		    {
		    alert('Please select vehicle category');
		    me.VehicleCatg.focus();
		    return false;
		    }
		    
		    if(me.instructor_pref.value == 0)
		    {
		    alert('Please select instructor preference');
		    me.instructor_pref.focus();
		    return false;
		    }
		    
		     
		    if(me.vehicle_type.value == 0)
		    {
		    alert('Please select vehicle type');
		    me.vehicle_type.focus();
		    return false;
		    }
		    
		    if (me.t_start_date.value !="")
		    {   
			    if (isDate(me.t_start_date.value) !=true)

                    {
                    alert("Please enter valid tentative lesson start date.");
                    me.t_start_date.focus();
                    return false;
                    }
            
           	}
           	
           	if (me.message.value.length > 250)
		    {
		        alert('Message should not be more than 250 characters');
		        me.message.focus();
		        return false;
		    }
		  
*/
  if (me.t_start_date.value !="")
		    {   
			    if (isDate(me.t_start_date.value) !=true)

                    {
                    alert("Please enter valid tentative lesson start date.");
                    me.t_start_date.focus();
                    return false;
                    }
            
           	}
           	

		}//ends if(me.radio_lesson_yes.checked)
      
       //Checking for the Postcode validation
		
      			    
		if(me.user_name.value=="" || me.user_name.value=="User Name" )
		{
		alert("Please enter user name.");
		//me.user_name.value=""
		me.user_name.focus();
		return false;
		}

		if (me.user_name.value.length < minLength || me.user_name.value.length > maxLength) 
		{
		alert('Your user name must be at least ' + minLength + ' characters long and must be less than ' + maxLength + ' characters.');
		me.user_name.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.user_name.value) !=true)
		{
		alert ("Your user name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.user_name.focus();
		return false;
		}
        if(me.mnuVehicleCatg.value=="0")
		{
		alert("Please select a vehicle category.");
		me.mnuVehicleCatg.focus();
		return false;
		}
		
		if (me.password.value=="" || me.password.value=="password")
		{
		alert("Please enter password.");
		//me.password.value="";
		me.password.focus();
		return false;
		}

		if (me.password.value.length < minLength || me.password.value.length > maxLength)  
		{
		alert('Your password must be at least ' + minLength + ' characters long and be less than' + maxLength + ' characters.');
		me.password.focus();
		return false;
		}

		// check for spaces invalid chars
		if (validateChars(me.password.value) !=true)
		{
		alert ("Your password has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.password.focus();
		return false;
		}
        if (me.password2.value=="")
		{
		alert("Please re-enter password.");
		me.password2.focus();
		return false;
		}

		if (me.password.value != me.password2.value)
		{
		alert("Please re-enter the same password, your passwords are not matching .");
		me.password2.focus();
		return false;
		}

	
		if (val_email(me.email_id.value)==false)
		{
		val_email(me.email_id.value);
		alert("Please enter valid email Id.");
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id.value.length > 50)
		{
		alert('Email Id should not be more than 50 characters');
		me.email_id.focus();
		return false;
		}
		
		if (me.email_id2.value=="")
		{
		alert("Please re-enter email id.");
		me.email_id2.focus();
		return false;
		}

		if (me.email_id.value != me.email_id2.value)
		{
		alert("Please re-enter the same email id, your email id are not matching .");
		me.email_id2.focus();
		return false;
		}
				
		if(me.post_code.value=="" || me.post_code.value=="Post Code")
		{
		alert("Please enter postcode.");
		me.post_code.focus();
		return false;
		}
		
		if (validate_post_code(me.post_code.value,me) !=true)
		{
		//alert ("Enter valid postcode.");
		me.post_code.focus();
		return false;
		}		
		
		if(me.f_name.value=="" || me.f_name.value=="First Name")
		{
		alert("Please enter first name.");
		me.f_name.value="";
		me.f_name.focus();
		return false;
		}

		if (me.f_name.value.length > maxLength)
		{
		alert('Name should not be more than ' + maxLength +' characters');
		me.f_name.focus();
		return false;
		}
				
		// check for spaces invalid chars
		if (validateChars(me.f_name.value) !=true)
		{
		alert ("Your first name has special characters or spaces. \nThese are not allowed.\n Please remove them and try again.");
		me.f_name.focus();
		return false;
		}
		//Mobile validation
		
  
        if(me.mobile_no.value =="")
		{
		alert("Please enter mobile number.");
		me.mobile_no.focus();
		return false;
		}
	
		if(me.mobile_no.value !="")
		{
		 
		    if (checkUKTelephone(me.mobile_no.value) !=true)
		    {
		        alert (telNumberErrors[telNumberErrorNo]);
		        me.mobile_no.focus();
		        return false;
		    }
    			
		}
		
		//Landline validation

         if (me.landline_no.value == '')
            {
                alert("Please enter landline no.");
                me.landline_no.focus();
                return false;
            }
            
            if (isInteger(me.landline_no)==false)
                    {
                        alert("Please enter valid landline number.");
                        me.landline_no.focus();
                        return false;          
                     }
		
 
 	
		
		 
		
		if (!me.agree.checked)
		{
		alert("You need to agree with the terms & conditions before proceeding ahead.");
		me.agree.focus();
		return false;
		
		
		}
	    //Confirming for the user name and password
		var strpassword=me.password.value
		var strshow_password='**'+(strpassword.substring(2,strpassword.length))
		
		if (me.post_code.type == "hidden")
		{
		    var strconfirmval=confirm('your user name is: '+ me.user_name.value +'\n and your password is: '+ strshow_password +'\n Press OK to continue. ')
		}
		else
		{
		    var strconfirmval=confirm(' your user name is: '+ me.user_name.value +',\n your password is: '+ strshow_password +'\n and your email is : '+ me.email_id.value + '\n\n Press OK to continue. ')
		}
        if (strconfirmval==true)
        {
            return true;
            }
        else
            {
            return false;
        }
        //end of confirmation
	return true; 
}
//val2pass ends

