function chkemail(emval)
{
        var posi = 0;
        var posj = 0;
        var iflg = "false";
        var jflg = "false";
        for(i=0;i<=emval.length;i++)
        {
                if(emval.substr(i, 1) == "\@")
                {
                        posi = i+1;
                        iflg = "true";
                }
                if(emval.substr(i, 1) == ".")
                {
                        posj = i+1;
                        jflg = "true";
                }
        }
        if(posi == "1" || (posi+1) == posj || posj == emval.length || iflg == "false" || jflg == "false")
        {
                return false;
        }
        else
        {
                return true;
        }
}

function validateLife(lifedetails)
 {
    
	lifedetails.onsubmit = function()
	{
        	if((lifedetails.insure_policy_type[0].checked==false) && (lifedetails.insure_policy_type[1].checked==false) && (lifedetails.insure_policy_type[2].checked==false) && (lifedetails.insure_policy_type[3].checked==false) && (lifedetails.insure_policy_type[4].checked==false) && (lifedetails.insure_policy_type[5].checked==false))
	     {
	           alert("Please Select The Policy Type");
		       return false;
		 	 	 
		   } 
		    
if(lifedetails.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		lifedetails.day.focus();
		return false;
        
	}

	if(lifedetails.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		lifedetails.month.focus();

		return false;
		 }
		  	   		 					
	
	if(lifedetails.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		lifedetails.year.focus();

		return false;
		
		}
if(lifedetails.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 lifedetails.gross_income.focus();
		 return false;
		 	 	 
		}			
		   
   if(lifedetails.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter First Name");

		lifedetails.cust_fname.focus();

		return false;

	}

if((lifedetails.cust_sex[0].checked==false) && (lifedetails.cust_sex[1].checked==false))
	  {
	     alert("Please Select Your Gender");
		 return false;
		 	 	 
		}
   
	if(lifedetails.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 lifedetails.cust_city.focus();
		 return false;
		 	 	 
		} 
	if(lifedetails.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					lifedetails.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < lifedetails.cust_mob.value.length; i++)
							{
								if(parseInt(lifedetails.cust_mob.value.charAt(i)) >= 0 && parseInt(lifedetails.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 lifedetails.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(lifedetails.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Mobile With 9");
											      lifedetails.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}
	   if(!chkemail(lifedetails.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 lifedetails.cust_email.focus();
		 return false;
		 	 	 
		} 
	return true;	   
     }
 
 }


function validateHealth(healthdetails)
 
 {
    
	healthdetails.onsubmit = function()
	{
        	if((healthdetails.mediclaim_required_for[0].checked==false) && (healthdetails.mediclaim_required_for[1].checked==false) && (healthdetails.mediclaim_required_for[2].checked==false) && (healthdetails.mediclaim_required_for[3].checked==false) && (healthdetails.mediclaim_required_for[4].checked==false) && (healthdetails.mediclaim_required_for[5].checked==false))
	     {
	           alert("Please Select The Policy Type");
		       return false;
		 	 	 
		   } 
		    
if(healthdetails.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		healthdetails.day.focus();
		return false;
        
	}

	if(healthdetails.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		healthdetails.month.focus();

		return false;
		 }
		  	   		 					
	
	if(healthdetails.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		healthdetails.year.focus();

		return false;
		
		}
if(healthdetails.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 healthdetails.gross_income.focus();
		 return false;
		 	 	 
		}			
		   
   if(healthdetails.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter Name");

		healthdetails.cust_fname.focus();

		return false;

	}

if((healthdetails.cust_sex[0].checked==false) && (healthdetails.cust_sex[1].checked==false))
	  {
	     alert("Please Select Your Gender");
		 return false;
		 	 	 
		}
   
	if(healthdetails.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 healthdetails.cust_city.focus();
		 return false;
		 	 	 
		} 
	if(healthdetails.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					healthdetails.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < healthdetails.cust_mob.value.length; i++)
							{
								if(parseInt(healthdetails.cust_mob.value.charAt(i)) >= 0 && parseInt(healthdetails.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 healthdetails.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(healthdetails.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Correct Mobile ");
											      healthdetails.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}
	   if(!chkemail(healthdetails.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 healthdetails.cust_email.focus();
		 return false;
		 	 	 
		} 
	return true;	   
     }
 
 }



 function validateAuto(autodetails)
 {
    
	autodetails.onsubmit = function()
	{
        	if(autodetails.vehicle_manf.options.selectedIndex==0)
	     {
	           alert("Please Select Auto Manufacturer's Name");
		       autodetails.vehicle_manf.focus();
		        return false;
		 	 	 
		   } 
		    
			if(autodetails.model_name.value==0)
	     {
	           alert("Please Provide Car Model Name and Version");
		       autodetails.model_name.focus();
		        return false;
		 	 	 
		   } 
		   
		   if(autodetails.day_m.options.selectedIndex==0)

	        {
	              
		          alert("Please Select Day Of Registration");

		            autodetails.day_m.focus();

		            return false;
        
	           }

	if(autodetails.month_m.options.selectedIndex==0)

	{

		alert("Please Select Month of Registration");

		autodetails.month_m.focus();

		return false;
		 }
		  	   		 					
	
	if(autodetails.year_m.options.selectedIndex==0)

	{

		alert("Please Select Year Of Registration");

		autodetails.year_m.focus();

		return false;
		
		}
            if(autodetails.idv_of_vehicle.value==0)
	     {
	           alert("Please Provide The Current Value Of The Vehicle");
		       autodetails.idv_of_vehicle.focus();
		        return false;
		 	 	 
		   } 
		  		   
   if(autodetails.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		autodetails.day.focus();
		return false;
        
	}

	if(autodetails.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		autodetails.month.focus();

		return false;
		 }
		  	   		 					
	
	if(autodetails.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		autodetails.year.focus();

		return false;
		
		}
if(autodetails.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 autodetails.gross_income.focus();
		 return false;
		 	 	 
		}			
		   
   if(autodetails.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter Name");

		autodetails.cust_fname.focus();

		return false;

	}

if((autodetails.cust_sex[0].checked==false) && (autodetails.cust_sex[1].checked==false))
	  {
	     alert("Please Select Your Gender");
		 return false;
		 	 	 
		}
   
	if(autodetails.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 autodetails.cust_city.focus();
		 return false;
		 	 	 
		} 
	if(autodetails.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					autodetails.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < autodetails.cust_mob.value.length; i++)
							{
								if(parseInt(autodetails.cust_mob.value.charAt(i)) >= 0 && parseInt(autodetails.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 autodetails.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(autodetails.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Correct Mobile ");
											      autodetails.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}
	   if(!chkemail(autodetails.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 autodetails.cust_email.focus();
		 return false;
		 	 	 
		} 
	return true;	   
     }
 
 }


 function validateChild(childForm)
 {
    
	childForm.onsubmit = function()
	{
        	if(childForm.no_child.options.selectedIndex==0)
	     {
	           alert("Please Select No. Of Children & Their Age");
		       childForm.no_child.focus();
		        return false;
		 	 	 
		   } 
		    
			if(childForm.child_ins_goal.options.selectedIndex==0)
	     {
	           alert("Please Select Your Ultimate Goal");
		       childForm.child_ins_goal.focus();
		        return false;
		 	 	 
		   } 
		  		   
   if(childForm.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter First Name");

		childForm.cust_fname.focus();

		return false;

	}



       if(childForm.elements['cust_lname'].value.length<1)

	{

		alert("Please Enter Last Name");

		childForm.cust_lname.focus();

		return false;

	}
	
	if(childForm.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		childForm.day.focus();
		return false;
        
	}

	if(childForm.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		childForm.month.focus();

		return false;
		 }
		  	   		 					
	
	if(childForm.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		childForm.year.focus();

		return false;
		
		}
		if(childForm.cust_sex.options.selectedIndex==0)
	  {
	     alert("Please Select Your Gender From the List");
		 childForm.cust_sex.focus();
		 return false;
		 	 	 
		}
		 	if(childForm.state.options.selectedIndex==0)
	  {
	     alert("Please Select State From the List");
		 childForm.state.focus();
		 return false;
		 	 	 
		}    		
		   
	if(childForm.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 childForm.cust_city.focus();
		 return false;
		 	 	 
		} 
		   
		
		if(childForm.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 childForm.gross_income.focus();
		 return false;
		 	 	 
		}
		
		if(!chkemail(childForm.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 childForm.cust_email.focus();
		 return false;
		 	 	 
		} 
			
	           
	
	if(childForm.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					childForm.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < childForm.cust_mob.value.length; i++)
							{
								if(parseInt(childForm.cust_mob.value.charAt(i)) >= 0 && parseInt(childForm.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 childForm.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(childForm.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Mobile With 9");
											      childForm.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}

	   
	return true;	   
     }
 
 }


 function validateRetire(retirementdetails)
 {
    
	retirementdetails.onsubmit = function()
	{
        	if(retirementdetails.curr_anual_exp.value=="")
	     {
	           alert("Please Provide You Current Annual Expenses");
		       retirementdetails.curr_anual_exp.focus();
		        return false;
		 	 	 
		   } 
		    
			if(retirementdetails.age_of_retire.options.selectedIndex==0)
	     {
	           alert("Please Select Age You Would Like To Retire");
		       retirementdetails.age_of_retire.focus();
		        return false;
		 	 	 
		   } 
		   		   
		  		   
   if(retirementdetails.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter First Name");

		retirementdetails.cust_fname.focus();

		return false;

	}



       if(retirementdetails.elements['cust_lname'].value.length<1)

	{

		alert("Please Enter Last Name");

		retirementdetails.cust_lname.focus();

		return false;

	}
	
	if(retirementdetails.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		retirementdetails.day.focus();
		return false;
        
	}

	if(retirementdetails.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		retirementdetails.month.focus();

		return false;
		 }
		  	   		 					
	
	if(retirementdetails.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		retirementdetails.year.focus();

		return false;
		
		}
		if(retirementdetails.cust_sex.options.selectedIndex==0)
	  {
	     alert("Please Select Your Gender From the List");
		 retirementdetails.cust_sex.focus();
		 return false;
		 	 	 
		}
		 	if(retirementdetails.state.options.selectedIndex==0)
	  {
	     alert("Please Select State From the List");
		 retirementdetails.state.focus();
		 return false;
		 	 	 
		}    		
		   
	if(retirementdetails.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 retirementdetails.cust_city.focus();
		 return false;
		 	 	 
		} 
		   
		
		if(retirementdetails.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 retirementdetails.gross_income.focus();
		 return false;
		 	 	 
		}
		
		if(!chkemail(retirementdetails.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 retirementdetails.cust_email.focus();
		 return false;
		 	 	 
		} 
			
	           
	
	if(retirementdetails.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					retirementdetails.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < retirementdetails.cust_mob.value.length; i++)
							{
								if(parseInt(retirementdetails.cust_mob.value.charAt(i)) >= 0 && parseInt(retirementdetails.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 retirementdetails.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(retirementdetails.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Correct Mobile Number");
											      retirementdetails.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}

	   
	return true;	   
     }
 
 }


    function validateTravel(traveldetails)
 {
    
	traveldetails.onsubmit = function()
	{
        	if(traveldetails.traval_insure_required_for.options.selectedIndex==0)
	     {
	           alert("Please Select Travel Insurance Required ");
		       traveldetails.traval_insure_required_for.focus();
		        return false;
		 	 	 
		   } 
		    
			if(traveldetails.traveling_for.options.selectedIndex==0)
	     {
	           alert("Please Select The Duration Of Stay");
		       traveldetails.traveling_for.focus();
		        return false;
		 	 	 
		   } 
		    
			if(traveldetails.day_traval.options.selectedIndex==0)

	        {
	              
		          alert("Please Select Day ");

		            traveldetails.day_traval.focus();

		            return false;
        
	           }

	if(traveldetails.month_traval.options.selectedIndex==0)

	{

		alert("Please Select Month ");

		traveldetails.month_traval.focus();

		return false;
		 }
		  	   		 					
	
	if(traveldetails.year_traval.options.selectedIndex==0)

	{

		alert("Please Select Year ");

		traveldetails.year_traval.focus();

		return false;
		
		}
		   		
		   if(traveldetails.travel_country.value=="")
	     {
	           alert("Please Provide Country You Are Travelling");
		       traveldetails.travel_country.focus();
		        return false;
		 	 	 
		   } 
		   
	          if(traveldetails.element['travel_country'].value>40)
	     {
	           alert("Please Provide Country You Are Travelling");
		       traveldetails.travel_country.focus();
		        return false;
		 	 	 
		   } 
	return true;	   
     }
 
 }

 
function validateForm(life)

{
 
	life.onsubmit = function()
		  {
		  
		  if(life.insure_policy_type.options.selectedIndex==0)
	     {
	           alert("Please Select The Policy Type");
		       life.insure_policy_type.focus();
		        return false;
		 	 	 
		   } 
		    
			if(life.insure_required_for.options.selectedIndex==0)
	     {
	           alert("Please Select Insurance Cover For");
		       life.insure_required_for.focus();
		        return false;
		 	 	 
		   } 
		   
		    
			if(life.insure_year_protection.options.selectedIndex==0)
	     {
	           alert("Please Select Insurance Term");
		       life.insure_year_protection.focus();
		        return false;
		 	 	 
		   }
		   
   if(life.elements['cust_fname'].value.length<1)

	{

		alert("Please Enter First Name");

		life.cust_fname.focus();

		return false;

	}



       if(life.elements['cust_lname'].value.length<1)

	{

		alert("Please Enter Last Name");

		life.cust_lname.focus();

		return false;

	}
	
	if(life.day.options.selectedIndex=="0")

	{
	    alert("Please enter day");
		life.day.focus();
		return false;
        
	}

	if(life.month.options.selectedIndex=="0")

	{

		alert("Please enter month");

		contact.month.focus();

		return false;
		 }
		  	   		 					
	
	if(life.year.options.selectedIndex=="0")

	{

		alert("Please enter year");

		life.year.focus();

		return false;
		
		}
		if(life.cust_sex.options.selectedIndex==0)
	  {
	     alert("Please Select Your Gender From the List");
		 life.cust_sex.focus();
		 return false;
		 	 	 
		}
		 	if(life.state.options.selectedIndex==0)
	  {
	     alert("Please Select State From the List");
		 life.state.focus();
		 return false;
		 	 	 
		}    		
		   
	if(life.cust_city.options.selectedIndex==0)
	  {
	     alert("Please Select a CITY From the List");
		 lifecontact.cust_city.focus();
		 return false;
		 	 	 
		} 
		   
		
		if(life.gross_income.options.selectedIndex==0)
	  {
	     alert("Please Select Gross Income");
		 life.gross_income.focus();
		 return false;
		 	 	 
		}
		
		if(!chkemail(life.cust_email.value))
		
		{
		   alert("Please Enter Correct Email Address");
		 life.cust_email.focus();
		 return false;
		 	 	 
		} 
			
	           
	
	if(life.cust_mob.value.length<10)
		     {
	    			 alert("Please Enter 10 Digit Mobile Number");

					life.cust_mob.focus();

					return false;

					    }
						      
				else

					{
							 
							for(i = 0; i < life.cust_mob.value.length; i++)
							{
								if(parseInt(life.cust_mob.value.charAt(i)) >= 0 && parseInt(life.cust_mob.value.charAt(i)) <= 9)				
								{
								 	}
									else
									{
									 alert("Please enter Numeric value");
									 life.cust_mob.focus();
									 return false;
									 }
								}
								
								        if(parseInt(life.cust_mob.value.charAt(0))>=7)
										   {
										       }
											   
											else 
										    	{   
										          alert("Please Enter Mobile With 9");
											      life.cust_mob.focus();
											      return false;
											 }
								
								
								
								
							}
							

	return true;
   
    
   
   }
   
}   
