function verImagen(imagen,id){
var texto="";
var cruz = "<div style='background-color:#FFFFFF'><span style='background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2'>&nbsp;X&nbsp;</span>";
var comentario = document.getElementById('idimg'+id).alt
var imagen = "<img src="+imagen+"?ale="+String(Math.random())+">";
texto ="<table style='border: 0px solid #9e1b32; background-color:#FFFFFF' width='100%' height='510'><tr align='center'><td>"
texto = texto + imagen
texto = texto + "</td></tr><table>" 
texto = texto + "<table width='100%' height='22' style='border: 1px solid #9A4062; background-color:#9e1b32'><tr align='center'><td class='f_text'>"+comentario+"</td></tr></table>"
document.getElementById('ejcproc2').style.display="block"
document.getElementById('ejcproc').style.display="block"
document.getElementById('ejcproc2').innerHTML=cruz+texto+"</div>"
centrarWrapper()
}

function verImagenFran(imagen,id){
var texto="";
var cruz = "<div style='background-color:#FFFFFF'><span style='background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2'>&nbsp;X&nbsp;</span>";
var comentario = document.getElementById('idimgf'+id).alt
var imagen = "<img src="+imagen+"?ale="+String(Math.random())+">";
texto ="<table style='border: 0px solid #9e1b32; background-color:#FFFFFF' width='100%' height='510'><tr align='center'><td>"
texto = texto + imagen
texto = texto + "</td></tr><table>" 
texto = texto + "<table width='100%' height='22' style='border: 1px solid #9A4062; background-color:#9e1b32'><tr align='center'><td class='f_text'>"+comentario+"</td></tr></table>"
document.getElementById('ejcproc2').style.display="block"
document.getElementById('ejcproc').style.display="block"
document.getElementById('ejcproc2').innerHTML=cruz+texto+"</div>"
centrarWrapper()
}

function buscarVideo(){
	var cat = document.forms[0].Cidioma.value
	var tit= document.forms[0].ctitulo.value
	var desc =document.forms[0].cdesc.value
	if (cat=="-" && tit=="" && desc ==""){
		alert("Debe de introducir algún caracter para realizar una búsqueda")
		return;
	}
	
	//montamos la query ej JS categoria like '$idioma' or titulo like '%$titulo%' or descripcion  like '%$desc%'
	var query = "";
	
	if (cat !="-"){
		query = "categoria like '"+cat+"' ";  
	}
	
	if (tit !=""){
		if (query ==""){
  			query = " titulo like '%"+tit+"%' ";
		}else{
			query += " or titulo like '%"+tit+"%' ";
		}
	}
	
	if (desc !=""){
		if (query ==""){
			query = " descripcion  like '%"+desc+"%' ";  
		}else{
			query += " or descripcion  like '%"+desc+"%' ";
		}
	}
	
	document.forms[0].query.value=query
	document.forms[0].busqueda.value="1";
	document.forms[0].submit();
}

function verVideo(valor){
	var ancho = 800;
	var alto = 600;
	var x = (screen.width/2) - (ancho/2);
	var y = (screen.height/2) - (alto/2) - 20;
	var finalurl = "/extranet/vervideo.php?Cid="+valor+"&ale="+String(Math.random());
	var finalurl2 = "/extranet/formacio/verdetalle.php?Cid="+valor+"&ale="+String(Math.random());
	document.getElementById('peticionesIframe').src=finalurl
	document.getElementById('peticionesIframeDetalle').src=finalurl2
}

function verFichero(valor){
	var ancho = 800;
	var alto = 600;
	var x = (screen.width/2) - (ancho/2);
	var y = (screen.height/2) - (alto/2) - 20;
	var finalurl2 = "/extranet/formacio/descargarFichero.php?Cid="+valor+"&ale="+String(Math.random());

	parent.document.getElementById('peticionesIframeFichero').src=finalurl2
}

function verImagen2(imagen,id){
var texto="";
var cruz = "<div style='background-color:#891637'><span style='background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2'>&nbsp;X&nbsp;</span>";
var comentario = document.getElementById('idimg'+id).alt
var imagen = "<img src="+imagen+"?ale="+String(Math.random())+" VALIGN='middel'>";
texto ="<table style=' background-color:#891637' width='100%' height='530'><tr align='center'><td VALIGN='bottom'><br><br><br><br><br><br><br>"
texto = texto + imagen
texto = texto + "</td></tr><table>" 
document.getElementById('ejcproc2').style.display="block"
document.getElementById('ejcproc').style.display="block"
document.getElementById('ejcproc2').innerHTML=cruz+texto+"<div>"
ocultarContenido()
centrarWrapper()
}

function mostrarDetalle(objeto){
var cruz = "<span style='background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2'>&nbsp;X&nbsp;</span>";
document.getElementById('ejcproc2').style.display="block"
document.getElementById('ejcproc').style.display="block"
document.getElementById('ejcproc2').innerHTML=cruz+objeto.innerHTML
centrarWrapper()
mostrarContenido(1)
}

function mostrarDetalleForm(objeto){
var cruz = "<span style='cursor:hand;background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2' onClick=visualizarForm('ejecproc3')>&nbsp;X&nbsp;</span>";
document.getElementById('ejcproc3').style.display="block"
document.getElementById('ejcproc4').style.display="block"
document.getElementById('ejcproc3').innerHTML=cruz+objeto.innerHTML
centrarWrapper()
mostrarContenido(1)
}

function mostrarDetalleFormTest(objeto){
var cruz = "<span style='cursor:hand;background-color:#891637;margin-right:0px; margin-top:0px;float:right;display:block' class='f_text2' onClick=visualizarFormTest('ejecproc5')>&nbsp;X&nbsp;</span>";
document.getElementById('ejcproc5').style.display="block"
document.getElementById('ejcproc6').style.display="block"
document.getElementById('ejcproc5').innerHTML=cruz+objeto.innerHTML
centrarWrapper()
mostrarContenido(1)
}

function BuscarCualquierChecked(FieldRadio)
{
//Mediante esta rutina comprobaremos si un campo de tipo checkbox (radio/Check button) tiene algún valor seleccionado. Devolverá -1 en caso que NO haya nada seleccionado y 1 en caso que SI encuentre algún valor seleccionado.
try{
	for(i = 0; i <= FieldRadio.length; i++)
		{
		if(FieldRadio[i].checked) return 1;
	}
	if(i == FieldRadio.length) return -1;
}catch (Exception){
	return -1
}
}

function abrirUrl(url){
	window.location.href="http://"+location.host+url
}

function abrirUrlExterna(url){
	winnueva = window.open("http://"+url,'','')
}

function centrarWrapper (){
    var correctorPercent = 1;//En caso de definir las dimensiones del wrapper en porcentajes.
    if (window.innerWidth > document.getElementById('ejcproc2').offsetWidth - correctorPercent){
        document.getElementById('ejcproc2').style.left = '50%';
        document.getElementById('ejcproc2').style.marginLeft = (-1) * document.getElementById('ejcproc2').offsetWidth / 2 + 'px';
        document.getElementById('ejcproc').style.marginLeft = (-1) * document.getElementById('ejcproc').offsetWidth / 2 + 'px';
    }
    if (window.innerHeight > document.getElementById('ejcproc2').offsetHeight - correctorPercent){
        document.getElementById('ejcproc2').style.top = '50%';
        document.getElementById('ejcproc2').style.marginTop = (-1) * document.getElementById('ejcproc2').offsetHeight / 2 + 'px';
        document.getElementById('ejcproc').style.marginTop = (-1) * document.getElementById('ejcproc').offsetHeight / 2 + 'px';
    }
}

function visualizar(valor){
	if (document.getElementById('ejcproc2').style.display=="block"){
		document.getElementById('ejcproc2').style.display="none"
		document.getElementById('ejcproc').style.display="none"
		mostrarContenido()
	}
}

function visualizarDivTd(valor,valor2,accion){
	document.getElementById(valor).style.display=accion
	document.getElementById(valor2).style.display=accion
	if (accion=="none"){
		document.forms[0].P3(0).checked=false
		document.forms[0].P4(0).checked=false
		document.forms[0].P3(1).checked=false
		document.forms[0].P4(1).checked=false
	}
}

function visualizarForm(valor){
	if (document.getElementById('ejcproc3').style.display=="block"){
		document.getElementById('ejcproc3').style.display="none"
		document.getElementById('ejcproc4').style.display="none"
		mostrarContenido()
	}
}

function visualizarFormTest(valor){
	if (document.getElementById('ejcproc5').style.display=="block"){
		document.getElementById('ejcproc6').style.display="none"
		document.getElementById('ejcproc5').style.display="none"
		mostrarContenido()
	}
}

function cambioIdioma(idioma){
	var path= window.location.href.indexOf("?")
	window.location.href=window.location.href.substring(0,path)+"?idioma="+idioma;
}

function verImagenVentana(imagen){
	var ancho = 900;
	var alto = 590;
	var x = (screen.width/2) - (ancho/2);
	var y = (screen.height/2) - (alto/2) - 20;
	var path=location.href.substring(0,location.href.lastIndexOf("/"))
	var finalurl = location.protocol+"//"+location.host +"/hps/php/visImage.php?path="+path+"&img="+imagen+"&ale="+String(Math.random())
	WinImagen = window.open(finalurl,"Imagen","top=" + y + ",left=" + x + ",resizable=0,statusbar=yes,scrollbars=yes,width=" + ancho + ",height=" + alto);//creo una pantalla vacia sin documentos
	WinImagen.focus();
}

function verDetalle(id,carpeta){
	var path=location.href.substring(0,location.href.lastIndexOf("/"))
	var finalurl = location.protocol+"//"+location.host +"/hps/php/visDetalle.php?path="+path+"&id="+id+"&carpeta="+carpeta+"&ale="+String(Math.random())
	window.document.getElementById('peticionesIframe').src =finalurl
}
function verDetalleForm(id,carpeta){
	var path=location.href.substring(0,location.href.lastIndexOf("/"))
	if (id=="2"){
		var finalurl = location.protocol+"//"+location.host +"/hps/php/visDetalleTest.php?path="+path+"&id="+id+"&carpeta="+carpeta+"&ale="+String(Math.random())
	}else{
		var finalurl = location.protocol+"//"+location.host +"/hps/php/visDetalleForm.php?path="+path+"&id="+id+"&carpeta="+carpeta+"&ale="+String(Math.random())
	}
	window.document.getElementById('peticionesIframe').src =finalurl
}

function validarEntrada(idioma){
if (document.forms[0].Clogin.value==""){
		alert("El campo usuario no puede estar vacío")
		return;
	}
if (document.forms[0].Cpass.value==""){
		alert("El campo contrasenya no puede estar vacío")
		return;
	}
	document.getElementById('form1').submit()
}


function validarContacte(idioma){
	if (!document.forms[0].acepto.checked) {
		alert("Debe de aceptar las condiciones");
		return;
	}
	
	if (document.forms[0].nombre.value==""){
		alert("El campo nombre no puede estar vacío")
		return;
	}
	
	if (document.forms[0].apellidos.value==""){
		alert("El campo apellidos no puede estar vacío")
			return;
	}

	if (document.forms[0].email.value==""){
		alert("El campo email no puede estar vacío")
			return;
	}
	
	if (isEmailAddress(document.forms[0].email, 'email' )==false){
		alert("La dirección de email no es válida")
			return;
	}
	
	if (document.forms[0].codpostal.value==""){
		alert("El campo codigo postal no puede estar vacío")
			return;
	}
	
	if (document.forms[0].codpostal.value.length !=5){
		alert("El codigo postal debe contener cinco dígitos")
		return;
	}
	if (isNumericField(document.forms[0].codpostal.value)==false){
		alert("El codigo postal debe ser numérico")
		return;
	}
	document.getElementById('form1').submit()
}

function validarTest(idioma){
	if (!document.forms[0].acepto.checked) {
		alert("Debe de aceptar las condiciones");
		return;
	}
		if (document.forms[0].nombre.value==""){
		alert("El campo nombre no puede estar vacío")
		return;
	}
	
	if (document.forms[0].apellidos.value==""){
		alert("El campo apellidos no puede estar vacío")
			return;
	}

	if (document.forms[0].email.value==""){
		alert("El campo email no puede estar vacío")
			return;
	}
		if (isEmailAddress(document.forms[0].email, 'email' )==false){
		alert("La dirección de email no es válida")
			return;
	}
		if (document.forms[0].codpostal.value==""){
		alert("El campo codigo postal no puede estar vacío")
			return;
	}
	
	if (document.forms[0].codpostal.value.length !=5){
		alert("El codigo postal debe contener cinco dígitos")
		return;
	}
	if (isNumericField(document.forms[0].codpostal.value)==false){
		alert("El codigo postal debe ser numérico")
		return;
	}
	if (document.forms[0].tiempo.value==""){
		alert("Debe de informar el tiempo que lleva siendo cliente de HPS")
		document.forms[0].tiempo.focus();
		return
	}
	
	//Validaciones de checkbox
	if (BuscarCualquierChecked(document.forms[0].P2)==-1){
		alert("Debe de marcar una opción para la pregunta 2");
		document.forms[0].P2(1).focus()
		return
	}
	
	//Si la pregunta 2 es SI, validamos que informen la pregunta 3 y 4
	if (document.forms[0].P2[0].checked){
		if (BuscarCualquierChecked(document.forms[0].P3)==-1){
			alert("Debe de marcar una opción para la pregunta 3");
			document.forms[0].P3(1).focus()
			return
		}
		if (BuscarCualquierChecked(document.forms[0].P4)==-1){
			alert("Debe de marcar una opción para la pregunta 4");
			document.forms[0].P4(1).focus()
			return
		}
	}
	
	if (BuscarCualquierChecked(document.forms[0].P5)==-1){
		alert("Debe de marcar una opción para la pregunta 5");
		document.forms[0].P5(1).focus()
		return
	}
	
	//Si marcan SI en la pregunta 5, validamos que marquen la 51
	if (document.forms[0].P5[0].checked){
		if (BuscarCualquierChecked(document.forms[0].P51)==-1){
			alert("Debe de marcar una opción para la pregunta 5.1");
			document.forms[0].P51(1).focus()
			return
		}
	}

	//Si nos marcan la pregunta 5 como NO, validamos que induqne el por que en le 5.2
	if (document.forms[0].P51[1].checked){
		if (trim(document.forms[0].P52.value)==""){
			alert("Debe especificar el motivo en el apartado 5.2");
			document.forms[0].P52.focus()
			return
		}
	}

	if (BuscarCualquierChecked(document.forms[0].P6)==-1){
		alert("Debe de marcar una opción para la pregunta 6");
		document.forms[0].P6(1).focus()
		return
	}
	
	//Si marcan la pregunta 6 como SI, validamos la 6.1
	if (document.forms[0].P6[0].checked){
		if (BuscarCualquierChecked(document.forms[0].P61)==-1){
			alert("Debe de marcar una opción para la pregunta 6.1");
			document.forms[0].P61(1).focus()
			return
		}
		
		//Si la 6.1 marcan que NO, validamos que pongan algo en la 6.3
		if (document.forms[0].P61[1].checked){
			if (trim(document.forms[0].P62.value)==""){
				alert("Debe especificar el motivo en el apartado 6.2");
				document.forms[0].P62.focus()
				return
			}
		}
	}
		
	if (BuscarCualquierChecked(document.forms[0].P7)==-1){
		alert("Debe de marcar una opción para la pregunta 7");
		document.forms[0].P7(1).focus()
		return
	}
	if (BuscarCualquierChecked(document.forms[0].P8)==-1){
		alert("Debe de marcar una opción para la pregunta 8");
		document.forms[0].P8(1).focus()
		return
	}
	
	//Si marcan que si en la P8, validamos que ppongan texto
	if (document.forms[0].P8[0].checked){
		if (trim(document.forms[0].P81.value)==""){
			alert("Debe especificar el motivo en el apartado 8.1");
			document.forms[0].P81.focus()
			return
		}
	}
	if (BuscarCualquierChecked(document.forms[0].P81)==-1){
		alert("Debe de marcar una opción para la pregunta 8.1");
		document.forms[0].P81(1).focus()
		return
	}
	
	if (BuscarCualquierChecked(document.forms[0].P9)==-1){
		alert("Debe de marcar una opción para la pregunta 9");
		document.forms[0].P9(1).focus()
		return
	}
	
	//Si el 9 es si, validamos que incluyan comentario
	if (document.forms[0].P9[0].checked){
		if (trim(document.forms[0].P91.value)==""){
			alert("Debe especificar el motivo en el apartado 9.1");
			document.forms[0].P91.focus()
			return
		}
	}
	
	if (BuscarCualquierChecked(document.forms[0].P10)==-1){
		alert("Debe de marcar una opción para la pregunta 10");
		document.forms[0].P10(1).focus()
		return
	}

	if (BuscarCualquierChecked(document.forms[0].P11)==-1){
		alert("Debe de marcar una opción para la pregunta 11");
		document.forms[0].P11(1).focus()
		return
	}

	if (BuscarCualquierChecked(document.forms[0].P12)==-1){
		alert("Debe de marcar una opción para la pregunta 12");
		document.forms[0].P12(1).focus()
		return
	}
	//Si marcan si, validamos la 12.1
	if (document.forms[0].P12[0].checked){
		if (BuscarCualquierChecked(document.forms[0].P121)==-1){
			alert("Debe marcar alguna opción en el apartado 12.1");
			document.forms[0].P121(1).focus()
			return
		}
	}
	
	if (BuscarCualquierChecked(document.forms[0].P13)==-1){
		alert("Debe de marcar una opción para la pregunta 13");
		document.forms[0].P13(1).focus()
		return
	}
	
	if (document.forms[0].valoracion.value==""){
		alert("El campo valoración no puede estar vacío")
		document.forms[0].valoracion.focus()
		return;
	}
	if (isNumericField(document.forms[0].valoracion.value)==false){
		alert("El campo valoración debe ser numérico")
		return;
	}
	if (parseInt(document.forms[0].valoracion.value)>10){
		alert("El valor del campo valoración debe de estar entre 0 y 10");
		return;
	}

	document.getElementById('form1').submit()


}


function validarServeis(idioma){
	//que hayan aceptado las condicion es
	if (!document.forms[0].acepto.checked) {
		alert("Debe de aceptar las condiciones");
		return;
	}
	if (trim(document.forms[0].nombre.value)==""){
		alert("El campo nombre no puede estar vacío")
		return;
	}
	
	if (trim(document.forms[0].apellidos.value)==""){
		alert("El campo apellidos no puede estar vacío")
			return;
	}
	if (trim(document.forms[0].direccion.value)==""){
		alert("El campo dirección no puede estar vacío")
			return;
	}
	if (trim(document.forms[0].codpostal.value)==""){
		alert("El campo codigo postal no puede estar vacío")
			return;
	}
	
	if (document.forms[0].codpostal.value.length !=5){
		alert("El codigo postal debe contener cinco dígitos")
		return;
	}
	if (isNumericField(document.forms[0].codpostal.value)==false){
		alert("El codigo postal debe ser numérico")
		return;
	}
	
	if (trim(document.forms[0].poblacion.value)==""){
		alert("El campo población no puede estar vacío")
			return;
	}
	
	if (trim(document.forms[0].provincia.value)==""){
		alert("El campo provincia no puede estar vacío")
			return;
	}
	if (trim(document.forms[0].telefono.value)==""){
		alert("El campo teléfono no puede estar vacío")
			return;
	}
	if (isNumericField(document.forms[0].telefono.value)==false){
		alert("El teléfono debe ser numérico")
		return;
	}
	
	if (document.forms[0].email.value==""){
		alert("El campo email no puede estar vacío")
			return;
	}
		if (isEmailAddress(document.forms[0].email, 'email' )==false){
		alert("La dirección de email no es válida")
			return;
	}
	if (document.forms[0].email.value != document.forms[0].confemail.value){
		alert("El email introducido no coincide con la confirmación")
			return;
	}
	
	//Asignamos los servicios
	if (BuscarChecked(document.forms[0].serveis, "SD")==1){
	document.forms[0].selservicios.value+="Servei domèstic /";
	}
	if (BuscarChecked(document.forms[0].serveis, "S3")==1){
	document.forms[0].selservicios.value+="Servei 3ª edat /";
	}
	if (BuscarChecked(document.forms[0].serveis, "SS")==1){
	document.forms[0].selservicios.value+="Serveis sanitaris /";
	}
	document.getElementById('form1').submit()
}

function validarFranquicies(idioma){

	//que hayan aceptado las condicion es
	if (!document.forms[0].acepto.checked) {
		alert("Debe de aceptar las condiciones");
		return;
	}
	if (document.forms[0].nombre.value==""){
		alert("El campo nombre no puede estar vacío")
		return;
	}
	
	if (document.forms[0].apellidos.value==""){
		alert("El campo apellidos no puede estar vacío")
			return;
	}
	
	if (document.forms[0].codpostal.value==""){
		alert("El campo codigo postal no puede estar vacío")
			return;
	}
	
	if (document.forms[0].codpostal.value.length !=5){
		alert("El codigo postal debe contener cinco dígitos")
		return;
	}
	if (isNumericField(document.forms[0].codpostal.value)==false){
		alert("El codigo postal debe ser numérico")
		return;
	}
	
	if (document.forms[0].poblacion.value==""){
		alert("El campo población no puede estar vacío")
			return;
	}
	
	if (document.forms[0].provincia.value==""){
		alert("El campo provincia no puede estar vacío")
			return;
	}
	if (document.forms[0].telefono.value==""){
		alert("El campo teléfono no puede estar vacío")
			return;
	}
	if (isNumericField(document.forms[0].telefono.value)==false){
		alert("El teléfono debe ser numérico")
		return;
	}
	
	if (document.forms[0].email.value==""){
		alert("El campo email no puede estar vacío")
			return;
	}
		if (isEmailAddress(document.forms[0].email, 'email' )==false){
		alert("La dirección de email no es válida")
			return;
	}
	if (document.forms[0].email.value != document.forms[0].confemail.value){
		alert("El email introducido no coincide con la confirmación")
			return;
	}
	if (document.forms[0].paisfranquicia.value==""){
		alert("El campo país franquicia no puede estar vacío")
			return;
	}
	if (document.forms[0].poblaciofranquicia.value==""){
		alert("El campo país franquicia no puede estar vacío")
			return;
	}
	if (document.forms[0].codpostalfranquicia.value==""){
		alert("El campo país franquicia no puede estar vacío")
			return;
	}
	document.getElementById('form1').submit()
}

function trim(cadena)
{
	for(i=0; i<cadena.length; )
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(i+1, cadena.length);
		else
			break;
	}

	for(i=cadena.length-1; i>=0; i=cadena.length-1)
	{
		if(cadena.charAt(i)==" ")
			cadena=cadena.substring(0,i);
		else
			break;
	}
	
	return cadena;
}



function mostrarContenido(flag){
if (flag==null){
if (document.getElementById('ejcproc2').style.display=="block"){
	return;
}
}
var pos =0;
capas=document.getElementsByTagName('div');
	for (i=0;i<capas.length;i++){
		if ((capas[i].id.indexOf('imag') != -1) || (capas[i].id.indexOf('vid') != -1)){
			if ((capas[i].innerHTML.indexOf('#') ==-1) && (capas[i].innerHTML !="")){
				 pos = (capas[i].innerHTML.indexOf('images/'));
				if (pos > 0){
					var hg = capas[i].innerHTML.substring(pos+7,pos+8)
					if (hg !="'"){
						capas[i].style.display='block';
					}
				}else{
					capas[i].style.display='block';
				}
			}
		}
	}
}

function ocultarContenido(){

capas=document.getElementsByTagName('div');
	for (i=0;i<capas.length;i++){
		if ((capas[i].id.indexOf('imag') != -1) || (capas[i].id.indexOf('vid') != -1)){
			if ((capas[i].innerHTML.indexOf('#') ==-1)){
				capas[i].style.display='none';
			}
		}
	}
}
function isNumericField(Field)
{
  var newString = '';
  //Si comprobamos un campo numerico a "" retornamos error
  if (Field==""){
  	return false;
  }
  //Fer les voltes fins saber si es un numero o no
  for (i = 0; i < Field.length; i++)
  {
    ch = Field.substring(i, i+1);
    if (ch >= "0" && ch <= "9")
    {
      newString += ch;
    }
  }
  if (newString  == Field)
  {
    return true;
  }
  else
  {
    return false;
  }
}

function BuscarChecked(FieldRadio, buscarChecked)
{
//Mediante esta rutina comprobaremos si un campo de tipo checkbox (radio/Check button) tiene seleccionado el valor buscarChecked.
	for(i = 0; i<FieldRadio.length; i++)
	{
		if(FieldRadio[i].checked)
		{
			if(FieldRadio[i].value.toUpperCase() == buscarChecked)
			{
				 return 1;
			}
		}
	}
	if(i == FieldRadio.length) return -1;
}

function isEmailAddress(theElement, nombre_del_elemento )
{
var s = theElement.value;
var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
if (s.length == 0 ) return true;
if (filter.test(s))
return true;
else
theElement.focus();
return false;
}