



function entra()
{
	var s = Cotizador.ValSuplantacion();
	
	//window.location.href ="../../SOAPMEL/Control/Mantencion.aspx";	
	
	if (s.value == "SI")
	{
		TB_show('', '../validaGAP/validagap.aspx?height=120&amp;width=410', true)
	}
}	


function Login_Suplanta(cod_docum)
{
	cod_docum = cod_docum.toUpperCase();
	
	if (cod_docum == "")
	{
		alert("Es necesario informar Rut del Corredor a suplantar");
		document.getElementById("cuenta").focus();
		
	}
	else
	{
	
	if ( checkRUT(document.getElementById("cuenta"), true) )
		{			
			
			document.getElementById("hdncuenta_format").value = document.getElementById("cuenta").value;

			var rut_sin_guion;
            rut_sin_guion = stripCharsInBag(cod_docum,".- ");	
			Cotizador.ValLoginSuplanta(rut_sin_guion, ReturnLogin_Suplanta);
			
		}	
	}
}

function ReturnLogin_Suplanta(res)
{
if (res.value == "SI")
	{
		var rut_sin_guion = stripCharsInBag(document.all.cuenta.value,".- ");	
		window.location.href ="../Cotizador_VidaViaje/Cotizador.aspx?r=" + rut_sin_guion ;
	}
	else
	{
		alert(res.value);
		document.getElementById("cuenta").focus();	
		document.getElementById("cuenta").select();
		
	}
}


function Cierra()
{
	TB_remove()
}

/***********************
* FUNCIONES COTIZADOR *
***********************/


function validacotiza()
{

	if (document.all("txtcod_docum_aseg").value == ""){

		alert("Por favor, ingrese el RUT del asegurado");

		document.all("txtcod_docum_aseg").focus();

		borrar();

		return false;

	}
	
	
	if (document.all("txtnombres").value == ""){

	alert("Por favor, ingrese los nombres");

	document.all("txtnombres").focus();

	borrar();

	return false;

	}

	if (document.all("txtapell1").value == ""){

	alert("Por favor, ingrese el apellido 1");

	document.all("txtapell1").focus();

	borrar();

	return false;

	}

	if (document.all("txtapell2").value == ""){

	alert("Por favor, ingrese el apellido 2");

	document.all("txtapell2").focus();

	borrar();

	return false;

	}



	if (document.all("txtdia").value == "" ){

	alert("Por favor, ingrese el d\xEDa de la fecha de nacimiento");
	document.all("txtedad").value = '';
	document.all("txtdia").focus();

	borrar();

	return false;

	}

	if (document.all("txtmes").value == "" ){

	alert("Por favor, ingrese el mes de la fecha de nacimiento");
	document.all("txtedad").value = '';
	document.all("txtmes").focus();

	borrar();

	return false;

	}

	if (document.all("txtanio").value == "" ){

	alert("Por favor, ingrese el a\xF1o de la fecha de nacimiento");
	document.all("txtedad").value = '';
	document.all("txtanio").focus();

	borrar();

	return false;

	}
		
		
	

  return true;

}


/***********************
*    VALIDA EMISION   * 
***********************/


function validaemision()
{

	if(document.all("txtrutcont").value == '')
	{
	  alert("Por favor, ingrese el RUT del Contratante");
	  document.all("txtrutcont").focus();
	  return false;
	}


	if(document.all("txtnomcont").value == '')
	{
	  alert("Por favor, ingrese los Nombres del Contratante");
	  document.all("txtnomcont").focus();
	  return false;
	}

	
	
	if(document.all("txtapell1cont").value == '')
	{
	  alert("Por favor, ingrese el Apellido Paterno del Contratante");
	  document.all("txtapell1cont").focus();
	  return false;
	}
	
	
	if(document.all("txtapell2cont").value == '')
	{
	  alert("Por favor, ingrese el Apellido Materno del Contratante");
	  document.all("txtapell2cont").focus();
	  return false;
	}
	
	
	if (document.all("txtdirecont").value == '')
	{
	  alert("Por favor, ingrese la Direccion del Contratante");
	  document.all("txtdirecont").focus();
	  return false;
	}
	
	if (document.all("drpregcont").value == '0' || document.all("drpregcont").value == '' )
	{
	  alert("Por favor, ingrese la Region del Contratante");
	  document.all("drpregcont").focus();
	  return false;
	}
	
	if (document.all("drpciudadcont").value == '0' || document.all("drpregcont").value == '' )
	{
	  alert("Por favor, ingrese la Ciudad del Contratante");
	  document.all("drpciudadcont").focus();
	  return false;
	}
	
	if (document.all("drpcomucont").value == '0' || document.all("drpregcont").value == '' )
	{
	  alert("Por favor, ingrese la Comuna del Contratante");
	  document.all("drpcomucont").focus();
	  return false;
	}
	
	/*
	if (document.all("txttelpaiscont").value == '')
	{
	  alert("Por favor, ingrese codigo la Pais del Contratante");
	  document.all("txttelpaiscont").focus();
	  return false;
	}
	
	if (document.all("txttelzonacont").value == '')
	{
	  alert("Por favor, ingrese la Zona del Pais del Contratante");
	  document.all("txttelzonacont").focus();
	  return false;
	}
  */
  
   if (document.all("txttelecont").value == '')
	{
	  alert("Por favor, ingrese el n\xFAmero de tel\xE9fono del Contratante");
	  document.all("txttelecont").focus();
	  return false;
	}
	
		
	//Asegurado
	
	if (document.all("txtdireaseg").value == '')
	{
	  alert("Por favor, ingrese la Direccion del Asegurado");
	  document.all("txtdireaseg").focus();
	  return false;
	}
	
	
	if (document.all("drpregaseg").value == '0' || document.all("drpregaseg").value == '' )
	{
	  alert("Por favor, ingrese la Region del Asegurado");
	  document.all("drpregaseg").focus();
	  return false;
	}

    if (document.all("drpciudadaseg").value == '0' || document.all("drpciudadaseg").value == '' )
	{
	  alert("Por favor, ingrese la Ciudad del Asegurado");
	  document.all("drpciudadaseg").focus();
	  return false;
	}

   if (document.all("drpcomuaseg").value == '0' || document.all("drpcomuaseg").value == '' )
	{
	  alert("Por favor, ingrese la Comuna del Asegurado");
	  document.all("drpcomuaseg").focus();
	  return false;
	}
	
	
	/*
   
    if (document.all("txttelpaisaseg").value == '')
	{
	  alert("Por favor, ingrese codigo la Pais del Asegurado");
	  document.all("txttelpaisaseg").focus();
	  return false;
	}

   if (document.all("txttelzonaaseg").value == '')
	{
	  alert("Por favor, ingrese la Zona del Pais del Asegurado");
	  document.all("txttelzonaaseg").focus();
	  return false;
	}
   */
   if (document.all("txtteleaseg").value == '')
	{
	  alert("Por favor, ingrese el n\xFAmero de tel\xE9fono del Asegurado");
	  document.all("txtteleaseg").focus();
	  return false;
	}

	
	
	
		
return true;

}



//---//


function valida_viajeros()
		{
			
			var i=0;
			f = document.forms[0];
			
			var formul = 'Form1';
			var idcampo = '';
			
			for(i=1;i<=30;i++) 
			{
			   //Textbox 1..n
			   idcampo = "viajero"+String(i);  
			   
			   this.control = "document.forms."+formul+"."+idcampo;

			   var ctrl = eval(this.control);
			   
			    
			   if (ltrim(ctrl.value) != '' ) //Principal (if)
			   {
			
			     if(i < 4)
			     {
			       //Titular Viajero Principal
			     }else
			     
			     //Primer Viajero
			     if(i < 7)
			     {
			      if(ltrim(f.viajero4.value) == '' || ltrim(f.viajero5.value) == '' || ltrim(f.viajero6.value) == '' || isNull(document.Form1.parentesco7.value) == '0' )return false;
				
				 }else 
				 
				 //Segundo Viajero
				if(i < 10)
				{
					if(ltrim(f.viajero7.value) == '' || ltrim(f.viajero8.value) == '' || ltrim(f.viajero9.value) == ''   || isNull(document.Form1.parentesco10.value) == '0')return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Tercer Viajero
				if(i < 13)
				{
					if(ltrim(f.viajero10.value) == '' || ltrim(f.viajero11.value) == '' || ltrim(f.viajero12.value) == ''  || isNull(document.Form1.parentesco13.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				
				 //Cuarto Viajero
				if(i < 16)
				{
					if(ltrim(f.viajero13.value) == '' || ltrim(f.viajero14.value) == '' || ltrim(f.viajero15.value) == ''  || isNull(document.Form1.parentesco16.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Quinto Viajero
				if(i < 19)
				{
					if(ltrim(f.viajero16.value) == '' || ltrim(f.viajero17.value) == '' || ltrim(f.viajero18.value) == ''  || isNull(document.Form1.parentesco19.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Sexto Viajero
				if(i < 22)
				{
					if(ltrim(f.viajero19.value) == '' || ltrim(f.viajero20.value) == '' || ltrim(f.viajero21.value) == ''  || isNull(document.Form1.parentesco22.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Septimo Viajero
				if(i < 25)
				{
					if(ltrim(f.viajero22.value) == '' || ltrim(f.viajero23.value) == '' || ltrim(f.viajero24.value) == ''  || isNull(document.Form1.parentesco25.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Octavo Viajero
				if(i < 28)
				{
					if(ltrim(f.viajero25.value) == '' || ltrim(f.viajero26.value) == '' || ltrim(f.viajero27.value) == ''  || isNull(document.Form1.parentesco28.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				
				 //Noveno Viajero
				if(i < 31)
				{
					if(ltrim(f.viajero28.value) == '' || ltrim(f.viajero29.value) == '' || ltrim(f.viajero30.value) == ''  || isNull(document.Form1.parentesco31.value) == '0' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}
				
		  
			  
			  }//Principal (if)
			
		  }//for   
		  
		  
		  
		  
				
		  
		  //todo OK
		  return true;
		  
		}

		function valida_benef()
		{
			// 4 Beneficiarios(filas) - 5 columnas = 20 textbox  
			
			var i=0;
			f = document.forms[0];
			
			var formul = 'Form1';
			var idcampo = '';
			
			for(i=1;i<=20;i++) 
			{
			   //Textbox 1..n
			   idcampo = "benef"+String(i);  
			   
			   this.control = "document.forms."+formul+"."+idcampo;

			   var ctrl = eval(this.control);
			   
			    
			   if (ltrim(ctrl.value) != '') //Principal (if)
			   {
			   
				 //Primer beneficiario
				 if(i < 6)
				 {
					if(ltrim(f.benef1.value) == '' || ltrim(f.benef2.value) == '' || ltrim(f.benef3.value) == '' )return false; //|| ltrim(f.benef4.value) == '' || ltrim(f.benef5.value) == ''
				 
				 }else 
				   
				//Segundo beneficiario
				if(i < 11)
				{
					if(ltrim(f.benef6.value) == '' || ltrim(f.benef7.value) == '' || ltrim(f.benef8.value) == '' )return false; //|| ltrim(f.benef9.value) == '' || ltrim(f.benef10.value) == ''
				}else
				   
				//Tercer beneficiario
				if(i < 16)
				{
					if(ltrim(f.benef11.value) == '' || ltrim(f.benef12.value) == '' || ltrim(f.benef13.value) == '' )return false; //|| ltrim(f.benef14.value) == '' || ltrim(f.benef15.value) == ''
				}else
				   
				//Cuarto beneficiario
				if(i < 21)
				{
					if(ltrim(f.benef16.value) == '' || ltrim(f.benef17.value) == '' || ltrim(f.benef18.value) == '' )return false; //|| ltrim(f.benef19.value) == '' || ltrim(f.benef20.value) == ''
				}
			  
			  
			  /****** En caso de más beneficiarios *******************************************************************************
			  
			    }else
				   
				//Quinto beneficiario
				if(i < 26)
				{
					if(ltrim(f.benef21.value) == '' || ltrim(f.benef22.value) == '' || ltrim(f.benef23.value) == '' || ltrim(f.benef24.value) == '' || ltrim(f.benef25.value) == '')return false;
				}else
																	.
																	.
																	.
			  **********************************************************************************************************************/
			  
			  
			}//Principal (if)
			
		  }//for   
		  
		  return true;
		}
			   
			 
			 
			 
			 
       /***********************
		*      OTROS          * 
		***********************/
		
		
		 function CargaTabla(valor)
		    {
		 
		 

		 
		      if(valor == "1")
		      {
		      //-----------------------------------------------------------------------
		        document.getElementById('lblAsisViajeMont').innerHTML = '250'
		        document.getElementById('lblAsisViajeNom').innerHTML = ''
		      //-----------------------------------------------------------------------
		      
		         document.getElementById("I16506").style.display = "inline";
		         document.getElementById("I26506").style.display = "inline";
		         document.getElementById("I36506").style.display = "inline";
		         document.getElementById("F16506").style.display = "inline";
		         document.getElementById("F26506").style.display = "inline";
		         document.getElementById("F36506").style.display = "inline";
		         document.getElementById("I165062").style.display = "none";
		         document.getElementById("I265062").style.display = "none";
		         document.getElementById("I365062").style.display = "none";
		         document.getElementById("F165062").style.display = "none";
		         document.getElementById("F265062").style.display = "none";
		         document.getElementById("F365062").style.display = "none";
		         
		         document.getElementById("I16201").style.display = "inline";
		         document.getElementById("I26201").style.display = "inline";
		         document.getElementById("I36201").style.display = "inline";
		         document.getElementById("F16201").style.display = "inline";
		         document.getElementById("F26201").style.display = "inline";
		         document.getElementById("F36201").style.display = "inline";
		         document.getElementById("I162012").style.display = "none";
		         document.getElementById("I262012").style.display = "none";
		         document.getElementById("I362012").style.display = "none";
		         document.getElementById("F162012").style.display = "none";
		         document.getElementById("F262012").style.display = "none";
		         document.getElementById("F362012").style.display = "none";
		         
		         document.getElementById("I16100").style.display = "inline";
		         document.getElementById("I26100").style.display = "inline";
		         document.getElementById("I36100").style.display = "inline";
		         document.getElementById("F16100").style.display = "inline";
		         document.getElementById("F26100").style.display = "inline";
		         document.getElementById("F36100").style.display = "inline";
		         document.getElementById("I161002").style.display = "none";
		         document.getElementById("I261002").style.display = "none";
		         document.getElementById("I361002").style.display = "none";
		         document.getElementById("F161002").style.display = "none";
		         document.getElementById("F261002").style.display = "none";
		         document.getElementById("F361002").style.display = "none";
		         
		         document.getElementById("Label1").style.display = "inline";
		         document.getElementById("Label2").style.display = "inline";
		         document.getElementById("Label3").style.display = "inline";
		         document.getElementById("Label4").style.display = "inline";
		         document.getElementById("Label5").style.display = "inline";
		         document.getElementById("Label6").style.display = "inline";
		         
		         document.getElementById("Label7").style.display = "none";
		         document.getElementById("Label8").style.display = "none";
		         document.getElementById("Label9").style.display = "none";
		         document.getElementById("Label10").style.display = "none";
		         document.getElementById("Label11").style.display = "none";
		         document.getElementById("Label12").style.display = "none";
		         
		         //document.getElementById("Label13").style.display = "inline";
		         //document.getElementById("Label14").style.display = "none";
		         
		         document.getElementById("Label15").style.display = "none";
		         
		         setSelFindByValue("drptipoviaje","1");
		         
		         
		         
		      
		      }
		      
		      if(valor == "2")
		      {
		      //------------------------------------------------------------------------------
		      	document.getElementById('lblAsisViajeMont').innerHTML = '30.000';
				document.getElementById('lblAsisViajeNom').innerHTML = ' en Euros';
			 //------------------------------------------------------------------------------

		      
		      
		         document.getElementById("I16506").style.display = "none";
		         document.getElementById("I26506").style.display = "none";
		         document.getElementById("I36506").style.display = "none";
		         document.getElementById("F16506").style.display = "none";
		         document.getElementById("F26506").style.display = "none";
		         document.getElementById("F36506").style.display = "none";
		         document.getElementById("I165062").style.display = "inline";
		         document.getElementById("I265062").style.display = "inline";
		         document.getElementById("I365062").style.display = "inline";
		         document.getElementById("F165062").style.display = "inline";
		         document.getElementById("F265062").style.display = "inline";
		         document.getElementById("F365062").style.display = "inline";
		         
		         document.getElementById("I16201").style.display = "none";
		         document.getElementById("I26201").style.display = "none";
		         document.getElementById("I36201").style.display = "none";
		         document.getElementById("F16201").style.display = "none";
		         document.getElementById("F26201").style.display = "none";
		         document.getElementById("F36201").style.display = "none";
		         document.getElementById("I162012").style.display = "inline";
		         document.getElementById("I262012").style.display = "inline";
		         document.getElementById("I362012").style.display = "inline";
		         document.getElementById("F162012").style.display = "inline";
		         document.getElementById("F262012").style.display = "inline";
		         document.getElementById("F362012").style.display = "inline";
		         
		         document.getElementById("I16100").style.display = "none";
		         document.getElementById("I26100").style.display = "none";
		         document.getElementById("I36100").style.display = "none";
		         document.getElementById("F16100").style.display = "none";
		         document.getElementById("F26100").style.display = "none";
		         document.getElementById("F36100").style.display = "none";
		         document.getElementById("I161002").style.display = "inline";
		         document.getElementById("I261002").style.display = "inline";
		         document.getElementById("I361002").style.display = "inline";
		         document.getElementById("F161002").style.display = "inline";
		         document.getElementById("F261002").style.display = "inline";
		         document.getElementById("F361002").style.display = "inline";
		         
		         document.getElementById("Label1").style.display = "none";
		         document.getElementById("Label2").style.display = "none";
		         document.getElementById("Label3").style.display = "none";
		         document.getElementById("Label4").style.display = "none";
		         document.getElementById("Label5").style.display = "none";
		         document.getElementById("Label6").style.display = "none";
		         
		         document.getElementById("Label7").style.display = "inline";
		         document.getElementById("Label8").style.display = "inline";
		         document.getElementById("Label9").style.display = "inline";
		         document.getElementById("Label10").style.display = "inline";
		         document.getElementById("Label11").style.display = "inline";
		         document.getElementById("Label12").style.display = "inline";
		         
		         //document.getElementById("Label13").style.display = "none";
		         //document.getElementById("Label14").style.display = "inline";
		         
		         document.getElementById("Label15").style.display = "inline";
		         
		         setSelFindByValue("drptipoviaje","2");
		      }
		      
		    }
		//--------------------------------------------------------------------------------------			
        function isNull(val)
          {
           if (String(val) == 'null' || String(val) == '' || String(val) == 'undefined')
              val='';
          
            return(String(val));
          }
          
         function isNull_block(val, id_imput)
          {
           if (String(val) == 'null' || String(val) == '' || String(val) == 'undefined')
            {  
				val='';
				document.getElementById(id_imput).disabled = false;
            }
            else
            {
              document.getElementById(id_imput).disabled = true;
            }
          
            return(String(val));
          }  
 
        function Asig_cmb(pos,cmb,desc,cod)
           {
              cmb.options[pos] = new Option(desc,cod,'', '');
		      cmb.options[pos].selected = true;

           }  			
		function M(Nom_obj)
			{
     		if(String(document.getElementById(Nom_obj).style.display)=='none' )
			   document.getElementById(Nom_obj).style.display = 'block';
			else   
			   document.getElementById(Nom_obj).style.display = 'none';
			}		
		
//--------------------------------------------------------------------------------------	
          
			function borrar()
			{
				//document.getElementById('tablaprimasseguro').innerHTML = "";
				document.getElementById("cotizacion").style.visibility = "visible";  
                document.getElementById("resultados").style.display = "none";
           	}


			function borrardatos()
			{
			   	document.all("txtnombres").value = "";
				document.all("txtapell1").value = "";
				document.all("txtapell2").value = "";
				document.all("txtdia").value = "";
				document.all("txtmes").value = "";
				document.all("txtanio").value = "";
				document.all("txtedad").value = "";
				
				setSelFindByValue("drpsexo","1");
				setSelFindByValue("drptipoviaje","1");
			}
            
            
			function getRadioButtonValue (radio)
			{  
				for (var i = 0; i < radio.length; i++){   
				if (radio[i].checked){break}
				}
				
				return radio[i].value
			}
			 
			 
			 function mayuscula(obj)
			 {
				obj.value  = obj.value.toUpperCase();
				obj.value = ltrim(obj.value);
			 }
			 
			 
			 function minuscula(obj)
			 {
				obj.value  = obj.value.toLowerCase();
				obj.value = ltrim(obj.value);
			 }
			 
			 function normal(obj)
			 {
				obj.value = ltrim(obj.value);
			 }
			 
			 
			   function EsFecha(InString,formato)
             {
             
				if (formato == "dma"){
					dia=InString.substring(0,2);
					mes=InString.substring(3,5);
					anyo=InString.substring(6,10);
				}
				
				if (formato == "mda"){
					mes=InString.substring(0,2);
					dia=InString.substring(3,5);
					anyo=InString.substring(6,10);
				}
				
				if (formato == "amd"){
					anyo=InString.substring(0,4);
					mes=InString.substring(5,7);
					dia=InString.substring(8,10);
				}
				
				if (dia == '08') dia = '8';	// parseInt("08") == 10		base octogonal
				if (dia == '09') dia = '9';	// parseInt("09") == 11		base octogonal
				if (mes == '08') mes = '8';	// parseInt("08") == 10		base octogonal
				if (mes == '09') mes = '9'; // parseInt("09") == 11		base octogonal
				
				dia=parseInt(dia);
				mes=parseInt(mes);
				anyo=parseInt(anyo);
				if (anyo < 1900) return false;    // Anyo mayor a 1900 (por la Base de Datos)
				mes = mes - 1;  // El mes se representa del 0 al 11 (solo para la validación)
				esfecha = new Date(anyo,mes,dia);
				if (dia == esfecha.getDate()){
					if(mes == esfecha.getMonth()){
						if(anyo == esfecha.getFullYear()){
							return true;
						}
					}
				}
				
			return false;
		  }
		  
		  function Mascara(InString, Mask) {
				LenStr = InString.length;
    			LenMsk = Mask.length;
    			if ((LenStr==0) || (LenMsk==0))
    				return false;
    			if (LenStr != LenMsk)
    				return false;
    			TempString=""
    			for (Cont=0; Cont < InString.length; Cont++) {
    				StrChar = InString.charAt(Cont);
    				MskChar = Mask.charAt(Cont);
    				if (MskChar == '9') {
    					if(!esNumerico(StrChar))
    						return false;
    				}else {
    					if (MskChar != StrChar) // compara otros caracteres
    						return false;		// ej: los / de la fecha
    				}
    			}
    			return true;
		}
		
		function esNumerico(Char) {
    			if(Char.length!=1) 
    				return false;
    			RefString="1234567890";
    			if (RefString.indexOf(Char, 0) == -1) 
    				return false;
    			return true;
		}
		
		
		   function MuestraEdad()
		    {
		    
		      if( isNull(document.all("txtdia").value) == '' || isNull(document.all("txtmes").value) == '' || isNull(document.all("txtanio").value) == '' )
		      {
		          document.all("txtedad").value = '';
		          return false;
		      }
		    
		      var fechita = '';
              fechita = document.all("txtdia").value + '-'  + document.all("txtmes").value + '-' + document.all("txtanio").value;
            
              if(ValidaFecha(fechita))
              {
               	 document.all("txtedad").value = SacaEdad(fechita); 	
		      }else document.all("txtedad").value = '';
             
		    }
		
		
		 function ValidaFecha(Obj)
		 {
		 
		        if(Obj == '')return true;
		    
				 if (!EsFecha(Obj,'dma')){alert('Fecha no v\xE1lida, ingresela nuevamente');return false;}
				
				
				
				/* VALIDA EDAD */
				var edad=0;
				
				//Fecha Nac. usuario
				var s=Obj;
				var dia=s.substr(0,2);
				var mes=s.substr(3,2);
				var ano=s.substr(6,4);
		           
				//Fecha actual
				var l_hoy = new Date(Date());
				var l_dia = l_hoy.getDate();
				var l_mes = l_hoy.getMonth()+1;
				var l_ano = l_hoy.getYear();
		        
	   			edad = SacaEdad(s);
	   			
				if(edad > 69){alert('Edad no puede ser mayor a 69 a\xF1os');return false;}
				 
 	   			
	   	
	   	 	return true ;
				

	   			    

	   			    
		}
	
	     	
		 function ltrim(InString) 
		 {
			n = i = 0;
			while (i < InString.length) {
				if (InString.charAt(i) != " ") {
					n = i
					break
				}
				i++
			}
			if (n == 0 && i == InString.length)
				InString = ''
			else
				InString = InString.substring(n, InString.length)
			return InString;
		}
		
		
		
		
		function SacaEdad(fecha)
		{
		
			var edad=0;

			//Fecha Nac. usuario
			var s=fecha;
			var dia=s.substr(0,2);
			var mes=s.substr(3,2);
			var ano=s.substr(6,4);
				
			//Fecha actual
			var l_hoy = new Date(Date());
			var l_dia = l_hoy.getDate();
			var l_mes = l_hoy.getMonth()+1;
			var l_ano = l_hoy.getUTCFullYear(); 
			
			if(l_mes < 10)
				l_mes = "0" + l_mes;
			
			
			
			/////// CALCULA EDAD //////
		    if(mes > l_mes)
	   		{
	   			edad = parseInt(l_ano) - parseInt(ano) - 1;
	   		}else{
	   		 
	   			if(mes == l_mes )
	   			{
	   				if(dia > l_dia)
	   				{
	   				   edad = (parseInt(l_ano) - parseInt(ano)) - 1;
		   			}else{
	   				   edad = parseInt(l_ano) - parseInt(ano);
	   				}
	   			}else{
	   			   edad = (parseInt(l_ano) - parseInt(ano));
	   			}
	   		 }
		   /////////////////////////	
			

			return edad;   
       }
       
       
       
       
       /***********************
		*      TERCERO        * 
		***********************/
       
       /*---------------------------------------------------------------------------------------*/		
            //DATOS CONTRATANTE
			function fTercero(obj)
			{
			
			  var NumRut = String(obj.value);
			    
				if (String(NumRut)!="undefined" && ltrim(NumRut) != '')
				{
				
				  if(!(ChequeaRut(obj)))
				  {
				      alert('Por favor! ingrese Rut v\xE1lido');
				      obj.value = '';
				  }else{
				      TB_show('Espere un momento, estamos actualizando los datos', '../images/loader.gif', true)
					  Emision.Carga_Tercero(String(NumRut),Carga_Tercero_CallBack)
				   }
				
				}
			
			}

			function Carga_Tercero_CallBack(res)
			{
		
			  r = res.value;
			  
			  
			  if(r != null && typeof(r) == "object" )  
			  {
			     document.all("txtnomcont").value = isNull_block(r.NOM_TERCERO,'txtnomcont'); 
			     document.all("txtapell1cont").value = isNull_block(r.APE1_TERCERO,'txtapell1cont');
			     document.all("txtapell2cont").value =  isNull_block(r.APE2_TERCERO,'txtapell2cont');
			     document.all("txtdirecont").value = isNull_block(r.NOM_DOMICILIO1,'txtdirecont');
			      
				if (isNull(r.TLF_PAIS)=='')
					document.all("txttelpaiscont").value = '56';
				else
					document.all("txttelpaiscont").value = isNull_block(r.TLF_PAIS,'txttelpaiscont') ;  

			
				document.all("txttelzonacont").value = isNull_block(r.TLF_ZONA,'txttelzonacont') ;
				document.all("txttelecont").value = isNull_block(r.TLF_NUMERO,'txttelecont') ;
			   
			    cmbRegion = document.all("drpregcont");
				cmbCiudad = document.all("drpciudadcont");
				cmbComuna = document.all("drpcomucont");
		
			 	limpiaCombo(cmbCiudad);
				limpiaCombo(cmbComuna);
				
				if(isNull(r.COD_ESTADO) == '')
				{
				  setSelFindByValue("drpregcont","0");
				  limpiaCombo(cmbCiudad);
				  limpiaCombo(cmbComuna);
	
				}else{
				
				    setSelFindByValue_block("drpregcont",r.COD_ESTADO);
				
				    /// Cargar Ciudad y Comuna (todas segun codigo) y fijar indice ///
					fCiudad('drpregcont','drpciudadcont','drpcomucont');
					Emision.tiempo();
					setSelFindByValue("drpciudadcont",r.COD_PROV);


					fComuna('drpciudadcont','drpcomucont');
					Emision.tiempo();
					setSelFindByValue_block("drpcomucont",r.COD_LOCALIDAD);		  
				   //////////////////////////////////////////////////////////////////
				  
				  
				}
			
			  }else{
			
			     document.all("txtnomcont").value = ''; 
			     document.all("txtnomcont").disabled = false; 
			      
			     document.all("txtapell1cont").value = '';
			     document.all("txtapell1cont").disabled = false; 
			     
			     document.all("txtapell2cont").value =  '';
			     document.all("txtapell2cont").disabled = false; 
			     
			     document.all("txtdirecont").value = '';
			     document.all("txtdirecont").disabled = false; 
			     
			     document.all("txttelpaiscont").value = '56';
			     document.all("txttelpaiscont").disabled = false; 
			     
			     document.all("txttelzonacont").value = '02';
			     document.all("txttelzonacont").disabled = false; 
			     
				 document.all("txttelecont").value = '';
				 document.all("txttelecont").disabled = false; 
				 
				 cmbRegion = document.all("drpregcont");
				 document.all("drpregcont").disabled = false; ;
				 
				 cmbCiudad = document.all("drpciudadcont");
				 document.all("drpciudadcont").disabled = false; ;
				 
				 cmbComuna = document.all("drpcomucont");
				 document.all("drpcomucont").disabled = false; ;
				 
				 setSelFindByValue("drpregcont","0");
				 limpiaCombo(cmbCiudad);
				 limpiaCombo(cmbComuna);
				 
		
			  }
			
			  TB_remove();
			}
			
			
//--------------------------------------------------------------------------------------	

//DATOS ASEGURADO (MODALIDAD DE COPIAR)

			function fTerceroAseg(region,ciudad,comuna)
			  {
			   
			    cmbRegion = document.all("drpregaseg");
				cmbCiudad = document.all("drpciudadaseg");
				cmbComuna = document.all("drpcomuaseg");
		
			 	limpiaCombo(cmbCiudad);
				limpiaCombo(cmbComuna);
				
				setSelFindByValue("drpregaseg",region);
			
				/// Cargar Ciudad y Comuna (todas segun codigo) y fijar indice ///
				fCiudad('drpregaseg','drpciudadaseg','drpcomuaseg');
				Emision.tiempo();
				setSelFindByValue("drpciudadaseg",ciudad);

				fComuna('drpciudadaseg','drpcomuaseg');
				Emision.tiempo();
				setSelFindByValue("drpcomuaseg",comuna);	
				
				TB_remove();			  
		      }

//--------------------------------------------------------------------------------------	


		
	   /***********************
		*     UBICACIONES     * 
		***********************/
//----------------------------<< CIUDAD >>-----------------------------------------------		
        var cmb1
        var cmb2
        var cmb3
         
		function fCiudad(c1,c2,c3)
		{
		cmb1 =String(c1);
		cmb2 =String(c2);
		cmb3 =String(c3);
		
		 
		 if(!(document.all(cmb1).value == '0'))
		 {
		 
		 codigo = parseInt(document.all(cmb1).value);
		 if (codigo > 0)
		    {
		      Emision.Carga_Ciudad(codigo,Carga_Ciudad_CallBack)
		    }   
		 }else{
		 
		   limpiaCombo(document.all(cmb2));
		   limpiaCombo(document.all(cmb3));
		 
		 }
		 
		 
		    
		}
		
		function Carga_Ciudad_CallBack(res)
		{
  		  var ds = res.value ;
		  var cmb = document.all(cmb2);
		
		  limpiaCombo(cmb);
		  limpiaCombo(document.all(cmb3));
		  
		  if(ds != null && ds.Tables != null && typeof(ds) == "object" )
		  
			  for (var i = 0; i < ds.Tables[0].Rows.length ; i++) 
		 			cmb.options[i+1] = new Option(ds.Tables[0].Rows[i].NOM_PROV,+
		 			                              ds.Tables[0].Rows[i].COD_PROV,+
		 			                              '', '');

		  else
			     alert("Error. [3001] " + res.request.responseText); 
		}
		
//---------------------------<< COMUNA >>------------------------------------------------		
		
		function fComuna(c2,c3)
		{
		
		cmb2 =String(c2);
		cmb3 =String(c3);
		
		 codigo = parseInt(document.all(cmb2).value);
		 if (codigo > 0)
		     Emision.Carga_Comuna(codigo,Carga_Comuna_CallBack)
		}
		
		function Carga_Comuna_CallBack(res)
		{
		   	var ds = res.value ;
			var cmb = document.all(cmb3);
          limpiaCombo(cmb);
		  if(ds != null && ds.Tables != null && typeof(ds) == "object" )
			  for (var i = 0; i < ds.Tables[0].Rows.length ; i++) 
		 			cmb.options[i+1] = new Option(ds.Tables[0].Rows[i].NOM_LOCALIDAD,+
		 			                              ds.Tables[0].Rows[i].COD_LOCALIDAD,+
		 			                              '', '');
		  else
			     alert("Error. [3001] " + res.request.responseText); 
	   
		}
/*---------------------------------------------------------------------------------------*/		
		
//Válida Números [NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57]
var nav4 = window.Event ? true : false;
function acceptNum(evt){	 	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
}		



/*---------------------------------------------------------------------------------------*/		


 function validapac()
 {
	
	
	
	if (document.all("drpbanco").value == '0' || document.all("drpbanco").value == '' )
	{
	  alert("Por favor, ingrese el banco");
	  document.all("drpbanco").focus();
	  return false;
	}
	
	
	if (document.all("drptarjeta").value == '0' || document.all("drptarjeta").value == '' )
	{
	  alert("Por favor, ingrese la tarjeta");
	  document.all("drptarjeta").focus();
	  return false;
	}
	
		 
		//Válida Tarjeta
		if(isNull(document.Form1.nrotarjeta.value) == '')
		{
			alert('Por Favor! debe ingresar el n\xFAmero de Tarjeta');       
			document.Form1.nrotarjeta.focus();
			return false;
		}
		
		if(!(isCreditCard(document.Form1.nrotarjeta.value)))
		{
			alert('N\xFAmero de tarjeta no es correcto')
			document.Form1.nrotarjeta.focus();
			return false;
		}
		
		
	
		
		
		
		//Válida tipos de tarjeta
		if(document.all("drptarjeta").value == '1')
		{
		   if(!(isVisa(document.Form1.nrotarjeta.value))){alert('N\xFAmero Tarjeta Visa no v\xE1lido');document.Form1.nrotarjeta.focus();return false;}
		}		
		
		if(document.all("drptarjeta").value == '2')
		{
		  if(!(isMasterCard(document.Form1.nrotarjeta.value))){alert('N\xFAmero Tarjeta MasterCard no v\xE1lido');document.Form1.nrotarjeta.focus();return false;} 
		}
		
		
		if(document.all("drptarjeta").value == '3')
		{
		  if(!(isDinersClub(document.Form1.nrotarjeta.value))){alert('N\xFAmero Tarjeta Diners no v\xE1lido');document.Form1.nrotarjeta.focus();return false;}
		}
		
		if(document.all("drptarjeta").value == '4')
		{
		  if(!(isAmericanExpress(document.Form1.nrotarjeta.value))){alert('N\xFAmero Tarjeta A.Express no v\xE1lido');document.Form1.nrotarjeta.focus();return false;}  
		}
		
		
		//Válida vencimiento de tarjeta
		if(isNull(document.Form1.mesvencimiento.value) == '')
		{
			alert('Por Favor! debe ingresar el Mes de Vencimiento');
			document.Form1.mesvencimiento.focus();
			return false;
		}
		
		if(parseInt(document.Form1.mesvencimiento.value) < 1 || parseInt(document.Form1.mesvencimiento.value) > 12 )
		{
		
	 	    alert('Por Favor! ingrese Mes de Vencimiento v\xE1lido [1..12] ');
			document.Form1.mesvencimiento.value = '';
			document.Form1.mesvencimiento.focus();
		    return false;
		}
		
		
		
		
		
		if(isNull(document.Form1.aniovencimiento.value) == '')
		{
			alert('Por Favor! debe ingresar el A\xF1o de Vencimiento');
			document.Form1.aniovencimiento.focus();
			return false;
		}
         
         
         var l_hoy = new Date(Date());
         var l_ano = l_hoy.getYear();
       
        if(parseInt(document.Form1.aniovencimiento.value) < parseInt(l_ano)  || parseInt(document.Form1.aniovencimiento.value) > 2100 )
        {
            alert('Por Favor! ingrese A\xF1o de Vencimiento v\xE1lido');
			document.Form1.aniovencimiento.value = '';
			document.Form1.aniovencimiento.focus();
			return false;
        } 
       
      
		
   return true;
 
 }
		
		

///////////////////
/*  VALIDA RUT   */
///////////////////

function ChequeaRut(obj)
{
	

    Char = obj.value;    

    Char = ltrim(Char);
    
     if(parseInt(Char) < 1 )return false;
       
   
        
	var letra
	letra = '';
	var varrut = '';
	var dv = '';


	if (Char != '')
	{
		Char = reemplazaString(Char ,'.','');
		Char = reemplazaString(Char ,'-','');
		

        j=1;
		dv = Char.charAt(Char.length - 1);
		for (i=Char.length-2; i >= 0;i--)
		{
			letra = Char.charAt(i)
			if (j == 3 && Char.length > 4 ){
				letra = '.' + letra;
				j = 1;
			}
			else {
				j = j + 1;
			}
			varrut = letra + varrut;
		}

                    
		
		Char = varrut + '-' + dv;
		
		if (!ValidaRutFormateado(Char)){
		           
                   return false;
		}

        obj.value = String(Char);  
		return true;
	}
}

function ValidaRutFormateado(Char) {

	var dvr = '0'
	suma = 0
	mult = 2
	strRut = Char
	if (strRut.length<0 && strRut.length>12)
		return false;
	strChar = strRut.substring(0, strRut.length-2);
	strObjDig = strRut.substring(strRut.length-1);
	for ( i = strChar.length - 1 ; i >= 0 ; i -- ) {
		if (strChar.charAt(i)!='.' && strChar.charAt(i)!='-'){
			suma = suma + strChar.charAt(i) * mult;
			if ( mult == 7 )
				mult = 2;
			else
				mult ++;
		}
	}
	res = suma % 11;
	if ( res == 1 )
		dvr = 'k';
	else {
		if ( res == 0 )
			dvr = '0';
		else {
			dvi = 11 - res;
			dvr = dvi + "";
		}
	}
	if ( dvr != strObjDig.toLowerCase() )
		return false;
	return true;
}



function reemplazaString(InString,encontrar,remplaza){
    pos=0;
    while(pos >= 0){
		pos=InString.indexOf(encontrar);
		if(pos < 0) return InString;
		Strinicio=InString.substring(0,pos);
		Strfin=InString.substring(pos + encontrar.length,InString.length);
		InString=Strinicio + remplaza + Strfin;
    }
}


function verifica_email(mail)
{
	resultado = true;	
	largo=mail.length;
	posicion=largo-1;	
	str=mail;
	
	if(ltrim(str)=="")return false;
	
	while (str!="")
	{
			car=str.charAt(0);
			if (
				((car.charCodeAt(0)>=65) && (car.charCodeAt(0)<=90))
				|| ((car.charCodeAt(0)>=97) && (car.charCodeAt(0)<=122))
				|| ((car.charCodeAt(0)>=48) && (car.charCodeAt(0)<=57))
				|| (car.charCodeAt(0)==45)
				|| (car.charCodeAt(0)==46)
				|| (car.charCodeAt(0)==64)
				|| (car.charCodeAt(0)==95))
				{
					str=str.substr(1);
			        
				}
			else 
				{	
						resultado=false
						break
				}                       
	}
		
	
	if (mail.charAt(posicion)== ".")
	{
		resultado = false;
	}
	
	posicion = mail.indexOf("@")
	if (posicion == "-1" || posicion == "0")
	{
		resultado = false;
	}

	posicion = mail.indexOf(".",posicion)

	if (posicion  == "-1")
	{
		resultado = false;
	}
	if (resultado  == false)
	{
		alert("Ingrese Correctamente su email. Ej: 'mrojas@mapfre.cl'");
		document.Form1.txtcorreo.value = "";
	}
	
	return resultado
}		


function copiardatos()
{

var rutcontratante  = stripCharsInBag(document.all("txtrutcont").value ,".- ");
 
 
    if(document.all("txtrutaseg").value == rutcontratante)
    {
        document.all("txtnomaseg").value = document.all("txtnomcont").value;
        document.all("txtapell1aseg").value = document.all("txtapell1cont").value; 
        document.all("txtapell2aseg").value = document.all("txtapell2cont").value; 
        document.all("txtdireaseg").value = document.all("txtdirecont").value; 
        document.all("txttelpaisaseg").value = document.all("txttelpaiscont").value; 
        document.all("txttelzonaaseg").value = document.all("txttelzonacont").value; 
        document.all("txtteleaseg").value = document.all("txttelecont").value; 
        
        //TB_show('Espere un momento, estamos actualizando los datos', '../images/loader.gif', true)
        
        fTerceroAseg(document.all("drpregcont").value,document.all("drpciudadcont").value,document.all("drpcomucont").value);
        
    }else alert('No se puede copiar ya que no es la misma persona');
}




       function VerPlanPago()
	   {

	      if(Form1.rdoformpago[0].checked)
	      {
	          document.getElementById("pat").style.display = "inline";
	      }
	     
	      if(Form1.rdoformpago[1].checked)
	      {
	          document.getElementById("pat").style.display = "none";
	          document.getElementById("nrotarjeta").innerText = "";
	          document.getElementById("mesvencimiento").innerText = "";
	          document.getElementById("aniovencimiento").innerText = "";
	      }
	   
	   }



        function VerBenef()
        {
        
          if(Form1.rdobene[0].checked)
	      {
	          
	       document.getElementById("bene").style.display = "none";
	      }
	      
	     
	      if(Form1.rdobene[1].checked)
	      {
	        document.getElementById("bene").style.display = "inline";
	      }
        
          
        }


function popup(url, ancho, alto)
{
	pWin = window.open (url, 'newWin', 'width=' + ancho + ',height=' + alto +',scrollbars=0,satus=0,menubar=no,top=200,left=350')
	if (window.pWin) 
		pWin.focus()
}


    function mOver(which){ which.style.background='#FFFFD2' } 
	function mOver2(which){ which.style.background='#FFFFF0' } 
	function mOut(which){ which.style.background='#FFFFFF' } 
	function mOut2(which){ which.style.background='#F4FAFF' }
	function mOut3(which){ which.style.background='#f2f2f2' }
	function mOut4(which){ which.style.background='#ffeeea' }	
	
	

function RUT_Unreformat(rut)
{

 	if ( rut.length > 10)

   		rut = rut.substring(0,rut.indexOf('.',0))+
   						rut.substring(rut.indexOf('.',0)+1,rut.indexOf('.',0)+4)+
   						rut.substring(rut.indexOf('.',0)+5,rut.indexOf('.',0)+8)+
   						rut.substring(rut.indexOf('.',0)+9,rut.indexOf('.',0)+10);
   	else
		rut = rut.substring(0,rut.indexOf('.',0))+ 
				rut.substring(0,rut.length-2)+ 
				rut.substring(rut.length -1, rut.length) 
    return String(rut)
}
       
       
function SelCob(obj)
{
var rdo		= obj.id.replace('rdo','');
var tbl		= document.getElementById('Table4');
var tbl2	= document.getElementById('tblCobNoAnual');
var tr		= document.getElementById('tr_rango_fec');

// document.getElementById('tablaprimasseguro').innerHTML = '';
  document.getElementById("txtfec1_1").disabled = false;
  document.getElementById("txtfec1_2").disabled = false;
  document.getElementById("txtfec1_3").disabled = false;
  
  document.getElementById("txtfec2_1").disabled = false;
  document.getElementById("txtfec2_2").disabled = false;
  document.getElementById("txtfec2_3").disabled = false;

 borrar();
 CargaTabla(this.value);
 
 
 
 
 
 
  if(rdo == "365" ) 
  {
     tbl.style.display  = 'block';
     tbl2.style.display = 'none';
  }
  else
  {
		tbl.style.display = 'none';
		tbl2.style.display = 'block';
     
		if(rdo == "15" )
		{
			tbl.style.display = 'none';
			tbl2.style.display = 'block';
		}
		  
		if(rdo == "8" )
		{
			tbl.style.display = 'none';
		}
		
		if(document.getElementById('drptipoviaje').value == '2')//Europa
		{
		document.getElementById('lblAsisViajeMont').innerHTML = '30.000';
		document.getElementById('lblAsisViajeNom').innerHTML = ' en Euros';
		}
		else
		{
		document.getElementById('lblAsisViajeMont').innerHTML = '250'
		document.getElementById('lblAsisViajeNom').innerHTML = ''
		}
		
		//
		//
		
		//document.getElementById("txtfec1_1").value = "";
		//document.getElementById("txtfec1_2").value = "";
		//document.getElementById("txtfec1_3").value = "";
        
        fmaniana('txtfec1_1','txtfec1_2','txtfec1_3');
        
		document.getElementById("txtfec2_1").value = "";
		document.getElementById("txtfec2_2").value = "";
		document.getElementById("txtfec2_3").value = "";

  }
  
 tr.style.display = tbl2.style.display;

}    
//--------------------------------------------------------------------------------------------   
function frango_anual()
{
		var v =   Cotizador.frango_fec_anual();
    
        var f = v.value.split('|')[0];
        
		document.getElementById("txtfec1_1").value = f.split('/')[0];
		document.getElementById("txtfec1_2").value = f.split('/')[1];
		document.getElementById("txtfec1_3").value = f.split('/')[2];
          
            f =  v.value.split('|')[1];
          
		document.getElementById("txtfec2_1").value = f.split('/')[0];
		document.getElementById("txtfec2_2").value = f.split('/')[1];
		document.getElementById("txtfec2_3").value = f.split('/')[2];

}
//--------------------------------------------------------------------------------------------   
function frango_fec()
{

var d =	document.getElementById("txtfec1_1").value;
var m =	document.getElementById("txtfec1_2").value;
var y = document.getElementById("txtfec1_3").value;

var d2 = document.getElementById("txtfec2_1").value;
var m2 = document.getElementById("txtfec2_2").value;
var y2 = document.getElementById("txtfec2_3").value;



if (d == "" || m == "" || y == "" ||
    d2 == "" || m2 == "" || y2 == "") return false;

var ndias;
if(document.getElementById("rdo8").checked) ndias = 8
if(document.getElementById("rdo15").checked)ndias = 15

												      

try
{
	var val =   Cotizador.frango_fec(d  +'/' + m  +'/'+ y, 
	                                 d2 +'/' + m2 +'/'+ y2,
	                                 ndias);
    var v = val.value;	                                 
	                                 
	if(v.indexOf('OK') < 0 ) throw  v
	
	//rdo_checked();
	
	
	if(v.indexOf('|') > 0 ) 
	{
	  
	  var ndiasAUX = v.split('|')[1];
	  
	  if(ndiasAUX == ndias ) return false;
	  
	  document.getElementById("rdo"+ndiasAUX).checked = true;
	  document.getElementById("rdo"+ndias).checked = false;
	  
	  if(ndiasAUX == '365' )
	  {
	  
	     SelCob(document.getElementById('rdo365'));
	     alert('El periodo de cobertura fue modificado automaticamente de : \n [ hasta ' + ndias + ' dias ]  por prima anual' )
	  }
	  else
	  {
		alert('El periodo de cobertura fue modificado automaticamente de : \n [ hasta ' + ndias + ' dias ] ' + 
				' por [ hasta '+ ndiasAUX + ' dias ] ' )
       }
	}
	
	var fec2 = val.value.split('/');
	 


}
catch(e)
{
 if(val.value != null)alert(val.value);
  
   fmaniana('txtfec1_1','txtfec1_2','txtfec1_3');
  
  document.getElementById("txtfec2_1").value = "";
  document.getElementById("txtfec2_2").value = "";
  document.getElementById("txtfec2_3").value = "";
  
}

}


function fmaniana(id_dd,id_mm,id_yyyy)
{
	var v = Cotizador.ffec_maniana();

	document.getElementById(id_dd).value   = v.value.split('/')[0];
	document.getElementById(id_mm).value   = v.value.split('/')[1];
	document.getElementById(id_yyyy).value = v.value.split('/')[2];

}

function rdo_checked(name)
{
 for(var i = 0; i < document.forms.item(0).name.length;i++) 
 {
   if(document.forms.item(0).name[i].checked) return document.forms.item(0).name[i].id
 }
}


function fplan(tviaje,ndias)
{
   var plan = '';
   if (tviaje =='1')//Resto del mundo
	 {
		if(ndias  == '8')plan = '150'; 
		if(ndias  == '15')plan = '151';
		if(ndias  == '365')plan = '152';
     } 
   else//Europa
       {
 	     if (ndias== '8')plan = '153';
		 if (ndias== '15')plan = '154';
		 if (ndias  == '365')plan = '155';
       }
   return  plan;   
}

