function checkemail(emailobj) 
{
	//pass form object
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailobj.value))
	{
		return (true)
	}
		alert("Invalid e-mail address.");
	return (false);
}


function ckhform()
{

  if(document.form3.firstName.value==0 || document.form3.firstName.value==null)
	 {
		alert("Enter the first name.");
		document.form3.firstName.focus();
		return false;
	  }
	  if(document.form3.firstName.value!="")
	 {
	   if(!isAlphabet(document.form3.firstName.value))
	   {
	    alert("Enter the alphabet");
		document.form3.firstName.value="";
		document.form3.firstName.focus();
		return false;
		}
	  }
	  if(document.form3.lastName.value==0 || document.form3.lastName.value==null)
	 {
	   	alert("Enter the lastName.");
		document.form3.lastName.focus();
		return false;
		
	  }
	   if(document.form3.lastName.value!="")
	 {
	   if(!isAlphabet(document.form3.lastName.value))
	   {
		alert("Enter the alphabet.");
		document.form3.lastName.value="";
		document.form3.lastName.focus();
		return false;
		}
	  }
	 
  if(document.formm.userName.value==0 || document.formm.userName.value==null )
  {
    alert("Enter the user name.");
	document.formm.userName.focus();
	return false;
  }
 if(document.formm.userName.value.length > 15)
 {
	alert("User name cannot be more than 15 characters.");
	document.formm.userName.focus();
	return false
 }
    
	if(document.form3.passUser.value==0 || document.form3.passUser.value==null)
  {
    alert("Provide appropriate password.");
	document.form3.passUser.focus();
	return false;
  }
   if(document.form3.passUser.value.length < 6)
  {
    alert("Password must have atleast six characters.");
	document.form3.passUser.focus();
	return false;
  }
  if(document.form3.confirm1.value==0 || document.form3.confirm1.value==null)
  {
    alert("Provide password again similar to password.");
	document.form3.confirm1.focus();
	return false;
  }
   if(document.form3.passUser.value!=document.form3.confirm1.value)
  {
    alert("Password and confirm password don't match.");
	document.form3.passUser.value="";
	document.form3.confirm1.value="";
	document.form3.passUser.focus();
	return false;
  }
  
/*if(document.form3.cellNo.value!=null || document.form3.cellNo.value!=0 || document.form3.cellNo.value!="")
{
		if(!IsPhoneNumber(document.form3.cellNo.value))
		{
		   alert("Enter the numeric cell number.");
		   document.form3.cellNo.value="";
		   document.form3.cellNo.focus()
		   return false
		}
		 // sText=document.form3.cellNo.value;
		var ValidCharacter = "0123456789";
	   	//var IsNumber=true;
	   	var charlength=document.form3.cellNo.value;
	   	var Character;
		var totalchar=0;
		for (j = 0; j < charlength.length ; j++) 
		{ 
			Character = charlength.charAt(j); 
			if (ValidCharacter.indexOf(Character) == -1) 
			{
							
			}
			else
			{
				totalchar=totalchar+1;
			}
		}
	
	
	if(totalchar>10 || totalchar<10)
	{
		alert("Enter the number upto 10 digits");
		   document.form3.cellNo.value="";
		   document.form3.cellNo.focus();
		return false;
	
	}	  
 		  /*if(sText.length < 10)
		  {
			alert("Cell number must have atleast 10 digits.");
			document.form3.cellNo.focus()
			return false
		  
		  }
}*/
if(document.form3.cellNo.value!="") {
	if(!IsPhoneNumber(document.form3.cellNo.value)) {
		alert("Enter the numeric cell number.");
		document.form3.cellNo.value="";
		document.form3.cellNo.focus()
		return false;
	}
	else {
		// starts here
		//pass cell number to check
		var ValidCharacter = "0123456789";
		//var IsNumber=true;
		var charlength=document.form3.cellNo.value;
		var Character;
		var totalchar=0;
		for (j = 0; j < charlength.length ; j++) { 
			Character = charlength.charAt(j); 
			if (ValidCharacter.indexOf(Character) == -1) {
			}
			else {
				totalchar=totalchar+1;
			}
		}
		if(totalchar>10 || totalchar<10) {
			alert("Enter the number upto 10 digits");
			document.form3.cellNo.value="";
			document.form3.cellNo.focus()
			return false;
		}
	  //Ends here
				  
		var my_car=document.form3.cellNo.value;
		var the_length=my_car.length;
		var last_char=my_car.charAt(the_length-1);
				  
		
        var frst_string=document.form3.cellNo.value.substring(0,1);
		
		if(frst_string=="8" || frst_string=="4" || frst_string=="6" || frst_string=="9") {
			var extension=document.form3.cellNo.value.substring(0,3);
			extension=parseInt(extension);
				//var PhoneExt =['<?php echo $extPh; ?>'];
					
			if(extension=="888" ||  extension=="800" ||  extension=="877"  ||  extension=="866" ||  extension=="416" || extension=="647" || extension=="905") {			

				var fourth_char=document.form3.cellNo.value.substring(3,4);
								
				if(fourth_char=="-" || fourth_char=="(" ) {
					var next_char=document.form3.cellNo.value.substring(4,5);
					if(next_char=="0" || next_char=="1") {
						alert("Cell number is not valid.");
						document.form3.cellNo.focus()
						return false;
					}
				}
				else {
					if(fourth_char=="0" || fourth_char=="1") {
						alert("Cell number is not valid.");
						document.form3.cellNo.focus()
						return false;
					}
				}
			}
			else {
				alert("Cell number is not valid.");
				document.form3.cellNo.focus()
				return false;
			}
		}
		else
		{
		
			var frst_string_1=document.form3.cellNo.value.substring(0,1);
			//alert(frst_string_1);
			if(frst_string_1=="(") {
				var extension_1=document.form3.cellNo.value.substring(1,4);
				extension_1=parseInt(extension_1);
				
				if(extension_1=="888" ||  extension_1=="800" ||  extension_1=="877"  ||  extension_1=="866" ||  extension_1=="416" || extension_1=="647" || extension_1=="905") {
 					var my_car=document.form3.cellNo.value;
					var the_length=my_car.length;
					var last_char=my_car.charAt(the_length-1);
					var fif=document.form3.cellNo.value.substring(4,5);
					if(last_char==")" || fif==")") {
						if(fif!=")") {
							if(fif=="-" || fif=="(") {
								var next_char=document.form3.cellNo.value.substring(5,6);
								if(next_char=="0" || next_char=="1") {
								//alert("part1");
									alert("Cell number is not valid.");
									document.form3.cellNo.focus()
									return false;
								}
							}
							else {
								var next_char=document.form3.cellNo.value.substring(4,5);
								if(next_char=="0" || next_char=="1") {
								//alert("part2");
									alert("Cell number is not valid.");
									document.form3.cellNo.focus()
									return false;
								}
							}
						}
						else {
							var fif_char=document.form3.cellNo.value.substring(5,6);
							if(fif_char=="-" || fif=="(") {
								var next_char=document.form3.cellNo.value.substring(6,7);
								if(next_char=="0" || next_char=="1") {
								//alert("part3");
									alert("Cell number is not valid.");
									document.form3.cellNo.focus()
									return false;
								}
							}
							else {
								if(fif_char=="0" || fif_char=="1") {
								//alert("part4");
										alert("Cell number is not valid.");
										document.form3.cellNo.focus()
										return false;
								}
							}
						}
					 }
					 else {
					 	alert("The number should end by ).");
						document.form3.cellNo.focus()
						return false;
					}
				}
				else {
				//alert("part5");
					alert("Cell number is not valid.");
					document.form3.cellNo.focus()
					return false;
				}
			}
			else {
					alert("Cell number is not valid.");
					document.form3.cellNo.focus()
					return false;
			}
		}
	}
} 

	
  if(document.form3.emailAddress.value==0 || document.form3.emailAddress.value==null)
  {
    alert("Enter the email address.");
	document.form3.emailAddress.focus()
	return false
  }
   if(!checkemail(document.form3.emailAddress))
  {
	document.form3.emailAddress.focus()
	return false;
  }
  if(document.form3.alt_emailAddress.value!=null && document.form3.alt_emailAddress.value!=0)
  {
			  
			   if(!checkemail(document.form3.alt_emailAddress))
			  {
				document.form3.alt_emailAddress.focus()
				return false;
			  }
  }
    //if(document.form3.streetAddress1.value==0 || document.form3.streetAddress1.value==null)
  //{
   // alert("Enter The Street Address");
	//document.form3.streetAddress1.focus()
	//return false
  //}
  
  if(document.form3.country.value=="" || document.form3.country.value==null || document.form3.country.value==0)
  {
    alert("Select the country.");
	document.form3.country.focus();
	return false;
  }
  
  
  if(document.form3.state.value=="")
  {
    alert("Select the state.");
	document.form3.state.focus();
	return false;
  }
  
  
  
  // postal check
  if(document.form3.zip.value!="")
  {
	   if(!checkPost(document.form3.zip.value))
	  {
		document.form3.zip.focus()
		return false;
	  }
  
  }
  // end of postal check.....
  // Phone Number Check Start here

if(document.form3.phoneNumber.value!="") {
	if(!IsPhoneNumber(document.form3.phoneNumber.value)) {
		alert("Enter the numeric phone number.");
		document.form3.phoneNumber.value="";
		document.form3.phoneNumber.focus()
		return false;
	}
	else {
		// starts here
		//pass phone number to check
		var ValidCharacter = "0123456789";
		//var IsNumber=true;
		var charlength=document.form3.phoneNumber.value;
		var Character;
		var totalchar=0;
		for (j = 0; j < charlength.length ; j++) { 
			Character = charlength.charAt(j); 
			if (ValidCharacter.indexOf(Character) == -1) {
			}
			else {
				totalchar=totalchar+1;
			}
		}
		if(totalchar>10 || totalchar<10) {
			alert("Enter the number upto 10 digits");
			document.form3.phoneNumber.value="";
			document.form3.phoneNumber.focus()
			return false;
		}
	  //Ends here
				  
		var my_car=document.form3.phoneNumber.value;
		var the_length=my_car.length;
		var last_char=my_car.charAt(the_length-1);
				  
		
        var frst_string=document.form3.phoneNumber.value.substring(0,1);
		
		if(frst_string=="8" || frst_string=="4" || frst_string=="6" || frst_string=="9") {
			var extension=document.form3.phoneNumber.value.substring(0,3);
			extension=parseInt(extension);
				//var PhoneExt =['<?php echo $extPh; ?>'];
					
			if(extension=="888" ||  extension=="800" ||  extension=="877"  ||  extension=="866" ||  extension=="416" || extension=="647" || extension=="905") {			

				var fourth_char=document.form3.phoneNumber.value.substring(3,4);
								
				if(fourth_char=="-" || fourth_char=="(" ) {
					var next_char=document.form3.phoneNumber.value.substring(4,5);
					if(next_char=="0" || next_char=="1") {
						alert("Home phone number is not valid.");
						document.form3.phoneNumber.focus()
						return false;
					}
				}
				else {
					if(fourth_char=="0" || fourth_char=="1") {
						alert("Home phone number is not valid.");
						document.form3.phoneNumber.focus()
						return false;
					}
				}
			}
			else {
				alert("Home phone number is not valid.");
				document.form3.phoneNumber.focus()
				return false;
			}
		}
		else
		{
		
			var frst_string_1=document.form3.phoneNumber.value.substring(0,1);
			//alert(frst_string_1);
			if(frst_string_1=="(") {
				var extension_1=document.form3.phoneNumber.value.substring(1,4);
				extension_1=parseInt(extension_1);
				
				if(extension_1=="888" ||  extension_1=="800" ||  extension_1=="877"  ||  extension_1=="866" ||  extension_1=="416" || extension_1=="647" || extension_1=="905") {
 					var my_car=document.form3.phoneNumber.value;
					var the_length=my_car.length;
					var last_char=my_car.charAt(the_length-1);
					var fif=document.form3.phoneNumber.value.substring(4,5);
					if(last_char==")" || fif==")") {
						if(fif!=")") {
							if(fif=="-" || fif=="(") {
								var next_char=document.form3.phoneNumber.value.substring(5,6);
								if(next_char=="0" || next_char=="1") {
								//alert("part1");
									alert("Home phone number is not valid.");
									document.form3.phoneNumber.focus()
									return false;
								}
							}
							else {
								var next_char=document.form3.phoneNumber.value.substring(4,5);
								if(next_char=="0" || next_char=="1") {
								//alert("part2");
									alert("Home phone number is not valid.");
									document.form3.phoneNumber.focus()
									return false;
								}
							}
						}
						else {
							var fif_char=document.form3.phoneNumber.value.substring(5,6);
							if(fif_char=="-" || fif=="(") {
								var next_char=document.form3.phoneNumber.value.substring(6,7);
								if(next_char=="0" || next_char=="1") {
								//alert("part3");
									alert("Home phone number is not valid.");
									document.form3.phoneNumber.focus()
									return false;
								}
							}
							else {
								if(fif_char=="0" || fif_char=="1") {
								//alert("part4");
										alert("Home phone number is not valid.");
										document.form3.phoneNumber.focus()
										return false;
								}
							}
						}
					 }
					 else {
					 	alert("The number should end by ).");
						document.form3.phoneNumber.focus()
						return false;
					}
				}
				else {
				//alert("part5");
					alert("Home phone number is not valid.");
					document.form3.phoneNumber.focus()
					return false;
				}
			}
			else {
					alert("Home phone number is not valid.");
					document.form3.phoneNumber.focus()
					return false;
			}
		}
	}
} 
  
  // Home Phone Number Check Ends Here----------
   // postal check
  if(document.form3.company_zip.value!="")
  {
  
  	   if(!checkPost(document.form3.company_zip.value))
	  {
		document.form3.company_zip.focus()
		return false;
	  }

  }
  
  
  
  
  // end of postal check.....
  
  
  
  
  
  // Company Phone Number check....
  
  
 if(document.form3.company_phno.value==0 || document.form3.company_phno.value==null)
{
     	alert("Enter the company's phone number.");
		document.form3.company_phno.focus()
		return false
}
 
if(document.form3.company_phno.value!="") {
		if(!IsPhoneNumber(document.form3.company_phno.value)) {
			alert("Enter the numeric phone number.");
			document.form3.company_phno.value="";
			document.form3.company_phno.focus()
			return false
		}
		else {
			var ValidCharacter = "0123456789";
		    var charlength=document.form3.company_phno.value;
			var Character;
			var totalchar=0;
			for (j = 0; j < charlength.length ; j++) { 
				Character = charlength.charAt(j); 
				if (ValidCharacter.indexOf(Character) == -1) {
				}
				else {
					totalchar=totalchar+1;
				}
			}
					
			if(totalchar>10 || totalchar<10) {
				alert("Enter the number upto 10 digits");
				document.form3.company_phno.value="";
				document.form3.company_phno.focus()
				return false;
			}
			
            var frst_string=document.form3.company_phno.value.substring(0,1);
			if(frst_string=="8" || frst_string=="4" || frst_string=="6" || frst_string=="9") {
				var extension=document.form3.company_phno.value.substring(0,3);
				extension=parseInt(extension);
			//	var PhoneExt =	['<?php echo $extPh; ?>'];
				if(extension=="888" ||  extension=="800" ||  extension=="877"  ||  extension=="866" ||  extension=="416" || extension=="647" || extension=="905")	{
					
					
					var fourth_char=document.form3.company_phno.value.substring(3,4);
					if(fourth_char=="-" || fourth_char=="(" )
					{
						var next_char=document.form3.company_phno.value.substring(4,5);
						if(next_char=="0" || next_char=="1")
						{
							alert("Company phone number is not valid.");
							document.form3.company_phno.focus();
							return false;
						}
					}
					else
					{
						if(fourth_char=="0" || fourth_char=="1")
						{
							alert("Company phone number is not valid.");
							document.form3.company_phno.focus();
							return false;
						}
					}
					
				}
				else {
					alert("Company phone number is not valid.");
					document.form3.company_phno.focus();
					return false;
				}
			}
			else {
				var frst_string_1=document.form3.company_phno.value.substring(0,1);
				if(frst_string_1=="(")	{
					var extension_1=document.form3.company_phno.value.substring(1,4);
					extension_1=parseInt(extension_1);
					if(extension_1=="888" ||  extension_1=="800" ||  extension_1=="877"  ||  extension_1=="866" ||  extension_1=="416" || extension_1=="647" || extension_1=="905") {
						var my_car=document.form3.company_phno.value;
						var the_length=my_car.length;
						var last_char=my_car.charAt(the_length-1);
						
						var fif=document.form3.company_phno.value.substring(4,5);
						if(last_char==")" || fif==")") {
						
						
							if(fif!=")")
							{
								if(fif=="-" || fif=="(")
								{
									var next_char=document.form3.company_phno.value.substring(5,6);
									if(next_char=="0" || next_char=="1")
									{
										alert("Company phone number is not valid.");
										document.form3.company_phno.focus();
										return false;
									}
								}
								else
								{
									var next_char=document.form3.company_phno.value.substring(4,5);
									if(next_char=="0" || next_char=="1")
									{
										alert("Company phone number is not valid.");
										document.form3.company_phno.focus();
										return false;
									}
								}
							}
							else
							{
								var fif_char=document.form3.company_phno.value.substring(5,6);
								if(fif_char=="-" || fif=="(")
								{
									var next_char=document.form3.company_phno.value.substring(6,7);
									if(next_char=="0" || next_char=="1")
									{
										alert("Company phone number is not valid.");
										document.form3.company_phno.focus();
										return false;
									}
								}
								else
								{
									if(fif_char=="0" || fif_char=="1")
									{
										alert("Company phone number is not valid.");
										document.form3.company_phno.focus();
										return false;
									}
								}
							}
							
						
						}
						else {
							alert("The number should end by ).");
							document.form3.company_phno.focus();
							return false;
						}
						
					}
					else {
						alert("Company phone number is not valid.");
						document.form3.company_phno.focus();
						return false;
					}
				}
				else {
					alert("Company phone number is not valid.");
					document.form3.company_phno.focus();
					return false;
			}
			
			
			
			}
	  	 }
	  }
 
 
 if(document.form3.company_ext_no.value!=0 && document.form3.company_ext_no.value!=null)
  {
          if(!IsNumeric(document.form3.company_ext_no.value))
		  {
		   alert("Enter the numeric company phone.");
		   document.form3.company_ext_no.value="";
			document.form3.company_ext_no.focus();
			return false
		  }
		  if(document.form3.company_ext_no.value.length > 4)
		  {
			alert("Extension number should be no more than 4 digits.");
			document.form3.company_ext_no.focus();
			return false
		  }
  }
 
 
  // postal check
	if(document.form3.alt_zip.value!="") {
  
		if(!checkPost(document.form3.alt_zip.value)) {
			document.form3.zip.focus();
			return false;
		}
	}
  
  
  
  
  // end of postal check.....
 
 
if(document.form3.alt_phno.value!="")
{
          if(!IsPhoneNumber(document.form3.alt_phno.value))
				  {
				   alert("Enter the numeric phone number.");
				   document.form3.alt_phno.value="";
					document.form3.alt_phno.focus()
					return false
				  }
				  else
				  {
				  
				  
				   var ValidCharacter = "0123456789";
   //var IsNumber=true;
				   var charlength=document.form3.alt_phno.value;
				   var Character;
					var totalchar=0;
						for (j = 0; j < charlength.length ; j++) 
						{ 
							Character = charlength.charAt(j); 
							if (ValidCharacter.indexOf(Character) == -1) 
							{
											
							}
							else
							{
								totalchar=totalchar+1;
							}
						}
					
					
					if(totalchar>10 || totalchar<10)
					{
						alert("Enter the number upto 10 digits");
						 document.form3.alt_phno.value="";
						document.form3.alt_phno.focus()
						return false;
					
					}
			/*if(document.form3.phoneNumber.value.length < 10)
				  {
					alert("Phone number must have atleast 10 digits.");
					document.form3.phoneNumber.focus()
					return false
				  }*/
				  
				
                     var frst_string=document.form3.alt_phno.value.substring(0,1);
					 if(frst_string=="8" || frst_string=="4" || frst_string=="6" || frst_string=="9")
					 {
				  var extension=document.form3.alt_phno.value.substring(0,3);
				   extension=parseInt(extension);
			//	var PhoneExt =	['<?php echo $extPh; ?>'];
				
			if(extension=="888" ||  extension=="800" ||  extension=="877"  ||  extension=="866" ||  extension=="416" || extension=="647" || extension=="905")
			{
			
			var fourth_char=document.form3.alt_phno.value.substring(3,4);
					if(fourth_char=="-" || fourth_char=="(" )
					{
						var next_char=document.form3.alt_phno.value.substring(4,5);
						if(next_char=="0" || next_char=="1")
						{
							alert("Alternative phone number is not valid.");
							document.form3.alt_phno.focus()
							return false;
						}
					}
					else
					{
						if(fourth_char=="0" || fourth_char=="1")
						{
							alert("Alternative phone number is not valid.");
							document.form3.alt_phno.focus()
							return false;
						}
					}
			
			
			
			}
			else
			{
			alert("Alternative phone number is not valid.");
			document.form3.alt_phno.focus()
			return false;
		}
		}
		else
		{
			var frst_string_1=document.form3.alt_phno.value.substring(0,1);
			if(frst_string_1=="(")
			{
			  
				 var extension_1=document.form3.alt_phno.value.substring(1,4);
				 extension_1=parseInt(extension_1);
				
				if(extension_1=="888" ||  extension_1=="800" ||  extension_1=="877"  ||  extension_1=="866" ||  extension_1=="416" || extension_1=="647" || extension_1=="905")
				{
					var my_car=document.form3.alt_phno.value;
						var the_length=my_car.length;
						var last_char=my_car.charAt(the_length-1);
						var fif=document.form3.alt_phno.value.substring(4,5);
						if(last_char==")" || fif==")")
						 {
						 
						 
						 
						  if(fif!=")")
							{
								if(fif=="-" || fif=="(")
								{
									var next_char=document.form3.alt_phno.value.substring(5,6);
									if(next_char=="0" || next_char=="1")
									{
										alert("Alternative phone number is not valid.");
										document.form3.alt_phno.focus()
										return false;
									}
								}
								else
								{
									var next_char=document.form3.alt_phno.value.substring(4,5);
									if(next_char=="0" || next_char=="1")
									{
										alert("Alternative phone number is not valid.");
										document.form3.alt_phno.focus()
										return false;
									}
								}
							}
							else
							{
								var fif_char=document.form3.alt_phno.value.substring(5,6);
								if(fif_char=="-" || fif=="(")
								{
									var next_char=document.form3.alt_phno.value.substring(6,7);
									if(next_char=="0" || next_char=="1")
									{
										alert("Alternative phone number is not valid.");
										document.form3.alt_phno.focus()
										return false;
									}
								}
								else
								{
									if(fif_char=="0" || fif_char=="1")
									{
										alert("Alternative phone number is not valid.");
										document.form3.alt_phno.focus()
										return false;
									}
								}
							}
						 
						 
						 
						 
						 }
					  else
					  {
					  alert("The number should end by ).");
						document.form3.alt_phno.focus()
						return false;
					  }
			
				}
					else
					{
						alert("Alternative phone number is not valid.");
						document.form3.alt_phno.focus()
						return false;
					}
				}
				else
					{
						alert("Alternative phone number is not valid.");
						document.form3.alt_phno.focus()
						return false;
					}
			}
		
		   }
  }
  
  
  
  
  if(document.form3.emergency_no.value==0 || document.form3.emergency_no.value==null)
{
     	alert("Enter the emergency phone number.");
		document.form3.emergency_no.focus()
		return false
  }
 
  if(document.form3.emergency_no.value!=0 && document.form3.emergency_no.value!=null)
  {
         if(!IsPhoneNumber(document.form3.emergency_no.value))
				  {
				   alert("Enter the numeric phone number.");
				   document.form3.emergency_no.value="";
					document.form3.emergency_no.focus()
					return false
				  }
				  else
				  {
				    var ValidCharacter = "0123456789";
   //var IsNumber=true;
				   var charlength=document.form3.emergency_no.value;
				   var Character;
					var totalchar=0;
						for (j = 0; j < charlength.length ; j++) 
						{ 
							Character = charlength.charAt(j); 
							if (ValidCharacter.indexOf(Character) == -1) 
							{
											
							}
							else
							{
								totalchar=totalchar+1;
							}
						}
					
					
					if(totalchar>10 || totalchar<10)
					{
						alert("Enter the number upto 10 digits");
						   document.form3.emergency_no.value="";
						document.form3.emergency_no.focus()
						return false;
					
					}
				  
			/*if(document.form3.phoneNumber.value.length < 10)
				  {
					alert("Phone number must have atleast 10 digits.");
					document.form3.phoneNumber.focus()
					return false
				  }*/
				  
				
                     var frst_string=document.form3.emergency_no.value.substring(0,1);
					 if(frst_string=="8" || frst_string=="4" || frst_string=="6" || frst_string=="9")
					 {
				  var extension=document.form3.emergency_no.value.substring(0,3);
				   extension=parseInt(extension);
				//var PhoneExt =	['<?php echo $extPh; ?>'];
				
			if(extension=="888" ||  extension=="800" ||  extension=="877"  ||  extension=="866" ||  extension=="416" || extension=="647" || extension=="905")
			{
			
				var fourth_char=document.form3.emergency_no.value.substring(3,4);
					if(fourth_char=="-" || fourth_char=="(" )
					{
						var next_char=document.form3.emergency_no.value.substring(4,5);
						if(next_char=="0" || next_char=="1")
						{
							alert("Emergency phone number is not valid.");
							document.form3.emergency_no.focus()
							return false;
						}
					}
					else
					{
						if(fourth_char=="0" || fourth_char=="1")
						{
							alert("Emergency phone number is not valid.");
							document.form3.emergency_no.focus()
							return false;
						}
					}
			
			}
			else
			{
			alert("Emergency phone number is not valid.");
			document.form3.emergency_no.focus()
			return false;
		}
		}
		else
		{
			var frst_string_1=document.form3.emergency_no.value.substring(0,1);
			if(frst_string_1=="(")
			{
			  
				 var extension_1=document.form3.emergency_no.value.substring(1,4);
								   extension_1=parseInt(extension_1);
				
				if(extension_1=="888" ||  extension_1=="800" ||  extension_1=="877"  ||  extension_1=="866" ||  extension_1=="416" || extension_1=="647" || extension_1=="905")
				{
			
			        var my_car=document.form3.emergency_no.value;
						var the_length=my_car.length;
						var last_char=my_car.charAt(the_length-1);
						var fif=document.form3.emergency_no.value.substring(4,5);
						if(last_char==")" || fif==")")
						 {
						 
						 
						 
						 if(fif!=")")
							{
								if(fif=="-" || fif=="(")
								{
									var next_char=document.form3.emergency_no.value.substring(5,6);
									if(next_char=="0" || next_char=="1")
									{
										alert("Emergency phone number is not valid.");
										document.form3.emergency_no.focus()
										return false;
									}
								}
								else
								{
									var next_char=document.form3.emergency_no.value.substring(4,5);
									if(next_char=="0" || next_char=="1")
									{
										alert("Emergency phone number is not valid.");
										document.form3.emergency_no.focus()
										return false;
									}
								}
							}
							else
							{
								var fif_char=document.form3.emergency_no.value.substring(5,6);
								if(fif_char=="-" || fif=="(")
								{
									var next_char=document.form3.emergency_no.value.substring(6,7);
									if(next_char=="0" || next_char=="1")
									{
										alert("Emergency phone number is not valid.");
										document.form3.emergency_no.focus()
										return false;
									}
								}
								else
								{
									if(fif_char=="0" || fif_char=="1")
									{
										alert("Emergency phone number is not valid.");
										document.form3.emergency_no.focus()
										return false;
									}
								}
							}
						 
						 
						 
						 
						 }
					  else
					  {
					  alert("The number should end by ).");
						document.form3.emergency_no.focus()
						return false;
					  }
				}
					else
					{
					 
					  
						alert("Emergency phone number is not valid.");
						document.form3.emergency_no.focus()
						return false;
					}
				}
				else
					{
						alert("Emergency phone number is not valid.");
						document.form3.emergency_no.focus()
						return false;
					}
			}
		
		   }
  }
    if(document.form3.dob_year.value==0)
	{
     	alert("Enter the year.");
		document.form3.dob_year.focus()
		return false
 	 }
 
   if(document.form3.dob_month.value==0)
	{
     	alert("Enter the month.");
		document.form3.dob_month.focus()
		return false
 	 }
   if(document.form3.dob_day.value==0)
	{
     	alert("Enter the day.");
		document.form3.dob_day.focus()
		return false
  	}
 
  
  /*if(document.form3.age.value=="")
  {
    alert("Provide appropriate age.");
	document.form3.age.focus();
	return false;
  }*/
  if(document.form3.occupation.value=="")
  {
    alert("Provide appropriate occupation.");
	document.form3.occupation.focus();
	return false;
  }
 /* if(document.form3.userType.value=="")
  {
    alert("Please provide appropriate user type");
	document.form3.userType.focus();
	return false;
  }
    if(document.form3.userType.value=="Other" && document.form3.otherType.value==0)
  {
    
    alert("Please provide the other information");
	document.form3.otherType.focus();
	return false;
  }*/
  martial  =0;
			for(i=0;i<document.form3.marital_status.length;i++)
			{
			 	if(document.form3.marital_status[i].checked)
				{
					 martial=1;
					
				}
			}
			if( martial==0)
			{
				alert('Select marital status to continue');
				return false;
			}
			 educt  =0;
			for(i=0;i<document.form3.education.length;i++)
			{
			 	if(document.form3.education[i].checked)
				{
					 educt=1;
					
				}
			}
			if( educt==0)
			{
				alert('Select education to continue');
				return false;
			}
			
	yur  =0;
			for(i=0;i<document.form3.you_are.length;i++)
			{
			 	if(document.form3.you_are[i].checked)
				{
					yur =1;
					
				}
			}
			if(yur ==0)
			{
				alert('Select  male or female  to continue');
				return false;
			}						
  if(document.form3.terms.checked==0)
  {
    alert("Please check the terms and conditions to  proceed.");
	document.form3.terms.focus();
	return false;
  }
  
  
  <!-------------- conditions for payment information ------------------------------------------------------>
 
  <!--------------- conditions for payment info ends here---------------------------------------------------> 
  
  return true;
}
