/*
*
*
*/
//----------------------
function nuevoAjax(){
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// Ver nota sobre esta linea al final
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
//alert('Falla :( No es posible crear una instancia XMLHTTP');
return false;
}
return http_request;
}
//----------------------
function cargarContenidoPagina(pagina, capa, capa_cargando){
var ajax = nuevoAjax();
ajax.open("GET", pagina, true);
ajax.onreadystatechange = function() {
if (ajax.readyState==1) {
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "block";
//document.getElementById(capa).style.display = "none";
//document.getElementById(capa).innerHTML = '
';
}
if (ajax.readyState==4) {
if (ajax.status==200 || ajax.status==304){
//alert(0)
document.getElementById(capa).style.display = "block";
document.getElementById(capa).innerHTML = ajax.responseText;
//alert(capa_cargando)
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
//alert(2)
}else if(ajax.status==404){
//alert(3)
document.getElementById(capa).innerHTML = "
ERROR 404
Pagina No encontrada
";
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
}else{
document.getElementById(capa).innerHTML = "ERROR "+ajax.status+"
"+ajax.statusText+"
";
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
}
delete ajax;
}
}
ajax.send(null);
}
function cargarValor(pagina, callback, post, capa_cargando) {
var ajax = nuevoAjax();
if(post==null) ajax.open("GET", pagina, true);
else ajax.open("POST", pagina, true);
ajax.onreadystatechange = function() {
if (ajax.readyState==1) {
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "block";
//document.getElementById(capa).style.display = "none";
//document.getElementById(capa).innerHTML = '
';
}
if (ajax.readyState==4) {
if (ajax.status==200 || ajax.status==304){
//alert(0)
callback(ajax.responseText);
//alert(capa_cargando)
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
//alert(2)
}else if(ajax.status==404){
//alert(3)
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
}else{
if(document.getElementById(capa_cargando)) document.getElementById(capa_cargando).style.display = "none";
}
delete ajax;
}
}
ajax.send(post);
}
function abreVentana(direccion, alto, ancho, nombre_ventana){
if(nombre_ventana==undefined) nombre_ventana='ventana';
var ventana123
if(ancho=='') ancho= screen.availWidth - 10;
if(alto=='') alto= screen.availHeight - 50;
//nombre_ventana += (new Date()).getTime();
ventana123=window.open(direccion,nombre_ventana,"top=0,left=0, status=yes, width=" + ancho + ",height=" + alto + ",resizable=yes , scrollbars=yes");
if(ventana123) {
ventana123.moveTo(0,0);
ventana123.focus();
return true;
}
else return false;
}
function arrancar_calendario_wcl_fecha (id) {
Calendar.setup ({
inputField : "fachada_"+id,
ifFormat : "%d/%m/%Y",
button : "boton_calendario_"+id,
range : [1900, 2100]
});
}
function wcl_fecha_cambia(id) {
f = document.getElementById('fachada_'+id).value;
if(f!='') {
if (document.getElementById('hora_'+id) && document.getElementById('minuto_'+id)) {
h = document.getElementById('hora_'+id).value;
m = document.getElementById('minuto_'+id).value;
document.getElementById(''+id+'_numerica').value = ''+f.substr(6,4)+''+f.substr(3,2)+''+f.substr(0,2)+''+h+''+m+'00';
document.getElementById(''+id+'_mysql').value = ''+f.substr(6,4)+'-'+f.substr(3,2)+'-'+f.substr(0,2)+' '+h+':'+m+':00';
document.getElementById(''+id).value = ''+f.substr(0,2)+'/'+f.substr(3,2)+'/'+f.substr(6,4)+' '+h+':'+m+':00';
}
else {
document.getElementById(''+id+'_numerica').value = ''+f.substr(6,4)+''+f.substr(3,2)+''+f.substr(0,2)+'';
document.getElementById(''+id+'_mysql').value = ''+f.substr(6,4)+'-'+f.substr(3,2)+'-'+f.substr(0,2)+'';
document.getElementById(''+id).value = ''+f.substr(0,2)+'/'+f.substr(3,2)+'/'+f.substr(6,4)+'';
}
}
else {
document.getElementById(''+id+'_numerica').value = '';
document.getElementById(''+id+'_mysql').value = '';
document.getElementById(''+id).value = '';
}
}
function wcl_conmutar (id,cambiador,modo_mostrar,modo_mostrar_cambiador) {
if(modo_mostrar==undefined) modo_mostrar = 'block';
if(modo_mostrar_cambiador==undefined) modo_mostrar_cambiador = 'inline';
if(document.getElementById(id)) {
if(document.getElementById(id).style.display != modo_mostrar) {
document.getElementById(id).style.display = modo_mostrar;
if(cambiador!=undefined) {
document.getElementById(cambiador+'_mostrador').style.display = 'none';
document.getElementById(cambiador+'_ocultador').style.display = modo_mostrar_cambiador;
}
}
else {
document.getElementById(id).style.display = 'none';
if(cambiador!=undefined) {
document.getElementById(cambiador+'_ocultador').style.display = 'none';
document.getElementById(cambiador+'_mostrador').style.display = modo_mostrar_cambiador;
}
}
}
}
/**
* FUNCIONS DA PARTE DE ADMINISTRACION
*
* VALIDAS PARA AJAX
*/
function seleccionar_tipo_enlace_nuevo(selector,url) {
document.getElementById('enlaceseccion').value='0';
document.getElementById('enlacecaja').value='0';
if(selector.selectedIndex==1){
document.getElementById('frase').onfocus = crearSuxerenciasFacil(document.getElementById('frase').id, copiar_suxerencia_enlace_seccion, url, 'accion=buscar_enlace&tipo=seccion');
document.getElementById('enlacenormal').readOnly = true;
}
else if(selector.selectedIndex==2){
document.getElementById('frase').onfocus = crearSuxerenciasFacil(document.getElementById('frase').id, copiar_suxerencia_enlace_caja, url, 'accion=buscar_enlace&tipo=caja');
document.getElementById('enlacenormal').readOnly = true;
}
else {
document.getElementById('enlacenormal').readOnly = false;
}
}
function copiar_suxerencia_enlace_seccion (id_seleccion) {
document.getElementById('frase').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('enlacenormal').value = document.getElementById('enlaceSuxerido'+id_seleccion).value;
document.getElementById('enlaceseccion').value = document.getElementById('idSuxerido'+id_seleccion).value;
}
function copiar_suxerencia_enlace_caja (id_seleccion) {
document.getElementById('frase').value = document.getElementById('tituloSuxerido'+id_seleccion).value;
document.getElementById('enlacenormal').value = document.getElementById('enlaceSuxerido'+id_seleccion).value;
document.getElementById('enlacecaja').value = document.getElementById('idSuxerido'+id_seleccion).value;
}
function copiar_suxerencia_enlace_seccion_modificacion (id_seleccion,orixe) {
var n = orixe.id.substr(orixe.id.lastIndexOf('_')+1);
document.getElementById('modificar_enlace_'+n).frase.value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('modificar_enlace_'+n).enlacenormal.value = document.getElementById('enlaceSuxerido'+id_seleccion).value;
document.getElementById('modificar_enlace_'+n).enlaceseccion.value = document.getElementById('idSuxerido'+id_seleccion).value;
}
function copiar_suxerencia_enlace_caja_modificacion (id_seleccion,orixe) {
var n = orixe.id.substr(orixe.id.lastIndexOf('_')+1);
document.getElementById('modificar_enlace_'+n).frase.value = document.getElementById('tituloSuxerido'+id_seleccion).value;
document.getElementById('modificar_enlace_'+n).enlacenormal.value = document.getElementById('enlaceSuxerido'+id_seleccion).value;
document.getElementById('modificar_enlace_'+n).enlacecaja.value = document.getElementById('idSuxerido'+id_seleccion).value;
}
function copiar_suxerencia_contido_enlazado (id_seleccion) {
document.getElementById('nombre_seccion').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('id_seccion').value = document.getElementById('idSuxerido'+id_seleccion).value;
document.getElementById('ruta_seccion_enlazada').innerHTML = ""+document.getElementById('rutaSuxerido'+id_seleccion).value+"";
}
function copiar_suxerencia_nueva_seccion_padre (id_seleccion) {
document.getElementById('nombre_nuevo_padre').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('nuevo_vienede').value = document.getElementById('idSuxerido'+id_seleccion).value;
document.getElementById('ruta_nova_seccion_padre').innerHTML = ""+document.getElementById('rutaSuxerido'+id_seleccion).value+"";
}
function copiar_suxerencia_nueva_seccion_padre_contenido (id_seleccion) {
document.getElementById('nombre_nuevo_padre_contenido').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('nuevo_id_mod_seccion').value = document.getElementById('idSuxerido'+id_seleccion).value;
document.getElementById('ruta_nova_seccion_padre_contenido').innerHTML = ""+document.getElementById('rutaSuxerido'+id_seleccion).value+"";
}
function calcular_nuevo_vencimiento(respuesta) {
if(respuesta==undefined) {
errores = '';
fecha = document.getElementById('vencimiento_numerica').value;
nuevo_tipo = document.getElementById('tipo_de_tiempo_para_el_vencimiento').options[document.getElementById('tipo_de_tiempo_para_el_vencimiento').selectedIndex].value;
nuevo_tiempo = document.getElementById('tiempo_para_el_vencimiento').value;
if(!(nuevo_tiempo > 0)) errores += "\n· O periodo de tempo indicado non debe ser un número";
if(errores == '') {
cargarValor("acciones_ajax.php?&accion=calcular_mas_fecha&fecha="+fecha+"&tipovto="+nuevo_tipo+"&periodovto="+nuevo_tiempo, calcular_nuevo_vencimiento, null,'capa_cargando');
}
else {
alert("Non se puido procesar o cálculo"+errores);
}
}
else {
expresion = /^\d\d\/\d\d\/\d\d\d\d \d\d:\d\d(:\d\d)?$/;
if(expresion.test(respuesta)) {
fecha = (respuesta.split(" "))[0];
hora = ((respuesta.split(" "))[1].split(":"))[0];
minuto = ((respuesta.split(" "))[1].split(":"))[1];
document.getElementById('fachada_vencimiento').value = fecha;
document.getElementById('hora_vencimiento').selectedIndex = hora;
document.getElementById('minuto_vencimiento').selectedIndex = minuto;
wcl_fecha_cambia('vencimiento');
}
else if(confirm("Non se puido calcular a nova data. ¿Ver máis detalles do erro?")) {
alert(respuesta);
}
}
}
function copiar_suxerencia_secciones_a_clonar (id_seleccion) {
document.getElementById('nombre_seccion').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('id_seccion_clonada').value = document.getElementById('idSuxerido'+id_seleccion).value;
document.getElementById('ruta_seccion_enlazada').innerHTML = ""+document.getElementById('rutaSuxerido'+id_seleccion).value+"";
}
function copiar_suxerencia_seccion_donde_clonar (id_seleccion) {
document.getElementById('nombre_seccion').value = document.getElementById('seccionSuxerido'+id_seleccion).value;
document.getElementById('id_seccion_donde_clonar').value = document.getElementById('idSuxerido'+id_seleccion).value;
document.getElementById('ruta_seccion_donde_clonar').innerHTML = ""+document.getElementById('rutaSuxerido'+id_seleccion).value+"";
}
function elementos(patronNombre, elDom) {
salida = new Array();
if(elDom.childNodes) {
for(var i=0;i0) cargarContenidoPagina('acciones_ajax.php?accion=ver_adjuntos_etiquetados'+lista,'capa_lista_adjuntos_etiquetados','capa_cargando');
else alert("Elixa algunha etiqueta");
}
function realizar_adjuntos_seleccionados() {
num_adj = document.getElementById('numero_adjuntos_seleccionables').value;
hay_seleccionados = false
i=0;
while(!hay_seleccionados && i=0) li.style.display="block";
else {
li.style.display="none";
document.getElementById('adj_sel_'+i).checked=false;
}
}
}
function marcar_visibles() {
num_adj = document.getElementById('numero_adjuntos_seleccionables').value;
for(i=0;i=0) li.style.display="block";
else {
li.style.display="none";
document.getElementById('tag_'+i).checked=false;
}
}
}
function marcar_tags_visibles() {
num_tag = document.getElementById('numero_tags').value;
for(i=0;i