function poner_porcentajes() {
	
	if ( elemento = document.getElementById("porcentaje_datos") ) {
		
		var porcentaje = 0;
		
		if ( document.getElementById("datos_nombre").value.length > 0 ) {
			porcentaje = porcentaje + 33;
		}
		if ( document.getElementById("datos_apellidos").value.length > 0 ) {
			porcentaje = porcentaje + 33;
		}
		if ( document.getElementById("datos_contacto").value.length > 0 ) {
			porcentaje = porcentaje + 33;
		}
		
		if ( porcentaje == 66 ) { porcentaje = 67; }
		if ( porcentaje == 99 ) { porcentaje = 100; }
		
		elemento.innerHTML = porcentaje + " %";
		
		if ( porcentaje == 100 ) { cambiarzona("zona_datos") }
		
	}
	
	if ( elemento = document.getElementById("porcentaje_fiscal") ) {
		
		var porcentaje = 0;
		
		if ( document.getElementById("datos_fiscal_nombre").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_fiscal_calle").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_fiscal_cp").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_fiscal_poblacion").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_fiscal_provincia").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_fiscal_dnicif").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( ( document.getElementById("datos_fiscal_cuenta1").value.length == 4 ) && ( document.getElementById("datos_fiscal_cuenta2").value.length == 4 ) && ( document.getElementById("datos_fiscal_cuenta3").value.length == 2 ) && ( document.getElementById("datos_fiscal_cuenta4").value.length == 10 ) ) {
			porcentaje = porcentaje + 14;
		}
		
		if ( porcentaje == 98 ) { porcentaje = 100; }
		
		elemento.innerHTML = porcentaje + " %";
		
		if ( porcentaje == 100 ) { cambiarzona("zona_fiscal") }
		
	}
	
	if ( elemento = document.getElementById("porcentaje_cv") ) {
		
		var porcentaje = 0;
		
		if ( document.getElementById("datos_titulo1").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_titulo2").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_titulo3").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_cargo_actual").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_cargo_ocupado1").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_cargo_ocupado2").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		if ( document.getElementById("datos_cargo_ocupado3").value.length > 0 ) {
			porcentaje = porcentaje + 14;
		}
		
		if ( porcentaje == 98 ) { porcentaje = 100; }
		
		elemento.innerHTML = porcentaje + " %";
		
		if ( porcentaje == 100 ) { cambiarzona("zona_cv") }
		
	}
	
	if ( elemento = document.getElementById("porcentaje_abstract") ) {
		
		var porcentaje = 0;
		
		if ( document.getElementById("datos_abstract").value.length > 0 ) {
			porcentaje = porcentaje + 100;
		}
		
		elemento.innerHTML = porcentaje + " %";
		
		if ( porcentaje == 100 ) { cambiarzona("zona_abstract") }
		
	}
	
	
 // nada
}

function cambiarzona( campo ) {

	if ( elemento = document.getElementById(campo) ) {
		if ( elemento.style.display != "none" ) {
			ocultarfila(campo);
			if ( elemento2 = document.getElementById(campo + "_info") ) { elemento2.style.display = ""; }
		} else {
			mostrarfila(campo);
			if ( elemento2 = document.getElementById(campo + "_info") ) { elemento2.style.display = "none"; }
		}
	}
	
	// if ( elemento.style.visible == )
	
	// mostrarfila(campo);
	
	/*
	if ( campo != "zona_datos" ) {
		ocultarfila("zona_datos");
	}
	if ( campo != "zona_fiscal" ) {
		ocultarfila("zona_fiscal");
	}
	if ( campo != "zona_cv" ) {
		ocultarfila("zona_cv");
	} */
	
}

function mostrarfila ( fila ) {
	var elementos = document.getElementsByName(fila);
	for ( i=0; i < elementos.length; i++ ) {
		if ( navigator.appName.indexOf("Microsoft") > -1 ) {
			var visible = "block";
		} else {
			var visible = "table-row";
		}
		elementos[i].style.display = visible;
	}
}

function ocultarfila ( fila ) {
	var elementos = document.getElementsByName(fila);
	for ( i=0; i < elementos.length; i++ ) {
		elementos[i].style.display = "none";
	}
}

function marcarTodas ( form_id ) {

		var formulario = document.getElementById( form_id );
		
		for ( var i = 0; i < formulario.elements.length; i++ ) {
			
			if ( formulario.elements[i].type == 'checkbox' ) {
				if ( formulario.elements[i].disabled == false ) {
					formulario.elements[i].checked = true;	
				}
			}
			
		}
		
}

function saltar( caracteres, actual, siguiente ) {
	
	este = document.getElementById(actual)
	
	if ( este.value.length >= caracteres ) {
		document.getElementById(siguiente).focus();
	}
	
}

function marcarNinguna ( form_id ) {

		formulario = document.getElementById( form_id );
		
		for ( var i = 0; i < formulario.elements.length; i++ ) {
			
			if ( formulario.elements[i].type == 'checkbox' ) {
				if ( formulario.elements[i].disabled == false ) {
					formulario.elements[i].checked = false;	
				}
			}
			
		}
		
}

function borrarSelecc( form_id, mensaje ) {
	
	if (confirm( mensaje )) {
		document.getElementById(form_id).submit();
	}
}

function enviarConCarga( boton, div_quitar, div_poner, form_llamar ) {
	boton.disabled = 'disabled';
	document.getElementById(div_quitar).style.display = 'none';
	document.getElementById(div_poner).style.display = 'block';
	document.getElementById(form_llamar).submit();
	
}

function alternarInfo( row_n ) {
	info = document.getElementById('info'+row_n);
	if ( info.style.display == '' ) {
		info.style.display = 'none';
		imagen = document.getElementById('oculta'+row_n);
		imagen.style.display = 'none';
		imagen = document.getElementById('muestra'+row_n);
		imagen.style.display = '';
	} else {
		info.style.display = '';
		imagen = document.getElementById('oculta'+row_n);
		imagen.style.display = '';
		imagen = document.getElementById('muestra'+row_n);
		imagen.style.display = 'none';
	}
}

function confirmaSubmit( form_id, mensaje ) {
	
	if (confirm( mensaje )) {
		document.getElementById(form_id).submit();
	}
}

function envia( form_id ) {

		document.getElementById(form_id).submit();
		
}

function ponyenvia( form_id, campo_id, valor ) {
	
		document.getElementById(campo_id).value = valor;
		document.getElementById(form_id).submit();
		
}

function gen_pass( input_id, numero_caracteres ) {
	
	var caracter="23456789ABCDEFGHJKLMNPQRSTUVWXZabcdefghjkmnpqrstuvwxz";
	var total=caracter.length;
	var clave="";
	
	for(a=0;a<numero_caracteres;a++) {
		clave+=caracter.charAt(parseInt(total*Math.random(1)));
	}
	
	document.getElementById(input_id).value = clave;
	
}