function InsForm(form)
{ 
var zip=form.zip.value;
var type=form.type.value;

  if (zip.length!=5)

   { 
   window.alert("Enter Full Zip Code");
   }

    else { 

       if (validzip(zip)==false) 
	   
	      {
		  window.alert("Error Zip Code"); 
		  }
		  
           else {
			   
           if (form.insured[0].checked)
                 {	
				  if (type=="auto")
				  {
				 
	    window.open("http://www.2insure4less.com?s=233319&rdto=am&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
         window.location = '/getrates.php?type=auto&zipcode=' + zip; 
				  }
				   else
				  
				      {
					  
					    if (type == "bs")
						       {
					window.open("http://www.2insure4less.com?s=233319&rdto=bs&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                    window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;	
					    	   }  
							   
							   else
							      {
								
			                      if (type == "moto") 
								                   {
			                             window.open("http://www.tkqlhce.com/click-3488958-10608829?sid=" + type, null,'fullscreen,scrollbars=yes');
                                         window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;
			
		                                           }
		   
		                                                   																	
												   else  {	 
		                                                   if (type == "home")
		                                                      {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=ho&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                  } 
													        	
																else 
																     {
																	
																	 if (type == "health")
		                                                                                {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=ht&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                  } 
															  
															         else { 
															  
															              if (type == "life")
		                                                                        {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=lf&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                                    } 
															  
 }}  } }}}
else
   {
	if (form.insured[1].checked)
		  {	
			 if (type=="auto")
				                    {
							
	         window.open("http://www.2insure4less.com?s=233319&rdto=am&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
			 window.location = '/getrates.php?type=auto&zipcode=' + zip; 
								    }
			  else
				                       {
					  
					                   if (type == "bs")
						                  {
					window.open("http://www.2insure4less.com?s=233319&rdto=bs&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                    window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;	
					    	              }  
							   
							              else
							                 {
								
			                                 if (type == "moto") 
											    {
			                             window.open("http://www.tkqlhce.com/click-3488958-10608829?sid=" + type, null,'fullscreen,scrollbars=yes');
                                         window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;
			                                    }
		   
		                                        else  {	 
		                                                   if (type == "home")
		                                                      {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=ho&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                  } 
															  
															  else 
																{
																	
															if (type == "health")
		                                                      {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=ht&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                  } 
															  
															  
															    else { 
															  
															   if (type == "life")
		                                                      {
			                                   window.open("http://www.2insure4less.com?s=233319&rdto=lf&g=" + type + "&zipcode=" + zip, null,'fullscreen,scrollbars=yes');
                                               window.location = '/getrates.php?zipcode=' + zip + '&type=' + type;			  
			                                                  } 
															  
 }} } }  } } } } }}
 
function validzip(string)
    {
   var valid = "0123456789";
   var res;
   var result = true;
   
   if (string.length == 0) return false;
   for (i = 0; i < string.length && result == true; i++)
      {
      res = string.charAt(i);
      if (valid.indexOf(res) == -1)
         {
         result = false;
         }
      }
   return result;
}