// para las publicaciones seriadas
function Comprueba() {
var lResultado=true;

var layer1;
var layer2;

layer1= document.getElementById('numero');
layer2= document.getElementById('year');

if(layer1.value==-1 && layer2.value==-1) { lResultado=false; }

if(lResultado==true) { document.forms.buscar.submit(); }
else
 {
  alert('Usted debe seleccionar lo que desea buscar');
  return;
 }
}
function Comprueba_num() {
var lResultado=true;
//alert('entre');
var layer1;
var layer2;

layer1= document.getElementById('numero');
layer2= document.getElementById('year');

if(layer1.value==-1 && layer2.value==-1) { lResultado=false; }
layer2.value=-1;
//if(layer1.value!=-1 && layer2.value!=-1) { lResultado=false; }

if(lResultado==true) { document.forms.buscar.submit(); }
else
 {
  alert('Usted debe seleccionar lo que desea buscar');
  return;
 }
}

function abrir(valor) {
  window.open(valor,'','width=500,height=400,menubar,resizable,toolbar,titlebar,status,directories,location,scrollbars=yes');
}
function salir()
{
cerrar();
}

function deshacer(tb)
{
var tabla=tb;   
                 document.formu.valor.value='';
                 document.formu.titulo.value='';
				 document.formu.userfile.value='';
				 document.formu.userfile1.value='';
				 document.formu.userfile2.value='';
				 document.formu.issn.value='';
				 document.formu.otrosdatos.value='';
				 document.formu.editora.value='';
				 document.formu.userfile4.value='';
				 document.formu.editora_url.value='';
}

function Subraya(id)
{
 var layer=id;
 
 document.getElementById(layer).style.textDecoration='underline';
}
function Desubraya(id)
{
 var layer=id;
 
 document.getElementById(layer).style.textDecoration='none';
}

function cerrar()
{ 
var ventana = window.self; 
ventana.opener = window.self; 
ventana.close();
}

function otra_ventana(valor) {
  window.open(valor,'','width=600,height=600,menubar,resizable,toolbar,titlebar,status,directories,location,scrollbars=yes');
}

function checkall(formname,checkname,thestate){
var el_collection=eval("document.forms."+formname+"."+checkname)
for (c=0;c<el_collection.length;c++)
el_collection[c].checked=thestate
}


function Agregando(id,titulo)
{
var idopcion_interfaz=id;
var publicacion=titulo;
var valor='id'+id;
var enlace='a'+id;
var enlace1;
var valor1;
document.getElementById("Form_Agregar").style.display="block";

//alert(document.getElementById(idopcion_interfaz).style.fontWeight);

	if(document.getElementById("sesion"))
	{
		document.getElementById("sesion").value=idopcion_interfaz;
		document.getElementById("vacio").value=titulo;
	}
	else alert("Objeto inexistente en el formulario");
	

for (var i=0; i <= (oListaOpc_interfaz_agr.length-1); i++)
	{  
		valor1='id'+oListaOpc_interfaz_agr[i].nId;
		enlace1='a'+oListaOpc_interfaz_agr[i].nId;
		if(document.getElementById(valor1))
		{
		document.getElementById(valor1).style.color='black';
		document.getElementById(enlace1).style.color='black';
		document.getElementById(valor1).style.fontWeight='normal';
		document.getElementById(enlace1).style.fontWeight='normal';
		}
	} 
       document.getElementById("asterisco").style.display="block";
switch (idopcion_interfaz) {
case 1: 
       document.getElementById("info_revista").style.display="block";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 2: 
       document.getElementById("ceditorial").style.display="block";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 3:
       document.getElementById("asterisco").style.display="none";
       document.getElementById("instrucciones").style.display="block";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 4: 
       document.getElementById("asterisco").style.display="none";
       document.getElementById("contacto").style.display="block";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
	   break;
case 5: 
       document.getElementById("suscripcion").style.display="block";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 6: 
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="block";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 7: 
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="block";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("documentos").style.display="none";
       document.getElementById("numeros").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 8: 
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="block";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 19: 
       document.getElementById("asterisco").style.display="none";
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="block";
       document.getElementById("numeros").style.display="none";
       document.getElementById("documentos").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 20:
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("documentos").style.display="none";
       document.getElementById("numeros").style.display="block";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
case 19: 
       break;
case 21:
       document.getElementById("suscripcion").style.display="none";
       document.getElementById("datos_revista").style.display="none";
       document.getElementById("contacto").style.display="none";
       document.getElementById("instrucciones").style.display="none";
       document.getElementById("ceditorial").style.display="none";
       document.getElementById("usuario_i").style.display="none";
       document.getElementById("opc_mnuppal").style.display="none";
       document.getElementById("info_revista").style.display="none";
       document.getElementById("opc_interfaz").style.display="none";
       document.getElementById("documentos").style.display="block";
       document.getElementById("numeros").style.display="none";
	   document.getElementById(valor).style.fontWeight = 'bold';
		document.getElementById(enlace).style.fontWeight='bold';
       break;
default:// alert('no se tiene incluida esta opción en la función'); 
       break;
   }

}


function Agregar(id,tb)
{ 
    var idrevista=id;
	var tb=tb;
	
   
    OcultaFormulario("Formulario");
	MuestraFormulario("Form_Agregar"); 
//	alert ("paso1");

	//alert(idrevista+'     '+tb);
	document.getElementById("formagregar").valor.value = idrevista;
	document.formagregar.operacion.value='insert';
	document.formagregar.vacio.value=0;
	document.formagregar.action='actpseriadas.php?operacion=insert';
	//alert(document.getElementById("formagregar").valor.value);
/*	if(document.getElementById("formagregar"))
	{
		alert("existe");
	}
	else alert("no existe");
	
	if(document.getElementsByName("valor"))
	{
		alert("existe");
	}
	else alert("no exsite");*/
	
	//document.formagregar.valor.value=idrevista;
	
	
	//alert(document.formagregar.valor.value);

 switch (tb) {
  case 'informacion_revista':
		   for (var i=0; i <= (oListaDatosrevista.length-1); i++)
				  {  
					  if (oListaDatosrevista[i].nId==idrevista)
						{ 
						 document.formagregar.revista.value=oListaDatosrevista[i].sTitulo;
						 break;}
				  } 
	         break;	  
/*  case 'instrucciones_autores':
		   for (var i=0; i <= (oListaInstrucciones.length-1); i++)
				  {  
					  if (oListaInstrucciones[i].nId==idrevista)
						{ 
						 document.formagregar.revista.value=oListaInstrucciones[i].sRevista;
						 break;}
				  } 
	         break;	  
*/  case 'datos_revista':
		   for (var i=0; i <= (oListaDatosrevista.length-1); i++)
				  {  
					  if (oListaDatosrevista[i].nId==idrevista)
						{ 
						 document.formagregar.titulo.value=oListaDatosrevista[i].sTitulo;
						 document.formagregar.stitulo.value=oListaDatosrevista[i].sTitulo;
						// alert(document.formagregar.stitulo.value);
						 break;}
				  } 
	         break;	
  default:
             break;
}
}



function Modifica_Registro(identificador,tb)
{ 
  //alert('modificando'+identificador+' '+tb);
    OcultaFormulario("Form_Agregar");
	MuestraFormulario("Formulario");   
	var id=identificador;
	var str, str1;
	var tabla=tb;

document.formu.idtrabajo.value=id;      // idtrabajo del registro que se va a modificar
document.formu.sidtrabajo.value=document.formu.idtrabajo.value;   

//alert(tabla);

 switch(tabla) { 
  case 'ceditorial': 
		 for (var i=0; i <= (oListaCeditorial.length-1); i++)
		  {  
			  if (oListaCeditorial[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.valor.value=oListaCeditorial[i].nIdrevista;
				 //alert(oListaCeditorial[i].nIdevista);
				 
				 document.formu.desc.value=oListaCeditorial[i].sDescripcion;
				 str=oListaCeditorial[i].sDescripcion;
				 do {    str = str.replace('<br \>','\r\n');
				 } while(str.indexOf('<br \>') >= 0);
				 
				 document.formu.desc.value=str;
				 document.formu.direccion.value=oListaCeditorial[i].sDireccion;
				 document.formu.apostal.value=oListaCeditorial[i].sApostal;
				 document.formu.cpostal.value=oListaCeditorial[i].sCpostal;
				 document.formu.email2.value=oListaCeditorial[i].sEmail;
				 document.formu.director.value=oListaCeditorial[i].sDirector;
				 str1=oListaCeditorial[i].sCeditorial;
				 do {    str1 = str1.replace('<br \>','\r\n');
				 } while(str1.indexOf('<br \>') >= 0);
				 document.formu.ceditorial.value=str1;
				 document.formu.edicion.value=oListaCeditorial[i].sEdicion;
				 document.formu.diseno.value=oListaCeditorial[i].sDiseno;
				 document.formu.realizacion.value=oListaCeditorial[i].sRealizacion;
				 document.formu.estado.value=oListaCeditorial[i].sEstado;
				 break;}
		  }
         break;
  case 'ceditorial_ocean': 
		 for (var i=0; i <= (oListaCeditorial_o.length-1); i++)
		  {  
			  if (oListaCeditorial_o[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.valor.value=oListaCeditorial_o[i].nIdrevista;
				 //alert(oListaCeditorial[i].nIdevista);
				 
				 document.formu.miembros_o.value=oListaCeditorial_o[i].sMiembros;
				 str=oListaCeditorial_o[i].sMiembros;
				 do {    str = str.replace('<br \>','\r\n');
				 } while(str.indexOf('<br \>') >= 0);
				 
				 document.formu.miembros_o.value=str;
				 document.formu.presidente.value=oListaCeditorial_o[i].sPresidente;
				 document.formu.editor_o.value=oListaCeditorial_o[i].sEditor;
				 document.formu.secretaria_o.value=oListaCeditorial_o[i].sSecretaria;
				 break;}
		  }
         break;
  case 'contactos': 
		 for (var i=0; i <= (oListaContacto.length-1); i++)
		  {  
			  if (oListaContacto[i].nId==document.formu.idtrabajo.value)
				{ 
				  document.formu.email.value=oListaContacto[i].sEmail;
				  document.formu.valor.value=oListaContacto[i].nIdRevista;
				  document.formu.estado.value=oListaContacto[i].sEstado;
				}
		  }
         break		 
  case 'datos_revista': //alert('datos_revista');
		 for (var i=0; i <= (oListaDatosrevista.length-1); i++)
		  {  
			  if (oListaDatosrevista[i].nId==document.formu.idtrabajo.value)
				{ var str1=oListaDatosrevista[i].nId;
                 document.formu.valor.value=oListaDatosrevista[i].nId;
                 document.formu.titulo.value=oListaDatosrevista[i].sTitulo;
		//		 alert(oListaDatosrevista[i].sTitulo.length);
				 document.formu.imagen.value=oListaDatosrevista[i].sImgtitulo;
				 document.formu.imagen1.value=oListaDatosrevista[i].sImgtitulo_r;
				 document.formu.imagen2.value=oListaDatosrevista[i].sImgportada;
				 document.formu.issn.value=oListaDatosrevista[i].sIssn;
				 
			 
				 str=oListaDatosrevista[i].sOtrosdatos;
			//	 alert(str);
				 do {    str = str.replace('<br \>','\r\n');
				       //  alert('paso');
				 } while(str.indexOf('<br \>') >= 0);
				 document.formu.otrosdatos.value=str;
				 //document.formu.editora.value=oListaDatosrevista[i].nIdeditorial;
				 document.formu.estado.value=oListaDatosrevista[i].sEstado;
				 //document.formu.fmodifica.value=oListaDatosrevista[i].sModificacion;
				 break;}
		  }
		 for (var i=0; i <= (oListaEditora.length-1); i++)
		  { // alert (oListaEditora[i].nIdrevista+'=='+str1);
			  if (oListaEditora[i].nIdrevista==str1)
				{ 
				  document.formu.editora.value=oListaEditora[i].sNombre;
				  document.formu.imagen4.value=oListaEditora[i].sLogo;
				  document.formu.editora_url.value=oListaEditora[i].sUrl;
				  break;
				}
		  }
		  break;
/*flag= confirm('Alguna modificación en este registro modificará de forma permanente el sitio Web de la publicación.¿Desea continuar?'); 

if (flag==false)
	{
	 return;	
	flag=false;
	window.location='actpseriadas.php?operacion=delete&idtrabajo='+idtrabajo+'&tb='+tabla;
	}*/
         
  case 'informacion_revista':
		 for (var i=0; i <= (oListaInformacionrevista.length-1); i++)
		  {  
			  if (oListaInformacionrevista[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.revista.value=oListaInformacionrevista[i].sRevista;
				 document.formu.valor.value=oListaInformacionrevista[i].nIdRevista;
				 str=oListaInformacionrevista[i].sTexto;
			//	 alert(str);
				 do {    str = str.replace('<br \>','\r\n');
				      
				 } while(str.indexOf('<br \>') >= 0);
				 document.formu.texto.value=str;
				 document.formu.estado.value=oListaInformacionrevista[i].sEstado;
			 break;}
		  } 
         break;
  case 'instrucciones_autores':
		 for (var i=0; i <= (oListaInstrucciones.length-1); i++)
		  {  
			  if (oListaInstrucciones[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.revista.value=oListaInstrucciones[i].sRevista;
				 document.formu.valor.value=oListaInstrucciones[i].nIdRevista;
				 str=oListaInstrucciones[i].sTexto;
			//	 alert(str);
				 do {    str = str.replace('<br \>','\r\n');
				      
				 } while(str.indexOf('<br \>') >= 0);
				 document.formu.texto_instrucciones.value=str;
				 document.formu.estado3.value=oListaInstrucciones[i].sEstado;
			 break;}
		  } 
         break;
  case 'subscripciones':
		 for (var i=0; i <= (oListaSubscripciones.length-1); i++)
		  {  
			  if (oListaSubscripciones[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.nombre.value=oListaSubscripciones[i].sNombre;
				 document.formu.valor.value=oListaSubscripciones[i].nIdRevista;
				 document.formu.institucion.value=oListaSubscripciones[i].sInstitucion;
				 document.formu.ciudad.value=oListaSubscripciones[i].sCiudad;
				 document.formu.direccion.value=oListaSubscripciones[i].sDireccion;
				 document.formu.pais.value=oListaSubscripciones[i].sPais;
				 document.formu.telefono.value=oListaSubscripciones[i].sTelefono;
				 document.formu.fax.value=oListaSubscripciones[i].sFax;
				 document.formu.email1.value=oListaSubscripciones[i].sEmail;
				 document.formu.user.value=oListaSubscripciones[i].sLogin;
				 document.formu.passw.value=oListaSubscripciones[i].sPassw;
				 document.formu.estado.value=oListaSubscripciones[i].sEstado;
			 break;}
		  } 
         break;
  case 'opc_interfaz':
      //   if(document.getElementById['titulo']!='undefined') alert('no esta');
		 for (var i=0; i <= (oListaOpc_interfaz.length-1); i++)
		  {  
			  if (oListaOpc_interfaz[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.opcion_opc_interfaz.value=oListaOpc_interfaz[i].sOpcion;
				 document.formu.valor.value=oListaOpc_interfaz[i].nIdRevista;
			//	 document.formu.titulo.value=oListaOpc_interfaz[i].sTitulo;
				 document.formu.estado.value=oListaOpc_interfaz[i].sEstado;
			 break;}
		  } 
         break;
  case 'user_interfaz':
        // alert('entro a user_interfaz');
		 for (var i=0; i <= (oListaUsuarios.length-1); i++)
		  {  
			  if (oListaUsuarios[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.usuario.value=oListaUsuarios[i].sLogin;
				 document.formu.passw.value=oListaUsuarios[i].sPassw;
				 document.formu.valor.value=oListaUsuarios[i].nIdRevista;
				// alert('valor='+document.formu.valor.value);
				 document.formu.estado.value=oListaUsuarios[i].sEstado;
			 break;}
		  } 
         break;
  case 'menu_ppal': 
		 for (var i=0; i <= (oListaOpc_mnuppal.length-1); i++)
		  {  
			  if (oListaOpc_mnuppal[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.opcion_mnuppal.value=oListaOpc_mnuppal[i].sOpcion;
				 document.formu.posicion.value=oListaOpc_mnuppal[i].sPosicion;
				 document.formu.valor.value=oListaOpc_mnuppal[i].nIdRevista;
				 document.formu.estado.value=oListaOpc_mnuppal[i].sEstado;
			     break;
			   }
		  } 
         break;
 case 'documentos': 
		 for (var i=0; i <= (oListaDocumentos.length-1); i++)
		  {  
			  if (oListaDocumentos[i].nId==document.formu.idtrabajo.value)
				{ 
				   //alert(oListaDocumentos[i].sFichero);
				 document.formu.documento.value=oListaDocumentos[i].sFichero;
				 //alert(document.formu.doc.value);
				 if(oListaDocumentos[i].sResumen==0) document.formu.resumen.value='T';
				 else
				  if(oListaDocumentos[i].sResumen==0) document.formu.resumen.value='R';
				 //document.formu.resumen.value=oListaDocumentos[i].sResumen;
				 document.formu.valor.value=oListaDocumentos[i].nIdRevista;
				 document.formu.estado.value=oListaDocumentos[i].sEstado;
			     break;
			   }
		  } 
         break;
 case 'numeros': //alert('llegue a numeros');
         //alert(oListaNumeros.length);
		 for (var i=0; i <= (oListaNumeros.length-1); i++)
		  {  
			  if (oListaNumeros[i].nId==document.formu.idtrabajo.value)
				{ //alert('i='+i);
				 document.formu.fich.value=oListaNumeros[i].nIdtexto;
				 document.formu.vol.value=oListaNumeros[i].nIdres;
				 document.formu.num.value=oListaNumeros[i].nNumero;
				 document.formu.year.value=oListaNumeros[i].nYear;
				 document.formu.estado.value=oListaNumeros[i].sEstado;
			     break;
			   }
		  } 
         break;
 case 'publicacion_inin': 
		 for (var i=0; i <= (oListaPub.length-1); i++)
		  {  
			  if (oListaPub[i].nId==document.formu.idtrabajo.value)
				{ //alert('i='+i);
				 document.formu.tit_pub_inin.value=oListaPub[i].sTitulo;
				 document.formu.publnum_inin.value=oListaPub[i].nNumero;
				 document.formu.mes_inin.value=oListaPub[i].nMes;
				 document.formu.year_inin.value=oListaPub[i].sAno;
				 document.formu.pais_inin.value=oListaPub[i].sPais;
				 document.formu.doc_inin.value=oListaPub[i].nIdPdf;
				 document.formu.publpg_inin.value=oListaPub[i].nPagina;
			     break;
			   }
		  } 
         break;
 case 'articulo_inin':
		 for (var i=0; i <= (oListaArticulos.length-1); i++)
		  {  
			  if (oListaArticulos[i].nId==document.formu.idtrabajo.value)
				{ //alert('i='+i);
				 document.formu.tit_articulo_inin.value=oListaArticulos[i].sTitulo;
				 document.formu.pclave_inin.value=oListaArticulos[i].sPclaves;
				 document.formu.pub_inin.value=oListaArticulos[i].sPublicacion;
				 document.formu.pubyear_art_inin.value=oListaArticulos[i].sYear;
				 document.formu.num_inin.value=oListaArticulos[i].nNumpub;
				 document.formu.pg_inin.value=oListaArticulos[i].nPagina;
				 document.formu.artdoc_inin.value=oListaArticulos[i].nIdPdf;
//				 document.formu.artdoc_inin.value=oListaArticulos[i].sPdf;
			     break;
			   }
		  } 
         break;
  case 'articulo_ocean':
        // alert('llego');
		 for (var i=0; i <= (oListaArticulos.length-1); i++)
		  {  //alert('i='+i);
			  if (oListaArticulos[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.tit_articulo_ocean.value=oListaArticulos[i].sNombre;
				 document.formu.pclave_ocean.value=oListaArticulos[i].sPclaves;
				 document.formu.pub_autor.value=oListaArticulos[i].nId;
				 str=oListaArticulos[i].sResumen;
			//	 alert(str);
				 do {    str = str.replace('<br />','\r\n');
				 } while(str.indexOf('<br />') >= 0);
				 document.formu.resumenn.value=str;

				 document.formu.pubyear_art_ocean.value=oListaArticulos[i].nAno;
				 document.formu.num_ocean.value=oListaArticulos[i].nNumero;
				 document.formu.tipo_ocean.value=oListaArticulos[i].sTipo;
				 document.formu.artdoc_ocean.value=oListaArticulos[i].sPdf;  /* pdf */
			     break;
			   }
		  } 
         break;
case 'pdf_inin': 
		 for (var i=0; i <= (oListaPdf.length-1); i++)
		  {  
			  if (oListaPdf[i].nId==document.formu.idtrabajo.value)
				{ //alert('i='+i);
				 document.formu.docum_inin.value=oListaPdf[i].sNombre;
				 document.formu.numpdf_inin.value=oListaPdf[i].nNumero;
				 document.formu.pdfyear_inin.value=oListaPdf[i].sYear;
			     break;
			   }
		  } 
         break;
  case 'boletin_ocean':
		 for (var i=0; i <= (oListaBoletin.length-1); i++)
		  {  
			  if (oListaBoletin[i].nId==document.formu.idtrabajo.value)
				{ 
				 document.formu.yearbol_ocean.value=oListaBoletin[i].nAno;
				 document.formu.numbol_ocean.value=oListaBoletin[i].nNumero;
			 break;}
		  } 
         break;
  case 'autores': 
		 for (var i=0; i <= (oListaAutores.length-1); i++)
		  {  
			  if (oListaAutores[i].nId==document.formu.idtrabajo.value)
				{ 
				  document.formu.aautor.value=oListaAutores[i].sAutor;
				}
		  }
         break		 
default: break;
 }
}

function muestra(capa,capa1)
{
var layer=capa;
var accion;

accion=document.form1.ps1.value;
//alert("entro aqui");
switch (accion) {
 case '1':
        document.getElementById(layer).style.display='block';
		document.getElementById('trabajar').style.display='block';
		document.getElementById('activar').style.display='none';
		document.getElementById('desactivar').style.display='none';
        break;
 case '2':
        document.getElementById(layer).style.display='block';
		document.getElementById('activar').style.display='block';
        document.getElementById('trabajar').style.display='none';
		//document.getElementById('pub').style.display='block';
		document.getElementById('desactivar').style.display='none';
        break;
 case '3':
        document.getElementById(layer).style.display='block';
        document.getElementById('trabajar').style.display='none';
		document.getElementById('pub').style.display='block';
		document.getElementById('activar').style.display='none';
		document.getElementById('desactivar').style.display='block';
        break;
 case '4':		
        document.getElementById(layer).style.display='block';
        document.getElementById('trabajar').style.display='block';
		document.getElementById('activar').style.display='none';
		document.getElementById('pub').style.display='block';
		document.getElementById('desactivar').style.display='none';
        break;
 case '5':
        document.getElementById('pub').style.display='none';
        document.getElementById('tarea2').style.display='none';
		window.location='muestra_opciones.php?flag=2&idrevista=0';
        break;
 default:alert('Seleccione la tarea a realizar');
        break;
}

return(accion);
}



function Muestra_menu()
{
var opcion=document.form1.ps1.value;
/*if(document.getElementById('selecc')) alert('idrevista ='+document.publ.selecc.value);
if(document.form1.ps1)alert('opcion ='+opcion);
*/
//document.getElementById(layer).style.display='block';
switch (opcion) {
 case '1':
        var idrevista=document.publ.selecc.value;
		window.location='muestra_opciones.php?idrevista='+idrevista+'&flag=1';
		//alert(idrevista);
        break;
 case '2':
        var idrevista=document.publ.selecc1.value;
		window.location='actpseriadas.php?idrevista='+idrevista+'&flag=1&operacion=activar';
		//alert(idrevista);
        break;
 case '3':
        var idrevista=document.publ.selecc2.value;
		window.location='actpseriadas.php?idrevista='+idrevista+'&flag=1&operacion=desactivar';
		//alert(idrevista);
        break;
 case '4':
        var idrevista=document.publ.selecc.value;
		var flag;
		flag= confirm('La publicación será eliminada de forma permanente.¿Desea continuar?'); 

		if (flag)
			{
			flag=false;
		    window.location='actpseriadas.php?idrevista='+idrevista+'&flag=1&operacion=eliminar';
			}
        break;
 case '5'://alert('****');
		  break;
 default:
        break;
}
}


function MuestraFormulario(sLayer)
{
    var sLayer=sLayer;
	var oDhtml=document.getElementById(sLayer);
	oDhtml.style.top=document.body.scrollTop;
	
	//alert('MuestraFormulario:'+sLayer);
	oDhtml.style.display="block";
	window.location="#tope";	
}

function OcultaFormulario(sLayer)
{
    var oDhtml=document.getElementById(sLayer);
	oDhtml.style.top=document.body.scrollTop;
	oDhtml.style.display="none";
	//alert('OcultaFormulario:'+sLayer);
	window.location="#tope";	
}

function IsAlphaNum( str ) {
/*	if (str+"" == "undefined" || str+"" == "null" || str+"" == "" || str+"" == " ")	
	  {
		return false;
      }
*/	var isValid = true;
	
	// convert to a string for performing string comparisons.
   	str += "";	

	// Loop through length of string and test for any alpha numeric 
	// characters
   	for (i = 0; i < str.length; i++)
   	{
			// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
			 if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || 
      			((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) || (str.charAt(i) == ")") ||
				(str.charAt(i) == "-") || (str.charAt(i) == "_") || (str.charAt(i) == ":") || (str.charAt(i) == "'") ||
				(str.charAt(i) == ",") ||  (str.charAt(i) == "(") ||(str.charAt(i) == "%") ||(str.charAt(i) == '"')||
				(str.charAt(i) == "/") || (str.charAt(i) == " ") || (str.charAt(i) == "á") || (str.charAt(i) == '\\') || (str.charAt(i) == ".") || (str.charAt(i) == "?") || (str.charAt(i) == "¿") ||
                (str.charAt(i) == "\n") || (str.charAt(i) == "\r") || (str.charAt(i) == "!") ||
                (str.charAt(i) == "<") || (str.charAt(i) == ">") || (str.charAt(i) == ";") || 
				(str.charAt(i) == "=")|| (str.charAt(i) == "Á") || (str.charAt(i) == "É")|| (str.charAt(i) == "Í") || (str.charAt(i) == "½")|| (str.charAt(i) == "*") ||
				(str.charAt(i) == "Ó") || (str.charAt(i) == "Ú")  || (str.charAt(i) == "&") ||
				(str.charAt(i) == "é") || (str.charAt(i) == "í")|| (str.charAt(i) == "ú") ||
				(str.charAt(i) == "ó") || (str.charAt(i) == ".") || (str.charAt(i) == "°")||
				(str.charAt(i) == "ñ") || (str.charAt(i) == "Ñ") || (str.charAt(i) == "±")) )
			{
				isValid = false;
				break;
			}	   	
	} // END for   
   	return isValid;
}  // end IsAlphaNum

function IsAlpha( str ) {
/*	if (str+"" == "undefined" || str+"" == "null" || str+"" == "" || str+"" == " ")	
	  {
		return false;
      }
*/	var isValid = true;
	
	// convert to a string for performing string comparisons.
   	str += "";	

	// Loop through length of string and test for any alpha numeric 
	// characters
   	for (i = 0; i < str.length; i++)
   	{
			// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
			 if (!(((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) || (str.charAt(i) == ")") ||
				(str.charAt(i) == "-") || (str.charAt(i) == "_") || (str.charAt(i) == ":") ||
				(str.charAt(i) == ",") ||  (str.charAt(i) == "(") ||(str.charAt(i) == "%") ||(str.charAt(i) == '"')||
				(str.charAt(i) == " ") || (str.charAt(i) == "á") || 
                (str.charAt(i) == "\n") || (str.charAt(i) == "\r") || (str.charAt(i) == "!") ||
				(str.charAt(i) == "Á") || (str.charAt(i) == "É")|| (str.charAt(i) == "Í") ||
				(str.charAt(i) == "Ó") || (str.charAt(i) == "Ú")  || (str.charAt(i) == "&") ||
				(str.charAt(i) == "é") || (str.charAt(i) == "í")|| (str.charAt(i) == "ú") ||
				(str.charAt(i) == "ó") || (str.charAt(i) == ".")|| (str.charAt(i) == "ñ") || (str.charAt(i) == "Ñ") || 
				(str.charAt(i) == "±")|| (str.charAt(i) == "/")) )
			{
				isValid = false;
				break;
			}	   	
	} // END for   
   	return isValid;
}  // end IsAlpha

function IsNum( str ) {
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "" || str+"" == " ")	
	  {
		return false;
      }
	var isValid = true;
	
	// convert to a string for performing string comparisons.
   	str += "";	

	// Loop through length of string and test for any alpha numeric 
	// characters
   	for (i = 0; i < str.length; i++)
   	{
			// numeric must be between "0"-"9"
      	if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || (str.charAt(i) == "-")) ) 
			{
				isValid = false;
				break;
			}	
   	} // END for   
   	return isValid;
}  // end IsNum

function ValidaSuscripcion(sus) { 	
var lResultado=true;
var correo;

correo=document.forms.sus.email.value;	
if( document.forms.sus.fnombre.value == '' && correo=='') { 
	alert('Son campos obligatorios: Nombre y Apellidos,Correo electrónico');
    document.forms.sus.fnombre.focus();  
	return false;
}

if( document.forms.sus.fnombre.value != '') { 
			 if (!IsAlpha(document.forms.sus.fnombre.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre y Apellidos"); 
				document.forms.sus.fnombre.focus();  
				
				return false;
			 } 	
			}
else			
if( document.forms.sus.fnombre.value == '') { 
	alert('Campo obligatorio.Introduzca su Nombre y Apellidos');
	document.forms.sus.fnombre.focus();  
	return false;
}

if(document.forms.sus.institucion.value != '') {
	     if (!IsAlphaNum(document.forms.sus.institucion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Institución"); 
	    	document.forms.sus.institucion.focus();  
	    		return false;
	     } 
	}

if(document.forms.sus.adress.value != '') {
	     if (!IsAlphaNum(document.forms.sus.adress.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Dirección"); 
	    	document.forms.sus.adress.focus();  
			return false;
	     } 
	}
if(document.forms.sus.pais.value != '') {
	     if (!IsAlpha(document.forms.sus.pais.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo País"); 
	    	document.forms.sus.pais.focus();  
	    	return false;
	     } 
	}
if(document.forms.sus.ciudad.value != '') {
	     if (!IsAlpha(document.sus.ciudad.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Ciudad"); 
	    	document.forms.sus.ciudad.focus();  
			return false;
	     } 
	}
if(document.forms.sus.telefono.value != '') {
	     if (!IsNum(document.forms.sus.telefono.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Teléfono"); 
	    	document.forms.sus.telefono.focus();  
	    		return false;
	     } 
	}
if(document.forms.sus.fax.value != '') {
	     if (!IsNum(document.sus.fax.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Fax"); 
	    	document.forms.sus.fax.focus();  
	    		return false;
	     } 
	}
correo=document.forms.sus.email.value;	
if(correo==''){
	alert('Campo obligatorio.Introduzca su Correo electrónico');
	document.forms.sus.email.focus();  
	return false;
}
else {
if ((correo.indexOf('@', 0) == -1) || (correo.indexOf('.', 0) == -1))
		 {
			alert("El correo electrónico no es válido");
	    	document.forms.sus.email.focus();  
	    		return false;
		 }
}
for (var i=0; i <= (oListaSubscripciones.length-1); i++)
  {  
	if ((oListaSubscripciones[i].sNombre==document.forms.sus.fnombre.value) && (oListaSubscripciones[i].sEmail==correo))
	 { 
	alert('Estos datos ya fueron introducidos');
	document.forms.sus.fnombre.focus();  
	return false;
			 break;}
		  } 

}



function chequea(identificador,flag,idrev)   /* Validación */
{
var id=identificador;
var lResultado=true;
var idrevista=idrev;
var email;
//alert(flag);

 switch (id) {
    case 1:
	     if (document.formu.texto.value=='')
	     { 
	    	alert("Por favor introduzca el texto"); 
	    	document.formu.texto.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formu.texto.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Texto"); 
	    	document.formu.otrosdatos.focus();  
	    	lResultado=false;
	     } 	
         break;
  case 2: if(idrevista==1) {
	     if (!IsAlphaNum(document.formu.desc.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Descripción"); 
	    	document.formu.desc.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formu.direccion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Dirección"); 
	    	document.formu.direccion.focus();  
	    	lResultado=false;
	     } /*}*/
	     if(document.formu.apostal.value != '') {
	     if (!IsNum(document.formu.apostal.value))
	     { 
	    	alert("Apartado postal incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.apostal.focus();  
	    	lResultado=false;
			return;
	     } }
	     if(document.formu.cpostal.value != '') {
	     if (!IsNum(document.formu.cpostal.value))
	     { 
	    	alert("Código postal incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.cpostal.focus();  
	    	lResultado=false;
			return;
	     } }
		 email=document.formu.email2.value;
		if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
		  {
			alert("El correo electrónico no es válido");
	    	document.formu.email2.focus();  
	    	lResultado=false;
		  }		
	     if(document.formu.director.value != '') {
	     if (!IsAlpha(document.formu.director.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Director"); 
	    	document.formu.director.focus();  
	    	lResultado=false;
			return;
	     } 	}
		if( document.formu.ceditorial.value != 'null') {
	     if (!IsAlpha(document.formu.ceditorial.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Consejo editorial"); 
	    	document.formu.ceditorial.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formu.edicion.value != 'null') {
	     if (!IsAlpha(document.formu.edicion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Edicion"); 
	    	document.formu.edicion.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formu.diseno.value != 'null') {
	     if (!IsAlpha(document.formu.diseno.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Diseño"); 
	    	document.formu.diseno.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formu.realizacion.value != 'null') {
			 if (!IsAlpha(document.formu.realizacion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Realización"); 
				document.formu.realizacion.focus();  
				lResultado=false;}
	      } 	
         }
		 else
		   if(idrevista==89) { 
		     if( document.formu.presidente.value != '') {
			  if (!IsAlpha(document.formu.presidente.value))
			    { 
			    	alert("Se ha introducido un caracter incorrecto.Revise el campo Presidente"); 
				    document.formu.presidente.focus();  
				    lResultado=false;
					return lResultado;
					}
			 }
			 else
			   {
			    	alert("Teclee el nombre del Presidente"); 
				    document.formu.presidente.focus();  
				    lResultado=false;
					return lResultado;
				}
		     if( document.formu.editor_o.value != '') {
			  if (!IsAlpha(document.formu.editor_o.value))
			    { 
			    	alert("Se ha introducido un caracter incorrecto.Revise el campo Editor jefe"); 
				    document.formu.editor_o.focus();  
				    lResultado=false;
					return lResultado;
					}
			 }
			 else
			   {
			    	alert("Teclee el nombre del Editor jefe"); 
				    document.formu.editor_o.focus();  
				    lResultado=false;
					return lResultado;
				}
		     if( document.formu.secretaria_o.value != '') {
			  if (!IsAlpha(document.formu.secretaria_o.value))
			    { 
			    	alert("Se ha introducido un caracter incorrecto.Revise el campo Secretaria"); 
				    document.formu.secretaria_o.focus();  
				    lResultado=false;
					return lResultado;
					}
			 }
			 else
			   {
			    	alert("Teclee el nombre de la Secretaria"); 
				    document.formu.secretaria_o.focus();  
				    lResultado=false;
					return lResultado;
				}
		     if( document.formu.miembros_o.value != '') {
			  if (!IsAlpha(document.formu.miembros_o.value))
			    { 
			    	alert("Se ha introducido un caracter incorrecto.Revise el campo Miembros"); 
				    document.formu.miembros_o.focus();  
				    lResultado=false;
					return lResultado;
					}
			 }
			 else
			   {
			    	alert("Teclee el nombre de los Miembros"); 
				    document.formu.miembros_o.focus();  
				    lResultado=false;
					return lResultado;
				}
			   }
         break;
	case 4: email=document.formu.email.value;
		if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
		  {
			alert("El correo electrónico no es válido");
	    	document.formu.email.focus();  
	    	lResultado=false;
		  }		
       //  alert(document.formu.email.value);
	     break;
	case 5:	if( document.formu.nombre.value != '') { 
			 if (!IsAlpha(document.formu.nombre.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre y Apellidos"); 
				document.formu.nombre.focus();  
				lResultado=false;
			 } 	
			}
			else
			  {
				alert("Esta información no puede irse vacia"); 
				document.formu.nombre.focus();  
				lResultado=false;
			  }
             if( document.formu.email1.value != 'null') { email=document.formu.email1.value;
			if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
			  {
				alert("El correo electrónico no es válido");
				document.formu.email1.focus();  
				lResultado=false;
			  }	}
			  if(document.formu.institucion.value !='null') {	  
			 if (!IsAlpha(document.formu.institucion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre de la  Institución"); 
				document.formu.institucion.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formu.direccion.value !='null') {	  
			 if (!IsAlpha(document.formu.direccion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise la Dirección"); 
				document.formu.direccion.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formu.ciudad.value !='null') {	  
			 if (!IsAlpha(document.formu.ciudad.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre de la  Ciudad"); 
				document.formu.ciudad.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formu.pais.value !='null') {	  
			 if (!IsAlpha(document.formu.pais.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre del  País"); 
				document.formu.pais.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formu.telefono.value !='') {	  
			 if (!IsNum(document.formu.telefono.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el número de Teléfono"); 
				document.formu.telefono.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formu.fax.value !='') {	  
			 if (!IsNum(document.formu.fax.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el número de Fax"); 
				document.formu.fax.focus();  
				lResultado=false;
			 }
		   }
		  break;
    case 6: if(flag==2) {
		   if(document.formu.titulo.value!='') { 
			for (var i=0; i <= (oListaDatosrevista.length-1); i++)
			 {  
			   if (oListaDatosrevista[i].sTitulo==document.formu.titulo.value)
				{ 
				  alert("Este Título ya ha sido introducido con anterioridad"); 
				  document.formu.titulo.focus();  
				  lResultado=false;
				  break;
				}
		      }
		   }
		  
		 if(document.formu.titulo.value=='') {
			 alert('El campo Título es obligatorio');
				document.formu.titulo.focus();  
				lResultado=false;
			 }
		 else { 
	     if (!IsAlphaNum(document.formu.titulo.value))
			 { 
				alert("Se ha introducido un caracter incorrecto. Revise el campo Título"); 
				document.formu.titulo.focus();  
				lResultado=false;
			 } 
		 else {
		 if(document.formu.userfile.value=='') {
			 alert('El campo Título derecho es obligatorio');
				document.formu.userfile.focus();  
				lResultado=false;
			 }
		 else {	 
		 if(document.formu.userfile1.value=='') {
			 alert('El campo Título izquierdo es obligatorio');
				document.formu.userfile1.focus();  
				lResultado=false;
			 }
		 else {	 
		 if(document.formu.userfile2.value=='') {
			 alert('El campo Imagen portada es obligatorio');
				document.formu.userfile2.focus();  
				lResultado=false;
			 }

         else {
			 if(document.formu.issn.value!='') {
				 if (!IsNum(document.formu.issn.value))
				 { 
					alert("ISSN incorrecto. Solamente se aceptan caracteres numéricos"); 
					document.formu.issn.focus();  
					lResultado=false;
				 }
			          }
		             }
		           }
		         }
		       }
	     	 }
			if(document.formu.editora.value!='') {
			  if (!IsAlphaNum(document.formu.editora.value))
			 { 
				alert("Se ha introducido un caracter incorrecto. Revise el campo Editorial"); 
				document.formu.editora.focus();  
				lResultado=false;
			 } 
			}
	       }
		   
		 if(flag==1) {
		 if(document.formu.titulo.value=='') {
			 alert('El campo Título es obligatorio');
				document.formu.titulo.focus();  
				lResultado=false;
			 }
		 else { 
	     if (!IsAlphaNum(document.formu.titulo.value))
			 { 
				alert("Se ha introducido un caracter incorrecto. Revise el campo Título"); 
				document.formu.titulo.focus();  
				lResultado=false;
			 } 
		 }
			 if(document.formu.issn.value!='') {
				 if (!IsNum(document.formu.issn.value))
				 { 
					alert("ISSN incorrecto. Solamente se aceptan caracteres numéricos"); 
					document.formu.issn.focus();  
					lResultado=false;
				 }
			          }
		           }
		 if (!IsAlphaNum(document.formu.otrosdatos.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Otros datos"); 
	    	document.formu.otrosdatos.focus();  
	    	lResultado=false;
	     }

         break;
    case 7:
	     if(document.formu.usuario.value=='')
	     { 
	    	alert("Llene el campo Usuario"); 
	    	document.formu.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formu.usuario.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Usuario"); 
	    	document.formu.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formu.passw.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Contraseña"); 
	    	document.formu.passw.focus();  
	    	lResultado=false;
	     } 
	
         break;
    case 8:
	     if (!IsAlphaNum(document.formu.opcion_mnuppal.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Opción"); 
	    	document.formu.opcion_mnuppal.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsNum(document.formu.posicion.value))
	     { 
	    	alert("Posición incorrecta. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.posicion.focus();  
	    	lResultado=false;
	     }    
		for (var i=0; i <= (oListaOpc_mnuppal.length-1); i++)
		 {  
		   if ((oListaOpc_mnuppal[i].sPosicion==document.formu.posicion.value) && (oListaOpc_mnuppal[i].sOpcion==document.formu.opcion_mnuppal.value))
		   {
			  break;  
		   }
          else
		   if (oListaOpc_mnuppal[i].sOpcion!=document.formu.opcion_mnuppal.value)
			{
/*			  alert(oListaOpc_mnuppal[i].sPosicion+'='+document.formu.posicion.value);	 
			  alert(oListaOpc_mnuppal[i].sOpcion+'='+document.formu.opcion_mnuppal.value);	 
			  alert("***Esta posición ya ha sido asignada a otra opción"); 
			  document.formu.posicion.focus();  
			  lResultado=false;
*/			  break;
			}
		  } 
		 
         break;
    case 19:
	     if (!IsAlphaNum(document.formu.opcion_opc_interfaz.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre de la opción"); 
	    	document.formu.opcion_opc_interfaz.focus();  
	    	lResultado=false;
	     }
/*		 else
			 for (var i=0; i <= (oListaOpc_interfaz.length-1); i++)
			  {  
				  if (oListaOpc_interfaz[i].sOpcion==document.formu.opcion.value)
					{ 
						alert("Esta opción ya ha sido incluida"); 
						document.formu.opcion.focus();  
						lResultado=false;
						 break;
					 }
			  } */
		 break;
   case 21:
		for (var i=0; i <= (oListaDocumentos.length-1); i++)
		 {  
		   if(document.formu.doc1.value=='') {
		   if (oListaDocumentos[i].sFichero==document.formu.documento.value && oListaDocumentos[i].sResumen==document.formu.resumen.value)
			{ 
			  alert("Este tipo de documento ya ha sido indicado para este documento"); 
			  document.formu.resumen.focus();  
			  lResultado=false;
			  break;
			}
		   }
		  else
		   {
		   if (oListaDocumentos[i].sFichero==document.formu.doc1.value && oListaDocumentos[i].sResumen==document.formu.resumen.value)
			{ 
			  alert("Este tipo de documento ya ha sido indicado para este documento"); 
			  document.formu.resumen.focus();  
			  lResultado=false;
			  break;
			}
		   }
		 }
           break;
   case 20:if (!IsNum(document.formu.vol.value))   
	     { 
	    	alert("Volumen incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.vol.focus();  
	    	lResultado=false;
	     } 
           if (!IsNum(document.formu.num.value))
	     { 
	    	alert("Número incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.num.focus();  
	    	lResultado=false;
	     } 
         if (!IsNum(document.formu.year.value))
	     { 
	    	alert("Año incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formu.year.focus();  
	    	lResultado=false;
	     } 
		 for (var i=0; i <= (oListaNumeros.length-1); i++)
		 {  
		   if (oListaNumeros[i].nYear==document.formu.year.value && oListaNumeros[i].nVolumen==document.formu.vol.value&& oListaNumeros[i].nNumero==document.formu.num.value && oListaNumeros[i].sEstado==document.formu.estado.value && oListaNumeros[i].nIddoc==document.formu.fich.value)
			{ 
			  alert("Modificación no efectuada. Estos datos ya se encuentran en la base de datos."); 
			  document.formu.num.focus();  
			  lResultado=false;
			  break;
			}
		  } 
           break;
   case 24:
         if(idrevista==86) {
          if(document.formu.tit_articulo_inin.value !='') {
			  if (!IsAlphaNum(document.formu.tit_articulo_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Artículo"); 
				document.formu.tit_articulo_inin.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor indique el título del artículo"); 
				document.formu.tit_articulo_inin.focus();  
				lResultado=false;
			}
          if(document.formu.pclave_inin.value !='') {
			 if (!IsAlphaNum(document.formu.pclave_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Palabras clave"); 
				document.formu.pclave_inin.focus();  
				lResultado=false;
			 } 
		  }
         if (!IsAlphaNum(document.formu.pub_inin.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Publicación"); 
	    	document.formu.pub_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formu.pubyear_art_inin.value)) && (document.formu.pubyear_art_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formu.pubyear_art_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formu.num_inin.value)) && (document.formu.num_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formu.num_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formu.pg_inin.value)) && (document.formu.pg_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Página"); 
	    	document.formu.pg_inin.focus();  
	    	lResultado=false;
	     }
		 		    if(document.formu.artdoc_inin.value !='') {
			 if (!IsAlphaNum(document.formu.artdoc_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
				document.formu.artdoc_inin.focus();  
				lResultado=false;
			 } 
		  }
         else
		   if (document.formu.artdoc_inin.value=='')
	     { 
	    	alert("Teclee el nombre del documento que contiene el articulo"); 
	    	document.formu.artdoc_inin.focus();  
	    	lResultado=false;
	     } 
		}
		else
		  if(idrevista==89) {
          if(document.formu.tit_articulo_ocean.value !='') {
			  if (!IsAlphaNum(document.formu.tit_articulo_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Artículo"); 
				document.formu.tit_articulo_ocean.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor indique el título del artículo"); 
				document.formu.tit_articulo_ocean.focus();  
				lResultado=false;
			}
         if (document.formu.pub_autor.value=='-1')
	     { 
	    	alert("Seleccione del listado de documentos el que contiene al artículo"); 
	    	document.formu.pub_autor.focus();  
	    	lResultado=false;
	     } 
          if(document.formu.pclave_ocean.value !='') {
			 if (!IsAlphaNum(document.formu.pclave_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Palabras clave"); 
				document.formu.pclave_ocean.focus();  
				lResultado=false;
			 } 
		  }
		    if(document.formu.resumenn.value !='') {
			 if (!IsAlphaNum(document.formu.resumenn.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Resumen"); 
				document.formu.resumenn.focus();  
				lResultado=false;
			 } 
		  }
 
         if ((!IsNum(document.formu.pubyear_art_ocean.value)) && (document.formu.pubyear_art_ocean.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
	    	document.formu.pubyear_art_ocean.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formu.num_ocean.value)) && (document.formu.num_ocean.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formu.num_ocean.focus();  
	    	lResultado=false;
	     } 
		    if(document.formu.artdoc_ocean.value !='') {
			 if (!IsAlphaNum(document.formu.artdoc_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
				document.formu.artdoc_ocean.focus();  
				lResultado=false;
			 } 
		  }
         else
		   if (document.formu.artdoc_ocean.value=='')
	     { 
	    	alert("Teclee el nombre del documento que contiene el articulo"); 
	    	document.formu.artdoc_ocean.focus();  
	    	lResultado=false;
	     } 

	 }
           break;
   case 25:if(idrevista==86) {
				if(document.formu.tit_pub_inin.value != '') {
					if (!IsAlphaNum(document.formu.tit_pub_inin.value))
					 { 
						alert("Se ha introducido un caracter incorrecto.Revise el campo Título"); 
						document.formu.tit_pub_inin.focus();  
						lResultado=false;
					 }
				}
				else
					{
						alert("Por favor indique el título de la publicación"); 
						document.formu.tit_pub_inin.focus();  
						lResultado=false;
					}
				 if ((!IsNum(document.formu.publnum_inin.value)) && (document.formu.publnum_inin.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
					document.formu.publnum_inin.focus();  
					lResultado=false;
				 } 
				 if ((!IsNum(document.formu.mes_inin.value)) && (document.formu.mes_inin.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Mes"); 
					document.formu.mes_inin.focus();  
					lResultado=false;
				 } 
				 if ((!IsAlphaNum(document.formu.year_inin.value)) && (document.formu.year_inin.value!=''))
				 { 
					alert("Se ha introducido un caracter incorrecto.Revise el campo Año"); 
					document.formu.year_inin.focus();  
					lResultado=false;
				 } 
				 if ((!IsAlpha(document.formu.pais_inin.value)) && (document.formu.pais_inin.value!=''))
				 { 
					alert("Se ha introducido un caracter incorrecto.Revise el campo País"); 
					document.formu.pais_inin.focus();  
					lResultado=false;
				 } 
				 if (!IsAlphaNum(document.formu.doc_inin.value))
				 { 
					alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
					document.formu.doc_inin.focus();  
					lResultado=false;
				 } 
				 if ((!IsNum(document.formu.publpg_inin.value)) && (document.formu.publpg_inin.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Página"); 
					document.formu.publpg_inin.focus();  
					lResultado=false;
				 }
              }
			  else
			    if(idrevista==89) {
				 if ((!IsNum(document.formu.yearbol_ocean.value)) && (document.formu.yearbol_ocean.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
					document.formu.yearbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 else
				  if(document.formu.yearbol_ocean.value=='')
				 { 
					alert("Indique el año de la publicación"); 
					document.formu.yearbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 
				 if ((!IsNum(document.formu.numbol_ocean.value)) && (document.formu.numbol_ocean.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
					document.formu.numbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 else
				  if(document.formu.numbol_ocean.value=='')
				 { 
					alert("Indique el número de la publicación"); 
					document.formu.numbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				}
           break;
   case 26:
         if ((!IsNum(document.formu.numpdf_inin.value)) && (document.formu.numpdf_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formu.numpdf_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formu.pdfyear_inin.value)) && (document.formu.pdfyear_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
	    	document.formu.pdfyear_inin.focus();  
	    	lResultado=false;
	     } 
           break;
   case 27:
          if(document.formu.aautor.value !='') {
			  if (!IsAlpha(document.formu.aautor.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Autor"); 
				document.formu.aautor.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor seleccione el nombre del autor que desea modificar"); 
				document.formu.aautor.focus();  
				lResultado=false;
			}
           break;
   default:
	     break;
 }

 if(lResultado==true) { document.formu.submit(); }
}

function Chequea_agregar(identificador,idrev)   /* Validación */
{
var id=identificador;
var lResultado=true;
var email;
var idrevista=idrev;
document.formagregar.sesion.value=id;

/*alert('Entro a Chequea_agregar id= '+ document.formagregar.sesion.value);*/
//alert('idrevista='+idrevista);
 switch (id) {
    case 1:
	     if (document.formagregar.texto.value!=''){
			 if (!IsAlphaNum(document.formagregar.texto.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Texto"); 
				document.formagregar.texto.focus();  
				lResultado=false;
			  } 
		 }
		 else
		 {
				alert("Es obligatorio llenar el campo Texto"); 
				document.formagregar.texto.focus();  
				lResultado=false;
		 }
         break;
  case 2:   
           if(document.formagregar.desc.value!='') {
			 if (!IsAlphaNum(document.formagregar.desc.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Descripción"); 
				document.formagregar.desc.focus();  
				lResultado=false;
			 }
            }
			else
			  {
				alert("Es obligatorio llenar el campo Descripción"); 
				document.formagregar.desc.focus();  
				lResultado=false;
				return;
			  }
           if(document.formagregar.direccion.value!='') {
			 if (!IsAlphaNum(document.formagregar.direccion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise la Dirección"); 
				document.formagregar.direccion.focus();  
				lResultado=false;
			 }
            }
			else
			  {
				alert("Es obligatorio llenar el campo Dirección"); 
				document.formagregar.direccion.focus();  
				lResultado=false;
			  }
		 if(document.formagregar.apostal.value!='') {	  
			 if (!IsNum(document.formagregar.apostal.value))
			 { 
				alert("Apartado postal incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.apostal.focus();  
				lResultado=false;
			 }
		 }
		 if(document.formagregar.cpostal.value!='' ){
			 if (!IsNum(document.formagregar.cpostal.value))
			 { 
				alert("Código postal incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.cpostal.focus();  
				lResultado=false;
			 }
		 }
		 email=document.formagregar.email2.value;
		if(email!='') { 
			if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
			  {
				alert("El correo electrónico no es válido");
				document.formagregar.email2.focus();  
				lResultado=false;
			  }
		}
		 else
			  {
				alert("Es obligatorio llenar el campo E-mail"); 
				document.formagregar.email2.focus();  
				lResultado=false;
			  }
         if(document.formagregar.director.value!=''){
			 if (!IsAlpha(document.formagregar.director.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Director"); 
				document.formagregar.director.focus();  
				lResultado=false;
			 } 	
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Director"); 
				document.formagregar.director.focus();  
				lResultado=false;
		  }
		if( document.formagregar.ceditorial.value != 'null') {
	     if (!IsAlpha(document.formagregar.ceditorial.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Consejo editorial"); 
	    	document.formagregar.ceditorial.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.edicion.value != 'null') {
	     if (!IsAlpha(document.formagregar.edicion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Edicion"); 
	    	document.formagregar.edicion.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.diseno.value != 'null') {
	     if (!IsAlpha(document.formagregar.diseno.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Diseño"); 
	    	document.formagregar.diseno.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.realizacion.value != 'null') {
	     if (!IsAlpha(document.formagregar.realizacion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Realización"); 
	    	document.formagregar.realizacion.focus();  
	    	lResultado=false;
	     } 	}
         break;
	case 3: if (document.formagregar.texto_instrucciones.value!=''){
			 if (!IsAlphaNum(document.formagregar.texto_instrucciones.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Texto"); 
				document.formagregar.texto_instrucciones.focus();  
				lResultado=false;
			  } 
		 }
		 else
		 {
				alert("Es obligatorio llenar el campo Texto"); 
				document.formagregar.texto_instrucciones.focus();  
				lResultado=false;
		 }
         break;
	case 4: email=document.formagregar.email.value;
	       // alert(email);
		if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
		  {
			alert("El correo electrónico no es válido");
	    	document.formagregar.email.focus();  
	    	lResultado=false;
		  }		
       //  alert(document.formu.email.value);
	     break;
	case 5:	if( document.formagregar.nombre.value != '') { 
			 for (var i=0; i <= (oListaSubscripciones.length-1); i++)
			  {  
				  if (oListaSubscripciones[i].sNombre==document.formagregar.nombre.value)
					{ 
						alert("Esta persona ya está subscrita a la publicación"); 
						document.formagregar.nombre.focus();  
						lResultado=false;
						 break;
					 }
			  }
			 if (!IsAlpha(document.formagregar.nombre.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre y Apellidos"); 
				document.formagregar.nombre.focus();  
				lResultado=false;
			 } 	
			}
			else
			  {
				alert("Es imprescindible llenar este campo"); 
				document.formagregar.nombre.focus();  
				lResultado=false;
				return;
			  }
             if( document.formagregar.email1.value != 'null') 
			 { email=document.formagregar.email1.value;
				if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
				  {
					//alert (document.formagregar.email.value);
					alert("El correo electrónico no es válido");
					document.formagregar.email1.focus();  
					lResultado=false;
			  	  }	
			  }
		   if(document.formagregar.institucion.value !='null') {	  
			 if (!IsAlpha(document.formagregar.institucion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre de la  Institución"); 
				document.formagregar.institucion.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formagregar.direccion.value !='null') {	  
			 if (!IsAlpha(document.formu.direccion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise la Dirección"); 
				document.formagregar.direccion.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formagregar.ciudad.value !='null') {	  
			 if (!IsAlpha(document.formu.ciudad.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre de la  Ciudad"); 
				document.formagregar.ciudad.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formagregar.pais.value !='null') {	  
			 if (!IsAlpha(document.formagregar.pais.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el nombre del  País"); 
				document.formagregar.pais.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formagregar.telefono.value !='') {	  
			 if (!IsNum(document.formagregar.telefono.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el número de Teléfono"); 
				document.formagregar.telefono.focus();  
				lResultado=false;
			 }
		   }
			 if(document.formagregar.fax.value !='') {	  
			 if (!IsNum(document.formagregar.fax.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el número de Fax"); 
				document.formagregar.fax.focus();  
				lResultado=false;
			 }
		   }
		  break;
    case 6:
	     if (!IsAlphaNum(document.formagregar.otrosdatos.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Otros datos"); 
	    	document.formagregar.otrosdatos.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.titulo.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Título"); 
	    	document.formagregar.titulo.focus();  
	    	lResultado=false;
	     } 
	
	     if (!IsNum(document.formagregar.issn.value))
	     { 
	    	alert("ISSN incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.issn.focus();  
	    	lResultado=false;
	     }
         break;
    case 7:
	     if(document.formagregar.usuario.value=='')
	     { 
	    	alert("Llene el campo Usuario"); 
	    	document.formagregar.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.usuario.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Usuario"); 
	    	document.formagregar.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.passw.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Contraseña"); 
	    	document.formagregar.passw.focus();  
	    	lResultado=false;
	     } 
	
         break;
    case 8:
	     if(document.formagregar.opcion_mnuppal.value!='') {
			 if (!IsAlphaNum(document.formagregar.opcion_mnuppal.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Opción"); 
				document.formagregar.opcion_mnuppal.focus();  
				lResultado=false;
			 }
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Opción"); 
				document.formagregar.opcion_mnuppal.focus();  
				lResultado=false;
				return;
		  }
		 if(document.formagregar.posicion.value!=''){ 
		     if(document.formagregar.posicion.value==0) 
			  {
				alert("La posición 0 no se acepta"); 
				document.formagregar.posicion.focus();  
				lResultado=false;
				return;
			  }
			 else { 
				 if (!IsNum(document.formagregar.posicion.value))
				 { 
					alert("Solamente se aceptan caracteres numéricos"); 
					document.formagregar.posicion.focus();  
					lResultado=false;
				 } 
			 }
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Posición"); 
				document.formagregar.posicion.focus();  
				lResultado=false;
				return;
		  }
		for (var i=0; i <= (oListaOpc_mnuppal.length-1); i++)
		 {  
		   if (oListaOpc_mnuppal[i].sPosicion==document.formagregar.posicion.value)
			{ 
			  alert("Esta posición ya ha sido asignada a otra opción"); 
			  document.formagregar.posicion.focus();  
			  lResultado=false;
			  break;
			}
		  } 
		 
         break;
    case 19:
	     if (!IsAlphaNum(document.formagregar.opcion_opc_interfaz.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre de la opción"); 
	    	document.formagregar.opcion_opc_interfaz.focus();  
	    	lResultado=false;
	     }
		 else
			 for (var i=0; i <= (oListaOpc_interfaz.length-1); i++)
			  {  
				  if (oListaOpc_interfaz[i].sOpcion==document.formagregar.opcion_opc_interfaz.value)
					{ 
						alert("Esta opción ya ha sido incluída"); 
						document.formagregar.opcion_opc_interfaz.focus();  
						lResultado=false;
						 break;
					 }
			  } 
		 break;
   case 20:
        if(document.formagregar.vol.value!='') {
        if (!IsNum(document.formagregar.vol.value))
	     { 
	    	alert("Volumen incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.vol.focus();  
	    	lResultado=false;
	     } }
		 if(document.formagregar.num.value!='') {
           if (!IsNum(document.formagregar.num.value))
	     { 
	    	alert("Número incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.num.focus();  
	    	lResultado=false;
	     } } 
		 if(document.formagregar.year.value!='') {
			 if (!IsNum(document.formagregar.year.value))
			 { 
				alert("Año incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.year.focus();  
				lResultado=false;
			 } 
		 }
		 else
		   {
				alert("Es obligatorio indicar el Año de la publicación"); 
				document.formagregar.year.focus();  
				lResultado=false;
				return;
		   }
		 for (var i=0; i <= (oListaNumeros.length-1); i++)
		 {  
		   if (oListaNumeros[i].nYear==document.formagregar.year.value && oListaNumeros[i].nVolumen==document.formagregar.vol.value&& oListaNumeros[i].nNumero==document.formagregar.num.value && oListaNumeros[i].nIddoc==document.formagregar.fich.value)
			{ 
			  alert("Esta información ya se encuentra en la base de datos"); 
			  document.formagregar.num.focus();  
			  lResultado=false;
			  break;
			}
		  } 
           break;
   case 21: 
           if(document.formagregar.doc1.value=='') 
		     {
			  alert("Es obligatorio llenar el campo Documento"); 
			  document.formagregar.doc1.focus();  
			  lResultado=false;
			  return;
			 }
           for (var i=0; i <= (oListaDocumentos.length-1); i++)
		  {  
		   if (oListaDocumentos[i].sFichero==document.formagregar.doc1.value && oListaDocumentos[i].sResumen==document.formagregar.resumen.value)
			{ 
			  alert("Este documento ya ha sido introducido"); 
			  document.formagregar.doc.focus();  
			  lResultado=false;
			  break;
			}
		  }
//alert('me fui de Chequea_agregar L1714');        
             break;
   case 24: if(idrevista==86) {
          if(document.formagregar.tit_articulo_inin.value !='') {
			  if (!IsAlphaNum(document.formagregar.tit_articulo_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Artículo"); 
				document.formagregar.tit_articulo_inin.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor indique el título del artículo"); 
				document.formagregar.tit_articulo_inin.focus();  
				lResultado=false;
			}
          if(document.formagregar.pclave_inin.value !='') {
			 if (!IsAlphaNum(document.formagregar.pclave_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Palabras clave"); 
				document.formagregar.pclave_inin.focus();  
				lResultado=false;
			 } 
		  }
         if (document.formagregar.pub_inin.value=='')
	     { 
	    	alert("Por favor seleccione la Publicación"); 
	    	document.formagregar.pub_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formagregar.pubyear_art_inin.value)) && (document.formagregar.pubyear_art_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formagregar.pubyear_art_inin.focus();  
	    	lResultado=false;
	     }
		 else if(document.formagregar.pubyear_art_inin.value==''){
	    	alert("Indique el año de la publicación"); 
	    	document.formagregar.pubyear_art_inin.focus();  
	    	lResultado=false;
		 }
         if ((!IsNum(document.formagregar.num_inin.value)) && (document.formagregar.num_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formagregar.num_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.num_inin.value==''){
	    	alert("Indique el número de la publicación"); 
	    	document.formagregar.num_inin.focus();  
	    	lResultado=false;
		 }
         if ((!IsNum(document.formagregar.pg_inin.value)) && (document.formagregar.pg_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Página"); 
	    	document.formagregar.pg_inin.focus();  
	    	lResultado=false;
	     }
		   if (document.formagregar.artdoc_inin.value=='')
	     { 
	    	alert("Seleccione el documento_pdf"); 
	    	document.formagregar.artdoc_inin.focus();  
	    	lResultado=false;
	     }
      }
		else
		  if(idrevista==89) {
          if(document.formagregar.tit_articulo_ocean.value !='') {
			  if (!IsAlphaNum(document.formagregar.tit_articulo_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Artículo") 
				document.formagregar.tit_articulo_ocean.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor indique el título del artículo"); 
				document.formagregar.tit_articulo_ocean.focus();  
				lResultado=false;
			}
/*         if (document.formagregar.pub_autor.value=='')
	     { 
	    	alert("Seleccione del listado de documentos el que contiene al artículo"); 
	    	document.formagregar.pub_autor.focus();  
	    	lResultado=false;
	     }*/
        if(document.formagregar.pub_autor.value !='') {
			 if (!IsAlphaNum(document.formagregar.pub_autor.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Autor"); 
				document.formagregar.pub_autor.focus();  
				lResultado=false;
			 } 
		  }
         else
		   if (document.formagregar.pub_autor.value=='')
	     { 
	    	alert("Indique el autor/es del articulo"); 
	    	document.formagregar.artdoc_ocean.focus();  
	    	lResultado=false;
	     } 
		 
          if(document.formagregar.pclave_ocean.value !='') {
			 if (!IsAlphaNum(document.formagregar.pclave_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Palabras clave"); 
				document.formagregar.pclave_ocean.focus();  
				lResultado=false;
			 } 
		  }
		    if(document.formagregar.resumenn.value !='') {
			 if (!IsAlphaNum(document.formagregar.resumenn.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Resumen"); 
				document.formagregar.resumenn.focus();  
				lResultado=false;
			 } 
		  }
 
         if ((!IsNum(document.formagregar.pubyear_art_ocean.value)) && (document.formagregar.pubyear_art_ocean.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
	    	document.formagregar.pubyear_art_ocean.focus();  
	    	lResultado=false;
	     }
		 else
		   if(document.formagregar.pubyear_art_ocean.value=='')
	     { 
	    	alert("Indique el año por favor"); 
	    	document.formagregar.pubyear_art_ocean.focus();  
	    	lResultado=false;
	     }
         if ((!IsNum(document.formagregar.num_ocean.value)) && (document.formagregar.num_ocean.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formagregar.num_ocean.focus();  
	    	lResultado=false;
	     } 
        else
		 if(document.formagregar.num_ocean.value=='')
	     { 
	    	alert("Indique el Número"); 
	    	document.formagregar.num_ocean.focus();  
	    	lResultado=false;
	     } 
        if(document.formagregar.artdoc_ocean.value !='') {
			 if (!IsAlphaNum(document.formagregar.artdoc_ocean.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
				document.formagregar.artdoc_ocean.focus();  
				lResultado=false;
			 } 
		  }
         else
		   if (document.formagregar.artdoc_ocean.value=='')
	     { 
	    	alert("Teclee el nombre del documento que contiene el articulo"); 
	    	document.formagregar.artdoc_ocean.focus();  
	    	lResultado=false;
	     } 

	 }
           break;
   case 25: if(idrevista==86) {
        if(document.formagregar.tit_pub_inin.value != '') {
			if (!IsAlphaNum(document.formagregar.tit_pub_inin.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Título"); 
				document.formagregar.tit_pub_inin.focus();  
				lResultado=false;
			 }
		}
		else
		    {
				alert("Por favor indique el título de la publicación"); 
				document.formagregar.tit_pub_inin.focus();  
				lResultado=false;
			}
         if ((!IsNum(document.formagregar.publnum_inin.value)) && (document.formagregar.publnum_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formagregar.publnum_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.publnum_inin.value=='')
	     { 
	    	alert("Indique el número de la publicación"); 
	    	document.formagregar.publnum_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formagregar.mes_inin.value)) && (document.formagregar.mes_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Mes"); 
	    	document.formagregar.mes_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.mes_inin.value=='')
	     { 
	    	alert("Indique el mes de la publicación"); 
	    	document.formagregar.mes_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formagregar.year_inin.value)) && (document.formagregar.year_inin.value!=''))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Año"); 
	    	document.formagregar.year_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.year_inin.value=='')
	     { 
	    	alert("Indique el año de la publicación"); 
	    	document.formagregar.year_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsAlpha(document.formagregar.pais_inin.value)) && (document.formagregar.pais_inin.value!=''))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo País"); 
	    	document.formagregar.pais_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.pais_inin.value=='')
	     { 
	    	alert("Indique el país de procedencia de la publicación"); 
	    	document.formagregar.pais_inin.focus();  
	    	lResultado=false;
	     } 
         if (!IsAlphaNum(document.formagregar.doc_inin.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
	    	document.formagregar.doc_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.doc_inin.value=='')
	     { 
	    	alert("Seleccione el documento en formato pdf que contiene esta publicación"); 
	    	document.formagregar.publnum_inin.focus();  
	    	lResultado=false;
	     } 
         if ((!IsNum(document.formagregar.publpg_inin.value)) && (document.formagregar.publpg_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Página"); 
	    	document.formagregar.publpg_inin.focus();  
	    	lResultado=false;
	     }
   }
          else
		    if(idrevista==89) {
				 if ((!IsNum(document.formagregar.ayearbol_ocean.value)) && (document.formagregar.ayearbol_ocean.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
					document.formagregar.ayearbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 else
				  if(document.formagregar.ayearbol_ocean.value=='')
				 { 
					alert("Indique el año de la publicación"); 
					document.formagregar.ayearbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 
				 if ((!IsNum(document.formagregar.anumbol_ocean.value)) && (document.formagregar.anumbol_ocean.value!=''))
				 { 
					alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
					document.formagregar.anumbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				 else
				  if(document.formagregar.anumbol_ocean.value=='')
				 { 
					alert("Indique el número de la publicación"); 
					document.formagregar.anumbol_ocean.focus();  
					lResultado=false;
					return lResultado;
				 }
				}
           break;
   case 26:
         if ((!IsAlphaNum(document.formagregar.docum_inin.value)) && (document.formagregar.docum_inin.value!=''))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Documento_pdf"); 
	    	document.formagregar.docum_inin.focus();  
	    	lResultado=false;
	     }
		 else if(document.formagregar.docum_inin.value=='') {
	    	alert("Escriba el nombre del documento_pdf"); 
	    	document.formagregar.docum_inin.focus();  
	    	lResultado=false;
	     }
			 
         if ((!IsNum(document.formagregar.numpdf_inin.value)) && (document.formagregar.numpdf_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Número"); 
	    	document.formagregar.numpdf_inin.focus();  
	    	lResultado=false;
	     }
		 else if(document.formagregar.numpdf_inin.value=='') {
	    	alert("Indique el número"); 
	    	document.formagregar.numpdf_inin.focus();  
	    	lResultado=false;
		 }
         if ((!IsNum(document.formagregar.pdfyear_inin.value)) && (document.formagregar.pdfyear_inin.value!=''))
	     { 
	    	alert("Se aceptan solamente caracteres numéricos.Revise el campo Año"); 
	    	document.formagregar.pdfyear_inin.focus();  
	    	lResultado=false;
	     } 
		 else if(document.formagregar.pdfyear_inin.value=='') {
	    	alert("Indique el año"); 
	    	document.formagregar.pdfyear_inin.focus();  
	    	lResultado=false;
		 }
           break;
case 27:		   
          if(document.formagregar.aautor.value !='') {
			  if (!IsAlpha(document.formagregar.aautor.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Autor"); 
				document.formagregar.aautor.focus();  
				lResultado=false;
			 }
		  }
		  else
		    {
				alert("Por favor indique el nombre del autor"); 
				document.formagregar.aautor.focus();  
				lResultado=false;
			}
           break;
	default: 
	     break;
 }

 if(lResultado==true) {
 document.formagregar.submit(); }
}

function Chequea_agregar1(capa,valor,tb)   /* Validación */
{
var id=capa;
var lResultado=true;
var sesion_id=valor;
var tabla=tb;
var email;

if (document.getElementById('sesion')) { 
document.formagregar.sesion.value=sesion_id;
document.formagregar.tabla.value=tabla;
//alert('En Chequea_agregar1 sesion_id='+sesion_id+'   tabla='+tabla);
//alert('existe');
}
//alert('Entro a Chequea_agregar1 id= '+ id);
//alert('id= '+ document.formagregar.sesion.value);

 switch (id) {
    case 'info_revista': 
	     if (document.formagregar.texto.value!=''){
			 if (!IsAlphaNum(document.formagregar.texto.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Texto"); 
				document.formagregar.texto.focus();  
				lResultado=false;
			  } 
		 }
		 else
		 {
				alert("Es obligatorio llenar el campo Texto"); 
				document.formagregar.texto.focus();  
				lResultado=false;
		 }
         break;
  case 'ceditorial':
           if(document.formagregar.desc.value!='') {
			 if (!IsAlphaNum(document.formagregar.desc.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Descripción"); 
				document.formagregar.desc.focus();  
				lResultado=false;
			 }
            }
			else
			  {
				alert("Es obligatorio llenar el campo Descripción"); 
				document.formagregar.desc.focus();  
				lResultado=false;
				return;
			  }
		 if(document.formagregar.direccion.value!='') {	  
			 if (!IsAlphaNum(document.formagregar.direccion.value))
			 { 
				alert("Se ha introducido un caracter incorrecto. Revise el campo Dirección"); 
				document.formagregar.direccion.focus();  
				lResultado=false;
			 } 
		 }
			else
			  {
				alert("Es obligatorio llenar el campo Dirección"); 
				document.formagregar.direccion.focus();  
				lResultado=false;
				return;
			  }
		 if(document.formagregar.apostal.value!='') {	  
			 if (!IsNum(document.formagregar.apostal.value))
			 { 
				alert("Apartado postal incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.apostal.focus();  
				lResultado=false;
			 }
		 }
		 if(document.formagregar.cpostal.value!='' ){
			 if (!IsNum(document.formagregar.cpostal.value))
			 { 
				alert("Código postal incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.cpostal.focus();  
				lResultado=false;
			 }
		 }
		 email=document.formagregar.email2.value;
		if(email!='') { 
			if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
			  {
				alert("El correo electrónico no es válido");
				document.formagregar.email2.focus();  
				lResultado=false;
			  }
		}
		 else
			  {
				alert("Es obligatorio llenar el campo E-mail"); 
				document.formagregar.email2.focus();  
				lResultado=false;
				return;
			  }
         if(document.formagregar.director.value!=''){
			 if (!IsAlpha(document.formagregar.director.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Director"); 
				document.formagregar.director.focus();  
				lResultado=false;
			 } 	
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Director"); 
				document.formagregar.director.focus();  
				lResultado=false;
				return;
		  }
		if( document.formagregar.ceditorial.value != 'null') {
	     if (!IsAlpha(document.formagregar.ceditorial.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Consejo editorial"); 
	    	document.formagregar.ceditorial.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.edicion.value != 'null') {
	     if (!IsAlpha(document.formagregar.edicion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Edicion"); 
	    	document.formagregar.edicion.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.diseno.value != 'null') {
	     if (!IsAlpha(document.formagregar.diseno.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Diseño"); 
	    	document.formagregar.diseno.focus();  
	    	lResultado=false;
	     } 	}
		if( document.formagregar.realizacion.value != 'null') {
	     if (!IsAlpha(document.formagregar.realizacion.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Realización"); 
	    	document.formagregar.realizacion.focus();  
	    	lResultado=false;
	     } 	}
         break;
	case 'instrucciones':
	       if (document.formagregar.texto_instrucciones.value!=''){
			 if (!IsAlphaNum(document.formagregar.texto_instrucciones.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Texto"); 
				document.formagregar.texto_instrucciones.focus();  
				lResultado=false;
			  } 
			 }
			 else
			 {
					alert("Es obligatorio llenar el campo Texto"); 
					document.formagregar.texto_instrucciones.focus();  
					lResultado=false;
			 }
			 break;
	case 'contacto': email=document.getElementById("email").value;
/*	        if(document.getElementById("email"))
			    alert('existe');
			else
			    alert('no existe');
	        alert('email= '+document.getElementById("email").value);*/
		if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
		  {
			alert("El correo electrónico no es válido");
	    	document.formagregar.email.focus();  
	    	lResultado=false;
		  }		
       //  alert(document.formu.email.value);
	     break;
	case 'suscripcion':
	      if( document.formagregar.nombre.value != '') { 
			 for (var i=0; i <= (oListaSubscripciones.length-1); i++)
			  {  
				  if (oListaSubscripciones[i].sNombre==document.formagregar.nombre.value)
					{ 
						alert("Esta persona ya está subscrita a la publicación"); 
						document.formagregar.nombre.focus();  
						lResultado=false;
						 break;
					 }
			  }
			 if (!IsAlpha(document.formagregar.nombre.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre y Apellidos"); 
				document.formagregar.nombre.focus();  
				lResultado=false;
			 } 	
			}
			else
			  {
				alert("Es obligatorio llenar el campo Nombre y Apellidos"); 
				document.formagregar.nombre.focus();  
				lResultado=false;
				return;
			  }
             if( document.formagregar.email1.value != 'null') 
			 { email=document.formagregar.email1.value;
				if ((email.indexOf('@', 0) == -1) || (email.indexOf('.', 0) == -1))
				  {
					//alert (document.formagregar.email.value);
					alert("El correo electrónico no es válido");
					document.formagregar.email1.focus();  
					lResultado=false;
			  	  }	
			  }

		  break;
    case 'datos_revista':
	     if (!IsAlphaNum(document.formagregar.otrosdatos.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Otros datos"); 
	    	document.formagregar.otrosdatos.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.titulo.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Título"); 
	    	document.formagregar.titulo.focus();  
	    	lResultado=false;
	     } 
	
	     if (!IsNum(document.formagregar.issn.value))
	     { 
	    	alert("ISSN incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.issn.focus();  
	    	lResultado=false;
	     }
         break;
    case 'usuario_i':
	     if(document.formagregar.usuario.value=='')
	     { 
	    	alert("Llene el campo Usuario"); 
	    	document.formagregar.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.usuario.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Usuario"); 
	    	document.formagregar.usuario.focus();  
	    	lResultado=false;
	     } 	
	     if (!IsAlphaNum(document.formagregar.passw.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto. Revise el campo Contraseña"); 
	    	document.formagregar.passw.focus();  
	    	lResultado=false;
	     } 
         break;
    case 'opc_mnuppal':
	     if(document.formagregar.opcion_mnuppal.value!='') {
			 if (!IsAlphaNum(document.formagregar.opcion_mnuppal.value))
			 { 
				alert("Se ha introducido un caracter incorrecto.Revise el campo Opción"); 
				document.formagregar.opcion_mnuppal.focus();  
				lResultado=false;
			 }
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Opción"); 
				document.formagregar.opcion_mnuppal.focus();  
				lResultado=false;
				return;
		  }
		 if(document.formagregar.posicion.value!=''){ 
		     if(document.formagregar.posicion.value==0) 
			  {
				alert("La posición 0 no se acepta"); 
				document.formagregar.posicion.focus();  
				lResultado=false;
				return;
			  }
			 else { 
				 if (!IsNum(document.formagregar.posicion.value))
				 { 
					alert("Solamente se aceptan caracteres numéricos"); 
					document.formagregar.posicion.focus();  
					lResultado=false;
				 } 
			 }
		 }
		 else
		  {
				alert("Es obligatorio llenar el campo Posición"); 
				document.formagregar.posicion.focus();  
				lResultado=false;
				return;
		  }
		for (var i=0; i <= (oListaOpc_mnuppal.length-1); i++)
		 {  
		   if (oListaOpc_mnuppal[i].sPosicion==document.formagregar.posicion.value)
			{ 
			  alert("Esta posición ya ha sido asignada a otra opción"); 
			  document.formagregar.posicion.focus();  
			  lResultado=false;
			  break;
			}
		  } 
         break;
    case 'opc_interfaz':
	     if (!IsAlphaNum(document.formagregar.opcion_opc_interfaz.value))
	     { 
	    	alert("Se ha introducido un caracter incorrecto.Revise el campo Nombre de la opción"); 
	    	document.formagregar.opcion_opc_interfaz.focus();  
	    	lResultado=false;
	     }
		 else
			 for (var i=0; i <= (oListaOpc_interfaz.length-1); i++)
			  {  
				  if (oListaOpc_interfaz[i].sOpcion==document.formagregar.opcion_opc_interfaz.value)
					{ 
						alert("Esta opción ya ha sido incluída"); 
						document.formagregar.opcion_opc_interfaz.focus();  
						lResultado=false;
						 break;
					 }
			  } 
		 break;
   case 'numeros':
        if(document.formagregar.vol.value!='') {
        if (!IsNum(document.formagregar.vol.value))
	     { 
	    	alert("Volumen incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.vol.focus();  
	    	lResultado=false;
	     } }
		 if(document.formagregar.num.value!='') {
           if (!IsNum(document.formagregar.num.value))
	     { 
	    	alert("Número incorrecto. Solamente se aceptan caracteres numéricos"); 
	    	document.formagregar.num.focus();  
	    	lResultado=false;
	     } } 
		 if(document.formagregar.year.value!='') {
			 if (!IsNum(document.formagregar.year.value))
			 { 
				alert("Año incorrecto. Solamente se aceptan caracteres numéricos"); 
				document.formagregar.year.focus();  
				lResultado=false;
			 } 
		 }
		 else
		   {
				alert("Es obligatorio indicar el Año de la publicación"); 
				document.formagregar.year.focus();  
				lResultado=false;
				return;
		   }
		 for (var i=0; i <= (oListaNumeros.length-1); i++)
		 {  
		   if (oListaNumeros[i].nYear==document.formagregar.year.value && oListaNumeros[i].nVolumen==document.formagregar.vol.value&& oListaNumeros[i].nNumero==document.formagregar.num.value && oListaNumeros[i].nIddoc==document.formagregar.fich.value)
			{ 
			  alert("Esta información ya se encuentra en la base de datos"); 
			  document.formagregar.num.focus();  
			  lResultado=false;
			  break;
			}
		  } 
           break;
   case 'documentos': 
           if(document.formagregar.doc1.value=='') 
		     {
			  alert("Es obligatorio llenar el campo Documento"); 
			  document.formagregar.doc1.focus();  
			  lResultado=false;
			  return;
			 }
           for (var i=0; i <= (oListaDocumentos.length-1); i++)
		  {  
		   if (oListaDocumentos[i].sFichero==document.formagregar.doc1.value && oListaDocumentos[i].sResumen==document.formagregar.resumen.value)
			{ 
			  alert("Este documento ya ha sido introducido"); 
			  document.formagregar.doc.focus();  
			  lResultado=false;
			  break;
			}
		  }
           break;
	default: //alert('me fui por el default de Chequea_agregar1');
	       break;
 }

 if(lResultado==true) { document.formagregar.submit(); }
}



function Elimina_Registro(id,tb)
{
var idtrabajo;
var tabla;
var flag=false;
idtrabajo=id;
tabla=tb;        // tabla de donde se elimina el registro
flag= confirm('El registro '+idtrabajo+' será eliminado de forma permanente.¿Desea continuar?'); 

if (flag)
	{
	flag=false;
	window.location='actpseriadas.php?operacion=delete&idtrabajo='+idtrabajo+'&tb='+tabla;
	}
} 

function Muestra_capa(flag,id)
		{
//		id me indica la opcion de la interfaz con la que se está trabajando
//		var layer=document.datos.busc.value;
		var layer=document.buscador.busc.value;
		var muestra;
		var sesion_id=id;
		var privilegio=flag;
		//alert('Estoy en Muestra_capa '+document.buscador.busc.value);
		//alert('sesion_id='+sesion_id);
			 switch (layer) {
			  case 'documento': document.getElementById('documento').style.display='block';
			                    if(sesion_id==20 || sesion_id==24 || sesion_id==25) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20 || sesion_id==24 || sesion_id==25) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
                                if(sesion_id==24 || sesion_id==25) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
                                break;
			  case 'numero':    document.getElementById('resumenb').style.display='none';
			                    document.getElementById('numero').style.display='block';
			                    document.getElementById('documento').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('textob').style.display='none';
                                document.getElementById('publicacion').style.display='none';
                                document.getElementById('pais').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
	   case 'textocompleto':   document.getElementById('resumenb').style.display='none';
			                    document.getElementById('numero').style.display='none';
			                    document.getElementById('documento').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('textob').style.display='block';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'resumen':   document.getElementById('resumenb').style.display='block';
			                    document.getElementById('numero').style.display='none';
			                    document.getElementById('documento').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('textob').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'pagina':    document.getElementById('documento').style.display='none';
			                    if(sesion_id==20 || sesion_id==24 || sesion_id==25 ) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
			                    document.getElementById('pagina').style.display='block';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20 || sesion_id==24 ) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
 								window.location='contenido.php?buscador=1&opcion='+layer+'&pg='+1;
                               break;
			  case 'volumen':   document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='block';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
			                    document.getElementById('estado').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'year':      document.getElementById('documento').style.display='none';
			                    if(sesion_id==20 || sesion_id==24 || sesion_id==25 ) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='block';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
			                    document.getElementById('estado').style.display='none';
                                if(sesion_id==24 || sesion_id==25 ) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'usermod':   document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='block';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			 case 'propietario':document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) {
									document.getElementById('numero').style.display='none';
									document.getElementById('resumenb').style.display='none';
									document.getElementById('textob').style.display='none';            
								}
                                document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
								//alert ('se debe activar la capa propietario ');
			                    document.getElementById('propietario').style.display='block';
			                    document.getElementById('estado').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'estado':    document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) {
								document.getElementById('numero').style.display='none';
								document.getElementById('resumenb').style.display='none';
								document.getElementById('textob').style.display='none';
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='block';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'tipo_doc':  document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) {
								document.getElementById('numero').style.display='none';
								document.getElementById('resumenb').style.display='none';
								document.getElementById('textob').style.display='none';
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('tipo_doc').style.display='block';
                                if(sesion_id==24) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			  case 'normal':    document.getElementById('documento').style.display='none';
			                    if(sesion_id==20) { 
								document.getElementById('numero').style.display='none';
								document.getElementById('resumenb').style.display='none';
								document.getElementById('textob').style.display='none';
								}
			                    document.getElementById('pagina').style.display='none';
			                    if(sesion_id==20) document.getElementById('volumen').style.display='none';
			                    if(sesion_id==20) document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                if(sesion_id==24 || sesion_id==25) document.getElementById('publicacion').style.display='none';
                                if(sesion_id==25) document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								if(privilegio==1) window.location='contenido.php?buscador=0';
			                    if(privilegio==0) window.location='muestra_contenidos.php?buscador=0';
			                    break;
			  case 'publicacion':document.getElementById('resumenb').style.display='none';
			                    document.getElementById('numero').style.display='none';
			                    document.getElementById('publicacion').style.display='block';
			                    document.getElementById('documento').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('textob').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
                                document.getElementById('pais').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
			        case 'pais': //alert('country');
                                document.getElementById('pais').style.display='block';
					            document.getElementById('resumenb').style.display='none';
			                    document.getElementById('numero').style.display='none';
			                    document.getElementById('publicacion').style.display='none';
			                    document.getElementById('documento').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('volumen').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('usermod').style.display='none';
			                    document.getElementById('propietario').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('textob').style.display='none';
			                    if(sesion_id==21) document.getElementById('tipo_doc').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='none';
								break;
		          case 'tipo':  document.getElementById('documento').style.display='none';
								document.getElementById('numero').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='block';
			                    document.getElementById('autorr').style.display='none';
								break;
		          case 'autor': document.getElementById('documento').style.display='none';
								document.getElementById('numero').style.display='none';
			                    document.getElementById('pagina').style.display='none';
			                    document.getElementById('year').style.display='none';
			                    document.getElementById('estado').style.display='none';
			                    document.getElementById('tipo_ocean').style.display='none';
			                    document.getElementById('autorr').style.display='block';
								break;
                        default:
								break;
			
			 }
		 }

function Show_Inf(capa,flag)
		{
		var layer=capa;
		var muestra;
		var privilegio=flag;
		//alert ('llego a Show_inf capa= '+layer+' flag= '+privilegio); 
			 switch (layer) {
			  case 'documento': muestra=document.buscador.fich.value;     // datos sustituyo a doc
			                    //alert (document.datos.fich.value+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&doc='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&doc='+muestra;
								break;
			  case 'publicacion': muestra=document.buscador.pub.value;     // datos sustituyo a doc
			                   //alert (muestra+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&publicacion='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&publicacion='+muestra;
								break;
			  case 'pais': muestra=document.buscador.country.value;     // datos sustituyo a doc
			                   //alert (muestra+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&pais='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&pais='+muestra;
								break;
			  case 'numero':    muestra=document.buscador.number.value;            // muestra=document.num.number.value;
			                    //alert (document.datos.number.value+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?adodb_next_page='+muestra+'&buscador=1&opcion='+layer+'&num='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?adodb_next_page='+muestra+'&buscador=1&opcion='+layer+'&num='+muestra; 
								break;
			  case 'resumenb':    muestra=document.buscador.resumen.value;
			              //alert (document.buscador.resumen.value+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion=resumen'+'&res='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion=resumen'+'&res='+muestra; 
								break;
			  case 'textob': muestra=document.buscador.texto.value;            
			         // alert (document.buscador.texto.value+' voy para contenido');
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion=textocompleto'+'&text='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion=textocompleto'+'&text='+muestra; 
								break;
			  case 'pagina':    muestra=document.buscador.page.selectedIndex+1;      // muestra=document.pag.page.selectedIndex+1;
								if(privilegio==1) window.location='contenido.php?adodb_next_page='+muestra+'&buscador=1&opcion='+layer+'&pg='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?adodb_next_page='+muestra+'&buscador=1&opcion='+layer+'&pg='+muestra;
								break;
			  case 'volumen':   muestra=document.buscador.volume.value;            //muestra=document.vol.volume.value;
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&vol='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&vol='+muestra;
								break;
			  case 'year':      muestra=document.buscador.gadu.value;               //muestra=document.god.gadu.value;
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&year='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&year='+muestra;
								break;
			  case 'usermod':   muestra=document.buscador.user.value;               //muestra=document.mod.user.value;
			 // alert ('usermod= '+document.mod.user.value);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&user='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&user='+muestra;
								break;
			  case 'propietario': muestra=document.buscador.prop.value;          //muestra=document.propiet.prop.value;
			                    //alert ('propietario= '+document.datos.prop.value);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&prop='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&prop='+muestra;
								break;
			  case 'estado':    muestra=document.buscador.est.value;            //muestra=document.estado.est.value;
			 // alert ('estado= '+muestra);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&est='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&est='+muestra;
								break;
			  case 'tipo_doc':  muestra=document.buscador.tipo.value;            //muestra=document.estado.est.value;
			  //alert ('Tipo= '+muestra);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&tipo='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&tipo='+muestra;
								break;
			  case 'tipo_ocean':  muestra=document.buscador.tipoc.value;            //muestra=document.estado.est.value;
			 // alert ('Tipo= '+muestra);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&tipo='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&tipo='+muestra;
								break;
			  case 'aut_ocean': //alert('entro a aut_ocean'); 
			                    muestra=document.buscador.autocean.value;            //muestra=document.estado.est.value;
			  //alert ('Tipo= '+muestra);
								if(privilegio==1) window.location='contenido.php?buscador=1&opcion='+layer+'&autor='+muestra;
								if(privilegio==0) window.location='muestra_contenidos.php?buscador=1&opcion='+layer+'&autor='+muestra;
								break;
			  case 'normal':    if(privilegio==1) window.location='contenido.php?buscador=0';
			                    if(privilegio==0) window.location='muestra_contenidos.php?buscador=0';
			                    break;
			  default:
								break;
			
			 }
		 }


function Rehacer()
{
	LimpiarListado("Frm_Relacionar", "lb_subdefine");
	document.Frm_Relacionar.posicion.value=1;
//	window.location='menu1.php';
    document.Frm_Relacionar.right.disabled=true; 
	document.Frm_Relacionar.agregar.disabled=true;
	document.Frm_Relacionar.rehacer.disabled=true;
}

/*function ActualizaCat()
{
 var oCat;
	for (var nCont=1; nCont <= oListaCateg.length; nCont++)
	{
		oCat = new Option(oListaCateg[nCont - 1].sNombreCat, oListaCateg[nCont - 1].nIdCat, false, false);
		document.Frm_Relacionar.lb_categoria.options[nCont - 1] = oCat;
	}
	document.Frm_Relacionar.lb_categoria.selectedIndex=-1;
}

*/
function Act_subcat()
{
 var oSub; encontrado=0;
	LimpiarListado("Frm_Relacionar", "lb_subdefine");
//	document.Frm_Relacionar.categoria.value=document.Frm_Relacionar.lb_categoria.value;
	document.Frm_Relacionar.posicion.value=1;
	//alert('Act_subcat');
	document.Frm_Relacionar.action="actpseriadas.php";
	Frm_Relacionar.submit();
}
function Act_right()
{
	if (document.Frm_Relacionar.lb_opcinterfaz.selectedIndex != -1)
		document.Frm_Relacionar.right.disabled=false;
}

function Agregar_relacionar()
{
	var valor=document.Frm_Relacionar.lb_opcinterfaz.selectedIndex;
	var nueva=document.Frm_Relacionar.lb_opcinterfaz.value;
	var encontrado=0; 
	var str;
	arreglo=Array();
	for (var i = 0; i < document.Frm_Relacionar.lb_subdefine.length; i++)
	 {     
		if (document.Frm_Relacionar.lb_subdefine.options[i].value == nueva)
			{
			encontrado=1;
			break;
			}
	 }
	 if (encontrado==0)
		{
		var long = document.Frm_Relacionar.lb_subdefine.length;
		var oSub = new Option(document.Frm_Relacionar.lb_opcinterfaz.options[valor].text, document.Frm_Relacionar.lb_opcinterfaz.value, false, false);
		document.Frm_Relacionar.lb_subdefine.options[long] = oSub;
		if (!(document.Frm_Relacionar.lb_subdefine.length==0))
		{
			for (var i = 0; i <= (document.Frm_Relacionar.lb_subdefine.length-1); i++) 
			{
				if (document.Frm_Relacionar.lb_subdefine.options[i].value != null){
				arreglo[i] = document.Frm_Relacionar.lb_subdefine.options[i].value; }
			}
			str = arrayToString(arreglo);
		}
		else (str=0);
		document.Frm_Relacionar.miarreglo.value=str;
	
		}
		//alert(document.Frm_Relacionar.miarreglo.value);
		document.Frm_Relacionar.agregar.disabled=false;
		document.Frm_Relacionar.rehacer.disabled=false;
}

function Act_left()
{
	if (document.Frm_Relacionar.lb_subdefine.selectedIndex != -1)
	{
		document.Frm_Relacionar.left.disabled=false;
	}	
}

function Eliminar()
{  // alert('Entre a Eliminar');
	var valor=document.Frm_Relacionar.lb_subdefine.selectedIndex;
	var quitar=document.Frm_Relacionar.lb_subdefine.value;
	if (document.Frm_Relacionar.miarreglo.value=="")
		document.Frm_Relacionar.miarreglo.value=quitar;
	else
		document.Frm_Relacionar.miarreglo.value=document.Frm_Relacionar.miarreglo.value+","+quitar;	
   // alert (document.Frm_Relacionar.miarreglo.value);
	if (!(document.Frm_Relacionar.lb_subdefine.length==0))
	{
		for (var i = 0; i <= (document.Frm_Relacionar.lb_subdefine.length-1); i++) 
		{
			if (document.Frm_Relacionar.lb_subdefine.options[i].value== quitar)
			{
			document.Frm_Relacionar.lb_subdefine.options[valor] = null;
			}
		}
			  if(document.Frm_Relacionar.lb_subdefine.length==0)
                {
					//alert('se hizo cero');
					document.Frm_Relacionar.left.disabled=true;
					document.Frm_Relacionar.rehacer.disabled=true;
					document.Frm_Relacionar.agregar.disabled=true;
				}
	}
	   // alert ('al final de eliminar'+document.Frm_Relacionar.miarreglo.value);

     if(document.Frm_Relacionar.lb_subdefine.length > 0) {
	 //  document.Frm_Relacionar.operacion.value='borrar';
       document.Frm_Relacionar.agregar.disabled=false;
	   document.Frm_Relacionar.rehacer.disabled=false;   }
}


function Eliminar1()
{   //alert('Entre a Eliminar1');
	var valor=document.Frm_Relacionar.lb_subdefine.selectedIndex;
	var quitar=document.Frm_Relacionar.lb_subdefine.value;
	var str;
	arreglo=Array();
  //alert("tam arreglo: "+arreglo.length);

	if (!(document.Frm_Relacionar.lb_subdefine.length==0))
	{
		for (var i = 0; i <= (document.Frm_Relacionar.lb_subdefine.length-1); i++) 
		{
			if (document.Frm_Relacionar.lb_subdefine.options[i].value== quitar)
			{
			arreglo[i] = document.Frm_Relacionar.lb_subdefine.options[i].value;
			document.Frm_Relacionar.lb_subdefine.options[valor] = null;
			}
		}
		str = arrayToString(arreglo);
	}
	else (str=0);
		document.Frm_Relacionar.miarreglo.value=str;
	document.Frm_Relacionar.operacion.value='borrar';
}


function Confirma()
{
	//alert('en Confirma:'+document.Frm_Relacionar.miarreglo.value);
	//document.Frm_Relacionar.action="actpseriadas.php";
	document.Frm_Relacionar.submit();
}

function LimpiarListado(oFormulario, oLista)
{
 var nCant=eval("document." + oFormulario + "." + oLista + ".length");
	for (var nCont=1; nCont <= nCant; nCont++)
	{
		eval("document." + oFormulario + "." + oLista + ".options[0] = null");
	}
}

function arrayToString(ary)
{
  var s='';
  //alert("tam array: "+ary.length);
  for(var i=0; i<ary.length; i++)
  {
    if(i==0) s+=ary[i];
    else     s+=','+ary[i]; 
  }
  return s;
}

function ValidateForm(Frm_Relacionar)
{
 var lResultado=true;
	//alert(document.Frm_Relacionar.estado.value);
	 if (document.Frm_Relacionar.lb_opcinterfaz.value=="")
		{
		alert("Por favor seleccione la opcion de interdaz de la publicación.");
		document.Frm_Relacionar.lb_opcinterfaz.focus();
		lResultado=false; 
		}
	if (lResultado) 
		{
		var hoy = new Date();
		var cadena= hoy.getFullYear()+'-'+hoy.getMonth()+'-'+hoy.getDay();
		//alert(cadena);
		document.Frm_Relacionar.fecha.value=cadena;
		document.Frm_Relacionar.submit();
		}
}
