/** Funciones para el notificador **/ var ntf = new Array(); //lista de notificaciones var minX = 37, maxX = 67; //valores iniciales para la barra de notificacion var x = minX; //valor para mover la barra de notificacion var idTO; //ID para time-outs var notfPend = 0; //numero de notificaciones pendientes (sin procesar) var httpRequest; //objeto para acceso via AJAX al servidor var ingresos=0; //Muestra la barra con el mensaje de numero de notificaciones pendientes. function notificar() { //retrNotif(50); var el = document.getElementById("notificacion"); el.style.visibility = "visible"; el.innerHTML = (ntf.length > 0 ? "" : "") + "Tiene " + notfPend + " notificaciones pendientes" + (ntf.length > 0 ? "" : ""); x = minX; mover(1); } //Mediante AJAX obtiene la lista de notificaciones del día function retrNotif(notifPoll) { if (document.getElementById("notifButton") != null) { new Ajax.Request( "FBSNF"+obtieneSesion(), { method: 'post', parameters: "consNotif=true", onComplete: fillList } ); } if (notifPoll) setTimeout("retrNotif(" + notifPoll + ");", notifPoll); } //Llena la lista de notificaciones para que sean leídas por el usuario function fillList(httpRequest) { while (ntf.length > 0) ntf.pop(); var xmlDoc = httpRequest.responseXML; var notf = false; try { notf = xmlDoc.getElementsByTagName("FITBANK")[0].childNodes; }catch (exc) { } notfPend = 0; if (notf && notf[0].nodeName != "EMPTY") { for (var i = 0; i < notf.length; i++) { try { var nom = notf[i].getElementsByTagName("NOM")[0].firstChild.data; var sub = notf[i].getElementsByTagName("SUB")[0].firstChild.data; var trn = notf[i].getElementsByTagName("TRN")[0].firstChild.data; var pnd = notf[i].getElementsByTagName("PND")[0].firstChild.data; var vrs = notf[i].getElementsByTagName("VER")[0].firstChild.data; var fnt = notf[i].getElementsByTagName("FNT")[0].firstChild.data; ntf[i] = new Array(nom, sub, trn, pnd, fnt, vrs); if (pnd != null && pnd == "true") notfPend++; }catch(Exception){ } } } var notifButton = document.getElementById("notifButton"); if (notfPend > 0) notifButton.style.display = "block"; else notifButton.style.display = "none"; } //Mueve la barra de notificacion con animacion function mover(d) { var el = document.getElementById("notificacion"); if (x <= minX) x = minX; el.style.bottom = x + "px"; if (d == "1") { x += 1; el.style.visibility = "visible"; } else x -= 1; if(x <= maxX && x >= minX) idTO = setTimeout("mover(" + d + ")", 1); if (x >= maxX) { clearTimeout(idTO); idTO = setTimeout("mover(0)", 5000); } if (x <= minX) { clearTimeout(idTO); el.style.visibility = "hidden"; } } //Abre la lista de notificaciones function seleccionar() { var html = ''; var el = document.getElementById('listaNotif'); clearTimeout(idTO); mover(0); el.style.visibility = 'visible'; var hei = (1 + ntf.length) * 22; if (hei > 350) hei = 350; el.style.height = hei + 'px'; html += '
Fecha y hora | '; html += 'Mensaje | '; html += 'Sub | Tran |
' : '>') + fecha + ' ' + hora + ' | '; html += '' : '>'); html += ''; if (ntf[a][0].length > 50) html += ntf[a][0].substring(0, 50) + '...'; else html += ntf[a][0]; html += ' | ' : '>') + ntf[a][1] + ' | ' : '>') + ntf[a][2] + ' |