
function fnEstimateRemLen(valor)
			{
				//alert(valor)
				
				//alert(valor)
				//alert(valor)
				
				var Maxlen = 2720;
				
				var len = eval('document.'+valor+'.Txt_Comentarios.value.length');
				// document.getElementById("Txt_Comentarios").value.length ;		
				var lenRem = Maxlen - len;
						
				if (lenRem > 0)
				{
					eval('document.'+valor+'.txt_len.value="('+ lenRem + ')"')
				}
				
				if (lenRem == 0)
				{
					eval('document.'+valor+'.txt_len.value= "( 0 )"');
				}
				if (lenRem < 0)
				{
					if ( event.keyCode != 8 && event.keyCode != 46 && event.keyCode != 37 && event.keyCode != 38 && event.keyCode != 39 && event.keyCode != 40)
					{
						eval('document.'+valor+'.Txt_Comentarios.value = document.'+valor+'.Txt_Comentarios.value.substr(0, Maxlen)') ;
						len = eval('document.'+valor+'.Txt_Comentarios.value.length');
						lenRem = Maxlen - len;
						//eval('document.'+valor+'.txt_len.value')  = "( " + lenRem + " )";
						eval('document.'+valor+'.txt_len.value= "( "' + lenRem + '" )"');
						return false;
					}
						
				}
			}

/*
function CambioMotivo()
{
	alert(document.all.cmb_motivo.value)
	
	if ( eval('document.all.cmb_motivo') )
	{
		if (eval('document.all.cmb_motivo.value') == 2  && eval('document.all.cmb_linea.selectedIndex') == 0) 
		{
		    alert('Favor indique la línea de Negocio a la cual dirige su cotización');
		    Document.all.cmb_linea.focus();
		    return false;
		}
	}
		
}*/

function CambioMotivo (valor) 
{
	
	if (valor=='form_contacto')
  {
  		if (document.getElementById('cmb_motivo_cto').value == '2')
  		{
  			document.getElementById('trln_cto').style.display=VISIBLE;
  			document.getElementById('cmb_linea').selectedIndex=0;
  		}
  		else
  			 document.getElementById('trln_cto').style.display=OCULTO;
  }
  else
  {
  		if (document.getElementById('cmb_motivo').value == '2')
  		{
  			document.getElementById('trln').style.display=VISIBLE;
  			document.getElementById('cmb_linea').selectedIndex=0;
  		}
  		else
  			 document.getElementById('trln').style.display=OCULTO;
  }
  
}


function ValidaForm(valor)
{
	
	Txt_Nombre			= eval('document.'+valor+'.Txt_Nombre.value')
	Txt_ApPaterno		= eval('document.'+valor+'.Txt_ApPaterno.value')
	Txt_ApMaterno		= eval('document.'+valor+'.Txt_ApMaterno.value')
	
	Txt_Fono			= eval('document.'+valor+'.Txt_Fono.value')
	Txt_FonoMovil		= eval('document.'+valor+'.Txt_FonoMovil.value')
	Txt_Email			= eval('document.'+valor+'.Txt_Email.value')
	//Txt_Email_Valida	= eval('document.'+valor+'.Txt_Email_Valida.value')
	Txt_Comentarios		= eval('document.'+valor+'.Txt_Comentarios.value')
	
	Txt_Direccion		= eval('document.'+valor+'.Txt_Direccion.value')
	Txt_Comuna			= eval('document.'+valor+'.Txt_Comuna.value')
	Txt_Ciudad			= eval('document.'+valor+'.Txt_Ciudad.value')
	Txt_Region			= eval('document.'+valor+'.Txt_Region.value')
	
	

	

	if (Vacio(eval('document.'+valor+'.Txt_Nombre')  ,"Debe ingresar su Nombre")&&
			Vacio(eval('document.'+valor+'.Txt_ApPaterno') ,"Debe ingresar su Apellido Paterno")&&
			Vacio(eval('document.'+valor+'.Txt_ApMaterno')  ,"Debe ingresar su Apellido Materno")&&
			
			
			//Vacio(eval('document.'+valor+'.Txt_Direccion') ,"Debe ingresar su Dirección")&&
			//Vacio(eval('document.'+valor+'.Txt_Comuna')  ,"Debe ingresar su Comuna")&&
			//Vacio(eval('document.'+valor+'.Txt_Ciudad')  ,"Debe ingresar Ciudad")&&
			Vacio(eval('document.'+valor+'.Txt_Region')  ,"Debe ingresar Región")&&
			
			
			
		    
			
			Vacio(eval('document.'+valor+'.Txt_Email')  ,"Debe ingresar su Email")&&
			mail(eval('document.'+valor+'.Txt_Email.value'))&&
			//Vacio(eval('document.'+valor+'.Txt_Email_Valida')  ,"Debe ingresar su Email de Verificación")&&
			//mail(eval('document.'+valor+'.Txt_Email_Valida.value'))&&
			Vacio(eval('document.'+valor+'.Txt_Comentarios')  ,"Debe ingresar sus Comentarios")
			)
	{
	
		if( (document.getElementsByName("Txt_Corredora").length)>0)
		{
			//alert(eval('document.'+valor+'.Txt_Corredora.value'))		
			if (eval('document.'+valor+'.Txt_Corredora.value') !="" )
			{
				alert('Debe ingresar Corredora');
				eval('document.'+valor+'.Txt_Corredora.focus()')	
				return false;
			}
		}		
	/*
	
		
	
				if ( Txt_Email == Txt_Email_Valida )
				{
					//alert('document.'+valor+'.submit()')
					
					if( (document.getElementsByName("form_linea").length)>0)
					{
						//alert("envía linea")
						eval('document.'+valor+'.Txt_valor_linea.value=document.form_linea.val_linea.value')
					}
					eval('document.'+valor+'.submit()')
				}
				else
				{
					alert("Mail no corresponde")
					eval('document.'+valor+'.Txt_Email_Valida.value="";')
					eval('document.'+valor+'.Txt_Email_Valida.focus()')
				}
				*/
				
				if ( (Txt_Fono=="") && (Txt_FonoMovil=="") )
				{
					alert("Debe ingresar Fono Fijo o Fono Móvil");
					return false;
				}
				//alert ('rut: ' + eval('document.'+valor+'.Txt_Rut'))
				//alert (document.getElementsByName("Txt_Rut").length)
				if (  (eval('document.'+valor+'.Txt_Rut') != undefined)  )
				{
					if  ( (document.getElementsByName("Txt_Rut").length)>0 )
					{
						
						if ( Vacio(eval('document.'+valor+'.Txt_Rut')  ,"Debe ingresar su Rut")&&
								verifica_rut(eval('document.'+valor+'.Txt_Rut'))
							)
						{
							if( (document.getElementsByName("form_linea").length)>0)
							{
								//alert("envía linea")
								eval('document.'+valor+'.Txt_valor_linea.value=document.form_linea.val_linea.value')
							}
							eval('document.'+valor+'.submit()')
						}
					}
					else
					{
							if( (document.getElementsByName("form_linea").length)>0)
							{
								//alert("envía linea")
								eval('document.'+valor+'.Txt_valor_linea.value=document.form_linea.val_linea.value')
							}
							eval('document.'+valor+'.submit()')				
					}
						
				}
				else
				{
					eval('document.'+valor+'.submit()')
				}
		 
		 
	}
	else
	{
		return false;
	}
}




function borrar(valor)
{
	eval('document.'+valor+'.Txt_Nombre.value="";')
	eval('document.'+valor+'.Txt_ApPaterno.value="";')
	eval('document.'+valor+'.Txt_ApMaterno.value="";')
	//eval('document.'+valor+'.Txt_Rut.value="";')
	eval('document.'+valor+'.Txt_Fono.value="";')
	eval('document.'+valor+'.Txt_FonoMovil.value="";')
	eval('document.'+valor+'.Txt_Email.value="";')
	//eval('document.'+valor+'.Txt_Email_Valida.value="";')
	eval('document.'+valor+'.Txt_Comentarios.value="";')
	eval('document.'+valor+'.Txt_Corredora.value="";')
	
	

}

