// JavaScript Documentvar tipos = new Array();function despliega(id,clase) {	// ocultamos todos los menus de esa clase 	nodos = document.getElementsByTagName("UL");	for (i = 0; i < nodos.length; i++) {		if (nodos[i].className == clase) {			nodos[i].style.display = "none";		}	}	// mostramos la rama indicada por el id 	var menu = document.getElementById(id);	if (menu) {		menu.style.display = "block";	}}function pliega(clase) {	// ocultamos todos los menus de esa clase 	nodos = document.getElementsByTagName("UL");	for (i=0; i<nodos.length; i++) {		if (nodos[i].className==clase){			nodos[i].style.display = "none";		}	}}function MM_openBrWindow(theURL,winName,features) {	if (features) {		window.open(theURL,winName,features);	} else {		window.open(theURL,winName, 'scrollbars=no, width=600, height=450');	}
}function sumarTipos(cod_tipo) {    tipos[cod_tipo]=new Array();}function sumarColetilla(resumen,codigo,tipo,activa) {	var coletilla = new Array(3);	coletilla[0] = resumen;	coletilla[1] = codigo;	coletilla[2] = tipo;	coletilla[3] = activa;	tipos[tipo].push(coletilla);}function addOpt(oCntrl,iPos,coletilla) {	var selOpcion = new Option(coletilla[0], coletilla[1]);	eval(oCntrl.options[iPos] = selOpcion);}function cambia(destino1,destino2,origen){	var tipoSeleccionado=origen.options[origen.selectedIndex].value;	while (destino1.length) destino1.remove(0);	if (destino2 != null) {while (destino2.length) destino2.remove(0)};	var i=0;	var pos1=0;	var pos2=0;	var longitud=tipos[tipoSeleccionado].length;	while(i != longitud) {		if (tipos[tipoSeleccionado][i][3] == 1) {			addOpt(destino1,pos1,tipos[tipoSeleccionado][i]);			pos1++;		}		if ((destino2 != null) && (tipos[tipoSeleccionado][i][3] == 0)) {			addOpt(destino2,pos2,tipos[tipoSeleccionado][i]);			pos2++;		}		i++;	}}function tamanioMax(f, n, t) {	if (f.value != null) {		if (f.value.length > n) {			alert(t);			f.select();		    f.value = f.value.substring(0, n);			return false;		}	}}function submitform(accion) {	if (!algunoChequeado()) {		alert('Debe elegir una consulta para ' + accion);		return;	}	if (accion == 'rechazar') {		if (confirm('¿Seguro que desea rechazar la consulta?')) {			document.myform.ACCION.value=accion;			document.myform.submit();		}	} else {		document.myform.ACCION.value=accion;		document.myform.submit();	}}function submitform2(accion) {	if (accion=='rechazar') {		if (confirm('¿Seguro que desea rechazar la consulta?')) {			document.myform.ACCION.value=accion;			document.myform.submit();		}	} else {		document.myform.ACCION.value=accion;		document.myform.submit();	}}function chequea(input) {	if (document.myform.NIC[0] != null) {		document.myform.NIC[input].checked = true;	} else document.myform.NIC.checked = true;}function algunoChequeado() {	if (document.myform.NIC[0] != null) {		for (i = 0; i < document.myform.NIC.length; i++) {			if (document.myform.NIC[i].checked) return true;		}	} else return document.myform.NIC.checked;}function seleccionatodos() {	for(var i = 0; i < document.forms[0].para.length; i++) {		document.forms[0].para.options[i].selected = document.forms[0].TODAS.checked;	}}function submitFormBiblioteca(form, accion) {	if (accion == 'GUARDAR') {		form.ACCION.value = 'actualizarBiblioteca';		idiomaChequeado = false;		perfilChequeado = false;		for (i = 0; i < form.idiomas.length; i++) {			if (form.idiomas[i].checked) {				idiomaChequeado = true;			}		}				if(form.chat.checked) idiomaChequeado=true;						for (i = 0; i < form.perfil.length; i++) {			if (form.perfil[i].checked) {				perfilChequeado = true;			}		}						if ( (form.nombre.value != '') && (form.correo.value != '') && (form.correo_interno.value != '') && (idiomaChequeado) && (perfilChequeado) ) {			form.submit();		} else {			alert('Debe rellenar todos los campos obligatorios');			return false;		}	} else if (accion == 'ACTIVAR') {		form.ACCION.value = 'actualizarBiblioteca';		form.OPERACION.value = 'activar';		form.submit();	} else if (accion == 'DAR_DE_BAJA') {		form.ACCION.value = 'desactivarBiblioteca';		form.submit();	}}function submitFormBibliotecario(form, operacion) {	if ( (form.nombre.value != '') && (form.login.value != '') ) {		if ( (operacion == 'MODIFICAR') || (form.clave.value != '') ) {			if (form.clave.value == form.clave1.value) {				return true;			} else {				alert('La clave debe coincidir en ambos campos');				return false;			}		} else {			alert('Debe especificar un valor para la Clave');			return false;		}	} else {		alert('Debe especificar un Nombre y una Identificacion para el bibliotecario');		return false;	}}function submitFormClave(form) {	if (form.clave.value != '') {		if (form.clave.value == form.clave1.value) {			return true;		} else {			alert('La clave debe coincidir en ambos campos');			return false;		}	} else {		alert('Debe rellenar todos los campos');		return false;	}}function verEstadisticas(form) {	rdo = true;	if (form.ESTADISTICAS[3].checked == true) { // Analisis estadistico en un periodo		if ( (form.FECHA_DESDE.value == '') || (form.FECHA_HASTA.value == '') || (form.FECHA_RESOL_DESDE.value == '') || (form.FECHA_RESOL_HASTA.value == '')) {			alert('Debe introducir el periodo de solicitud y el de resoluci?n para filtrar el an?lisis estad?stico. Recuerde que un periodo muy amplio puede tardar varios minutos en mostrarse.');			return false;		}	} else if (form.ESTADISTICAS[4].checked == true) { // Analisis estadistico general del sistema	} else { // Resto de estadisticas		if ( (form.FECHA_DESDE.value == '') && (form.FECHA_HASTA.value == '') && (form.FECHA_RESOL_DESDE.value == '') && (form.FECHA_RESOL_HASTA.value == '') ) {			alert('Debe introducir alguna fecha para filtrar las estadisticas. Recuerde que un periodo muy amplio puede tardar varios minutos en mostrarse.');			return false;		}	}	return rdo;}function mantenimientoColetillas(form) {	rdo = true;	if (form.ACCION.value == 'actualizarColetillas') {		if (form.ESTADO.value == '0') {			if (form.COLETILLAS_ACTIVAS.selectedIndex == -1) {				alert('Debe seleccionar alguna respuesta modelo activa para cambiar su estado');				rdo = false;			}		} else if (form.ESTADO.value == '1') {			if (form.COLETILLAS_INACTIVAS.selectedIndex == -1) {				alert('Debe seleccionar alguna respuesta modelo inactiva para cambiar su estado');				rdo = false;			}		}	} else if (form.ACCION.value == 'crearColetilla') {		if (form.ESTADO.value == 'actualizar') {			var activasSeleccionadas = new Array();			var inactivasSeleccionadas = new Array();			count = 0;			for (i=0; i<form.COLETILLAS_ACTIVAS.options.length; i++) {				if (form.COLETILLAS_ACTIVAS.options[i].selected) {					activasSeleccionadas[count] = form.COLETILLAS_ACTIVAS.options[i].value;					count++;				}			}			count = 0;			for (i=0; i<form.COLETILLAS_INACTIVAS.options.length; i++) {				if (form.COLETILLAS_INACTIVAS.options[i].selected) {					inactivasSeleccionadas[count] = form.COLETILLAS_INACTIVAS.options[i].value;					count++;				}			}			if (activasSeleccionadas.length + inactivasSeleccionadas.length != 1) {				alert('Para actualizar una respuesta modelo debe seleccionar una y solo una de las ya existentes');				rdo = false;			}		}	}	return rdo;}function crearColetilla(form) {	rdo = true;	for (i = 0; i < form.elements.length; i++) {		if ( (form.elements[i].type == "text" || form.elements[i].type == "textarea") && form.elements[i].value == '') {			alert('Debe introducir los datos de la respuesta modelo en todos los idiomas');			rdo = false;			break;		}	}	return rdo;}function actualizarSeccion(form) {	rdo = true;	if ( (form.TITULO.value == '') || (form.CONTENIDO.value == '') ) {		alert('Debe introducir el titulo y el contenido de la seccion');		rdo = false;	}	return rdo;}function checkedLista(lista) {	rdo = false;	if (lista != null) {		for (i = 0; i < lista.length; i++) {			if (lista[i].checked) rdo = true;		}	}	return rdo;}
