









function Ocultar(){
	document.getElementById('tablaRadio').style.display = 'none';
} 
function Mostrar(){
	document.getElementById('tablaRadio').style.display = 'inline';
	document.getElementById('tablaRadio').style.width = '100%';
} 

function mostrarLinea(){
	var index=document.forms.emailform.linea.selectedIndex;
	if (index==0){
		document.getElementById('trFamilia').style.display = 'none';
		document.getElementById('trProducto').style.display = 'none';
	}
	else{
			if(index==2){
					document.getElementById('trProducto').style.display = 'none';
					document.getElementById('trFamilia').style.display = 'block';
					cambiarFamilia();
				}
				else{
					document.getElementById('trFamilia').style.display = 'none';
					document.getElementById('trProducto').style.display = 'block';
					cambiarProducto();
				}
		}
}
function mostrarProducto(){
	var index=document.forms.emailform.linea.selectedIndex;
	if(index==0 || index==2){
		document.getElementById('trProducto').style.display = 'none';
		
	}
	else{
		document.getElementById('trProducto').style.display = 'block';
		cambiarProducto();
	}
}

function borrarOptionFamilia(){
	for (i=document.getElementById('familia').length-1; i>=0; i--){
		document.getElementById('familia').options[i] = null;
	}
}

function cambiarFamilia(){
	borrarOptionFamilia();
	document.getElementById('familia')[0] = new Option('-Elige una familia de productos-', "");
	
			document.getElementById('familia')[1] = new Option('Seguros de Vida');
			document.getElementById('familia')[1].value = 'Seguros de Vida';
	
			document.getElementById('familia')[2] = new Option('Seguros de Ahorro');
			document.getElementById('familia')[2].value = 'Seguros de Ahorro';
	
			document.getElementById('familia')[3] = new Option('Jubilación');
			document.getElementById('familia')[3].value = 'Jubilación';
	
			document.getElementById('familia')[4] = new Option('Inversión');
			document.getElementById('familia')[4].value = 'Inversión';
	
			document.getElementById('familia')[5] = new Option('Seguros de Salud');
			document.getElementById('familia')[5].value = 'Seguros de Salud';
	
}

function borrarOptionProducto(){
	for (i=document.getElementById('producto').length-1; i>=0; i--){
		document.getElementById('producto').options[i] = null;
	}
}

function cambiarProducto(){
	borrarOptionProducto();
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
	if (document.getElementById('linea').value == 'Promociones'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
	}
	else if (document.getElementById('linea').value == 'Autónomos'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
				document.getElementById('producto')[1] = new Option('Vida');
				document.getElementById('producto')[1].value = 'Vida';
	
				document.getElementById('producto')[2] = new Option('Seguro de Vida Protección Integral +');
				document.getElementById('producto')[2].value = 'Seguro de Vida Protección Integral +';
	
				document.getElementById('producto')[3] = new Option('Salud');
				document.getElementById('producto')[3].value = 'Salud';
	
				document.getElementById('producto')[4] = new Option('Poliplus Salud');
				document.getElementById('producto')[4].value = 'Poliplus Salud';
	
				document.getElementById('producto')[5] = new Option('Poliplus Salud PYMES');
				document.getElementById('producto')[5].value = 'Poliplus Salud PYMES';
	
				document.getElementById('producto')[6] = new Option('Incapacidad Temporal');
				document.getElementById('producto')[6].value = 'Incapacidad Temporal';
	
				document.getElementById('producto')[7] = new Option('Ahorro');
				document.getElementById('producto')[7].value = 'Ahorro';
	
				document.getElementById('producto')[8] = new Option('Aviva Vida Ahorro');
				document.getElementById('producto')[8].value = 'Aviva Vida Ahorro';
	
				document.getElementById('producto')[9] = new Option('Aviva PIAS Asegurado');
				document.getElementById('producto')[9].value = 'Aviva PIAS Asegurado';
	
				document.getElementById('producto')[10] = new Option('Planes de Pensiones');
				document.getElementById('producto')[10].value = 'Planes de Pensiones';
	
				document.getElementById('producto')[11] = new Option('Plusplan Gestión');
				document.getElementById('producto')[11].value = 'Plusplan Gestión';
	
				document.getElementById('producto')[12] = new Option('Plusplan Mixto');
				document.getElementById('producto')[12].value = 'Plusplan Mixto';
	
				document.getElementById('producto')[13] = new Option('Plusplan Renta Fija');
				document.getElementById('producto')[13].value = 'Plusplan Renta Fija';
	
				document.getElementById('producto')[14] = new Option('Plusplan Renta Variable');
				document.getElementById('producto')[14].value = 'Plusplan Renta Variable';
	
				document.getElementById('producto')[15] = new Option('Aviva Plan Protección');
				document.getElementById('producto')[15].value = 'Aviva Plan Protección';
	
				document.getElementById('producto')[16] = new Option('Aviva Espabolsa PP');
				document.getElementById('producto')[16].value = 'Aviva Espabolsa PP';
	
				document.getElementById('producto')[17] = new Option('Planes de Previsión Individual');
				document.getElementById('producto')[17].value = 'Planes de Previsión Individual';
	
				document.getElementById('producto')[18] = new Option('Plusplan de Jubilación');
				document.getElementById('producto')[18].value = 'Plusplan de Jubilación';
	
				document.getElementById('producto')[19] = new Option('Aviva Plan de Previsión Individual');
				document.getElementById('producto')[19].value = 'Aviva Plan de Previsión Individual';
	
				document.getElementById('producto')[20] = new Option('Aviva RFL, Plan de Previsión');
				document.getElementById('producto')[20].value = 'Aviva RFL, Plan de Previsión';
	
	}
	else if (document.getElementById('linea').value == 'Colectivos'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
				document.getElementById('producto')[1] = new Option('Vida Ahorro Colectivo');
				document.getElementById('producto')[1].value = 'Vida Ahorro Colectivo';
	
				document.getElementById('producto')[2] = new Option('Vida Riesgo Colectivo');
				document.getElementById('producto')[2].value = 'Vida Riesgo Colectivo';
	
				document.getElementById('producto')[3] = new Option('Plan de Pensiones Empleo');
				document.getElementById('producto')[3].value = 'Plan de Pensiones Empleo';
	
				document.getElementById('producto')[4] = new Option('Plan Previsión Social Empresarial Aviva');
				document.getElementById('producto')[4].value = 'Plan Previsión Social Empresarial Aviva';
	
	}
	else if (document.getElementById('linea').value == 'Particulares'){
		document.getElementById('trProducto').style.display = 'block';
	
					if (document.getElementById('familia').value == 'Seguros de Vida'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
							document.getElementById('producto')[1] = new Option('Vitalicios');
							document.getElementById('producto')[1].value = 'Vitalicios';
	
							document.getElementById('producto')[2] = new Option('Vida Entera');
							document.getElementById('producto')[2].value = 'Vida Entera';
	
							document.getElementById('producto')[3] = new Option('Temporal Renovable');
							document.getElementById('producto')[3].value = 'Temporal Renovable';
	
							document.getElementById('producto')[4] = new Option('Seguro de Vida Protección Integral +');
							document.getElementById('producto')[4].value = 'Seguro de Vida Protección Integral +';
	
							document.getElementById('producto')[5] = new Option('Aviva Seguro de Vida');
							document.getElementById('producto')[5].value = 'Aviva Seguro de Vida';
	
							document.getElementById('producto')[6] = new Option('Aviva Vida Ticket');
							document.getElementById('producto')[6].value = 'Aviva Vida Ticket';
	
							document.getElementById('producto')[7] = new Option('Temporal Definido');
							document.getElementById('producto')[7].value = 'Temporal Definido';
	
							document.getElementById('producto')[8] = new Option('Aviva Protección Óptima');
							document.getElementById('producto')[8].value = 'Aviva Protección Óptima';
	
							document.getElementById('producto')[9] = new Option('Amortizacion de Créditos');
							document.getElementById('producto')[9].value = 'Amortizacion de Créditos';
	
							document.getElementById('producto')[10] = new Option('Amortización de Crédito');
							document.getElementById('producto')[10].value = 'Amortización de Crédito';
	
					}
	
					else if (document.getElementById('familia').value == 'Seguros de Ahorro'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
							document.getElementById('producto')[1] = new Option('Garantizados');
							document.getElementById('producto')[1].value = 'Garantizados';
	
							document.getElementById('producto')[2] = new Option('Aviva Vida Ahorro');
							document.getElementById('producto')[2].value = 'Aviva Vida Ahorro';
	
							document.getElementById('producto')[3] = new Option('Aviva Dinero Seguro');
							document.getElementById('producto')[3].value = 'Aviva Dinero Seguro';
	
							document.getElementById('producto')[4] = new Option('Aviva PIAS Asegurado');
							document.getElementById('producto')[4].value = 'Aviva PIAS Asegurado';
	
							document.getElementById('producto')[5] = new Option('No Garantizados');
							document.getElementById('producto')[5].value = 'No Garantizados';
	
							document.getElementById('producto')[6] = new Option('Aviva Inversión Futura');
							document.getElementById('producto')[6].value = 'Aviva Inversión Futura';
	
							document.getElementById('producto')[7] = new Option('Aviva PIAS Fondos');
							document.getElementById('producto')[7].value = 'Aviva PIAS Fondos';
	
					}
	
					else if (document.getElementById('familia').value == 'Jubilación'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
							document.getElementById('producto')[1] = new Option('Planes de Pensiones');
							document.getElementById('producto')[1].value = 'Planes de Pensiones';
	
							document.getElementById('producto')[2] = new Option('Plusplan Gestión');
							document.getElementById('producto')[2].value = 'Plusplan Gestión';
	
							document.getElementById('producto')[3] = new Option('Plusplan Mixto');
							document.getElementById('producto')[3].value = 'Plusplan Mixto';
	
							document.getElementById('producto')[4] = new Option('Plusplan Renta Fija');
							document.getElementById('producto')[4].value = 'Plusplan Renta Fija';
	
							document.getElementById('producto')[5] = new Option('Plusplan Renta Variable');
							document.getElementById('producto')[5].value = 'Plusplan Renta Variable';
	
							document.getElementById('producto')[6] = new Option('Aviva Plan Protección');
							document.getElementById('producto')[6].value = 'Aviva Plan Protección';
	
							document.getElementById('producto')[7] = new Option('Aviva Espabolsa PP');
							document.getElementById('producto')[7].value = 'Aviva Espabolsa PP';
	
							document.getElementById('producto')[8] = new Option('Planes de Previsión Individual');
							document.getElementById('producto')[8].value = 'Planes de Previsión Individual';
	
							document.getElementById('producto')[9] = new Option('Plusplan de Jubilación');
							document.getElementById('producto')[9].value = 'Plusplan de Jubilación';
	
							document.getElementById('producto')[10] = new Option('Aviva Plan de Previsión Individual');
							document.getElementById('producto')[10].value = 'Aviva Plan de Previsión Individual';
	
							document.getElementById('producto')[11] = new Option('Aviva RFL, Plan de Previsión');
							document.getElementById('producto')[11].value = 'Aviva RFL, Plan de Previsión';
	
							document.getElementById('producto')[12] = new Option('Planes de Previsión Asegurado');
							document.getElementById('producto')[12].value = 'Planes de Previsión Asegurado';
	
							document.getElementById('producto')[13] = new Option('Plan Previsión Asegurado Aviva III');
							document.getElementById('producto')[13].value = 'Plan Previsión Asegurado Aviva III';
	
							document.getElementById('producto')[14] = new Option('Rentas');
							document.getElementById('producto')[14].value = 'Rentas';
	
							document.getElementById('producto')[15] = new Option('Aviva Rentavida');
							document.getElementById('producto')[15].value = 'Aviva Rentavida';
	
							document.getElementById('producto')[16] = new Option('Seguro de Rentas');
							document.getElementById('producto')[16].value = 'Seguro de Rentas';
	
					}
	
					else if (document.getElementById('familia').value == 'Inversión'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
							document.getElementById('producto')[1] = new Option('Garantizados');
							document.getElementById('producto')[1].value = 'Garantizados';
	
							document.getElementById('producto')[2] = new Option('Aviva Bono 5');
							document.getElementById('producto')[2].value = 'Aviva Bono 5';
	
							document.getElementById('producto')[3] = new Option('Aviva Bono 2');
							document.getElementById('producto')[3].value = 'Aviva Bono 2';
	
							document.getElementById('producto')[4] = new Option('Aviva Vida Ahorro PU');
							document.getElementById('producto')[4].value = 'Aviva Vida Ahorro PU';
	
							document.getElementById('producto')[5] = new Option('No Garantizados');
							document.getElementById('producto')[5].value = 'No Garantizados';
	
							document.getElementById('producto')[6] = new Option('Aviva Inversión Dinámica');
							document.getElementById('producto')[6].value = 'Aviva Inversión Dinámica';
	
							document.getElementById('producto')[7] = new Option('Fondos de Inversión');
							document.getElementById('producto')[7].value = 'Fondos de Inversión';
	
							document.getElementById('producto')[8] = new Option('Distribuidora');
							document.getElementById('producto')[8].value = 'Distribuidora';
	
							document.getElementById('producto')[9] = new Option('Gestora');
							document.getElementById('producto')[9].value = 'Gestora';
	
							document.getElementById('producto')[10] = new Option('Producto');
							document.getElementById('producto')[10].value = 'Producto';
	
					}
	
					else if (document.getElementById('familia').value == 'Seguros de Salud'){
	document.getElementById('producto')[0] = new Option('-Elige un producto-', "");
							document.getElementById('producto')[1] = new Option('Poliplus Salud');
							document.getElementById('producto')[1].value = 'Poliplus Salud';
	
							document.getElementById('producto')[2] = new Option('Seguro de Reembolso de Gastos Médicos por Enfermedades Graves');
							document.getElementById('producto')[2].value = 'Seguro de Reembolso de Gastos Médicos por Enfermedades Graves';
	
					}
	
	}
}

function cargaProvinciaPorCP(valor)
	{
		with (document.getElementsByName('InputField-5')[0]) {

			if(valor.indexOf("15") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 1;
			}
			else if (valor.indexOf("01") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 2;
			}
			else if (valor.indexOf("02") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 3;
			}
			else if (valor.indexOf("03") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 4;
			}
			else if (valor.indexOf("04") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 5;
			}
			else if (valor.indexOf("33") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 6;
			}
			else if (valor.indexOf("05") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 7;
			}
			else if (valor.indexOf("06") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 8;
			}
			else if (valor.indexOf("07") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 9;
			}
			else if (valor.indexOf("08") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 10;
			}
			else if (valor.indexOf("09") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 11;
			}
			else if (valor.indexOf("10") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 12;
			}
			else if (valor.indexOf("11") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 13;
			}
			else if (valor.indexOf("39") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 14;
			}
			else if (valor.indexOf("12") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 15;
			}
			else if (valor.indexOf("51") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 16;
			}
			else if (valor.indexOf("13") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 17;
			}
			else if (valor.indexOf("14") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 18;
			}
			else if (valor.indexOf("16") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 19;
			}
			else if (valor.indexOf("17") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 20;
			}
			else if (valor.indexOf("18") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 21;
			}
			else if (valor.indexOf("19") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 22;
			}
			else if (valor.indexOf("20") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 23;
			}
			else if (valor.indexOf("21") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 24;
			}
			else if (valor.indexOf("22") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 25;
			}
			else if (valor.indexOf("23") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 26;
			}
			else if (valor.indexOf("26") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 27;
			}
			else if (valor.indexOf("35") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 28;
			}
			else if (valor.indexOf("24") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 29;
			}
			else if (valor.indexOf("25") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 30;
			}
			else if (valor.indexOf("27") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 31;
			}
			else if (valor.indexOf("28") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 32;
			}
			else if (valor.indexOf("29") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 33;
			}
			else if (valor.indexOf("52") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 34;
			}
			else if (valor.indexOf("30") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 35;
			}
			else if (valor.indexOf("31") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 36;
			}
			else if (valor.indexOf("32") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 37;
			}
			else if (valor.indexOf("34") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 38;
			}
			else if (valor.indexOf("36") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 39;
			}
			else if (valor.indexOf("37") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 40;
			}
			else if (valor.indexOf("38") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 41;
			}
			else if (valor.indexOf("40") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 42;
			}
			else if (valor.indexOf("41") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 43;
			}
			else if (valor.indexOf("42") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 44;
			}
			else if (valor.indexOf("43") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 45;
			}
			else if (valor.indexOf("44") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 46;
			}
			else if (valor.indexOf("45") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 47;
			}
			else if (valor.indexOf("46") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 48;
			}
			else if (valor.indexOf("47") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 49;
			}
			else if (valor.indexOf("48") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 50;
			}
			else if (valor.indexOf("49") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 51;
			}
			else if (valor.indexOf("50") == 0){
				document.getElementsByName('InputField-5')[0].selectedIndex = 52;
			}
			//else if((valor == '')){
			//	document.getElementsByName('InputField-5')[0].selectedIndex = 0;
			//}
		}
		
	}
	
function validaSubmit(){

	document.forms.emailform.elements[0].value="";
	alert (document.forms.emailform.elements[0].value);
}	


function validaInputBackHistoriaEmpleo(){

var elementos = document.forms.emailform.elements.length;

	for(i=0; i<elementos; i++){
	switch (i){
		case 0: break;
		case 1: break;
		case 2: break;
		case 6: document.forms.emailform.elements[i].checked =false;
		case 8: break;
		default: if(document.forms.emailform.elements[i].type != 'button')document.forms.emailform.elements[i].value="";
		}	
	}				
}

function validaInputBackHistoria(){

var elementos = document.forms.emailform.elements.length;
	for(i=0; i<elementos; i++){
	switch (i){
		case 0: break;
		case 7: document.forms.emailform.elements[i].checked =false;
		case 8: document.forms.emailform.elements[i].checked =false;
		case 11: break;
		case 12: break;
		case 13: break;
		case 15: document.forms.emailform.elements[i].checked =false;
		case 17: break;
		default: if(document.forms.emailform.elements[i].type != 'button' && document.forms.emailform.elements[i].type !='submit' )document.forms.emailform.elements[i].value="";
		}	
	}				
}

function validaInputBack(){

	document.forms.emailform.reset();
//	alert(document.forms.emailform.elements[0].value);
//	Ocultar();
//	document.getElementById('trFamilia').style.display = 'none';
//	document.getElementById('trProducto').style.display = 'none';
	
}


