// var SEP_AND = new String('|&|'); var SEP_IGUAL = new String('|=|'); var DIR_FIX = new String('../../'); var ID_IDIOMA_ADMIN = 1; var ER_WEB_HTTP = new RegExp('^https?://(www\\.[a-z0-9]{1}[a-z0-9\\.\\-]*[a-z0-9]{1}\\.[a-z]{2,6}(\\.[a-z]{3})?(.*)?|[a-vx-z0-9]{3,}[a-z0-9]{1}[a-z0-9\\.\\-]*[a-z0-9]{1}\\.[a-z]{2,6}(\\.[a-z]{3})?(.*)?|[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(.*)?)$'); var ER_NATURAL_NOCERO = new RegExp("^[1-9]+[0-9]*$"); var ER_NATURAL = new RegExp("^[0-9]+$"); var ER_STR = new RegExp("([^ \t\n\r]([ \t\n\r]|[^ \t\n\r])*[^ \t\n\r])+$|^[^ \t\n\r]$"); var msjFiltroLupa = 'Escriba parte de lo que desea
buscar y luego presione ENTER'; var msjFechaLupa = 'Debe ingresar la fecha \n
en el formato DD/MM/YYYY'; var IVA = '21'; var SEP_DEC = ','; var SEP_MIL = '.'; var DECIMALES = '2'; var MONEDA = '$'; var MSJ_PAGINA = 'Pagina'; var CONF_POPUP_INFORMES = 'width=800px,height=713px,scrollbars=yes,resizable=yes'; var CANT_RETRYS = 1; var MSJ_SIN_CONEXION = "¿Usted esta teniendo problemas con su conexión a Internet desea volver a intentar la acción?"; function $(i){ return document.getElementById(i); } var Navegador = function(){ this.esIE = false;// Internet Explorer this.esIE6 = false; this.esIE7 = false; this.esIE8 = false; this.esFf = false;// Mozilla this.esOp = false;// Opera this.esNs = false;// Netscape if(window.navigator.userAgent.search(RegExp("MSIE","im"))!=-1){ this.esIE = true; if(window.navigator.userAgent.search(RegExp("MSIE 8","im"))!=-1) this.esIE8 = true; else if(window.navigator.userAgent.search(RegExp("MSIE 7","im"))!=-1) this.esIE7 = true; else if(window.navigator.userAgent.search(RegExp("MSIE 6","im"))!=-1) this.esIE6 = true; } else if(window.navigator.userAgent.search(RegExp("Firefox","im"))!=-1) this.esFf = true; else if(window.navigator.userAgent.search(RegExp("Opera","im"))!=-1) this.esOp = true; else if(window.navigator.userAgent.search(RegExp("Safari","im"))!=-1) this.esSa = true; else if(window.navigator.userAgent.search(RegExp("Netscape","im"))!=-1) this.esNs = true; }; var Nav = new Navegador(); Function.prototype.closure = function(obj){ // Init object storage. if (!window.__objs){ window.__objs = []; window.__funs = []; } // For symmetry and clarity. var fun = this; // Make sure the object has an id and is stored in the object store. var objId = obj.__objId; if (!objId) __objs[objId = obj.__objId = __objs.length] = obj; // Make sure the function has an id and is stored in the function store. var funId = fun.__funId; if (!funId) __funs[funId = fun.__funId = __funs.length] = fun; // Init closure storage. if (!obj.__closures) obj.__closures = []; // See if we previously created a closure for this object/function pair. var closure = obj.__closures[funId]; if (closure) return closure; // Clear references to keep them out of the closure scope. obj = null; fun = null; // Create the closure, store in cache and return result. var o = __objs[objId].__closures[funId] = function (){ if(!!__funs[funId] && !!__objs[objId]) return __funs[funId].apply(__objs[objId], arguments); else return false; }; o.__funId = funId; return o; }; var EliminarClosures = function(o){ var i = 0; if(o){ if(o.__objId){ for(i in o.__closures){ delete(window.__funs[i]); delete(o.__closures[i]); } delete(window.__objs[o.__objId]); /*delete(o.__closures); delete(o.__objId);*/ o.__closures = null; o.__objId = null; } } i = null; } var LimpiarClosures = function(){ if(!!Nav && !Nav.esIE) window.addEventListener('unload', LimpiarClosures, false); else window.detachEvent("onunload",LimpiarClosures); if(window.__objs){ for(i in window.__objs) EliminarClosures(window.__objs[i]); } window.__objs = []; window.__funs = []; }; var Limpiar = function(){ if(!!Nav && !Nav.esIE) window.addEventListener('unload', LimpiarClosures, false); else window.attachEvent("onunload", LimpiarClosures); }(); document.LimpiarClosures = LimpiarClosures; function AddEvent(o, e, f){ if(Nav.esIE) o.attachEvent('on'+e, f); else o.addEventListener(e, f, ((Nav.esOp)? false : true)); }; function RemEvent(o, e, f){ if(Nav.esIE) o.detachEvent('on'+e, f); else o.removeEventListener(e, f, ((Nav.esOp)? false : true)); }; function FireEvent(o, e){ var evt = null; if(Nav.esIE) o.fireEvent('on'+e); else{ if(e=='click' || e=='dblclick' || e=='mousedown' || e=='mousemove' || e=='mouseout' || e=='mouseover' || e=='mouseup'){ evt = document.createEvent("MouseEvents"); evt.initMouseEvent(e, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); } else if(e=='keydown' || e == 'keypress' || e == 'keyup'){ evt = document.createEvent("KeyboardEvent"); evt.initKeyEvent(e, true, true, null, false, false, false, false, 9, 0); } else{ evt = document.createEvent("Event"); evt.initEvent(e, true, false); } o.dispatchEvent(evt); } } function StopEvent(e){ if(Nav.esIE){ e.returnValue = false; e.cancelBubble = true; } else{ e.preventDefault(); e.stopPropagation(); } } function ltrim(str){ return str.replace(/^(\s+)/g, ''); } function rtrim(str){ return str.replace(/(\s+)$/g, ''); } function trim(str){ return ltrim(rtrim(str)); } // JavaScript Document Request = function(oListener, metodo){ this.pedido = new crearXHR(); this.reportar = true; this.respuestaXML = null; this.respuestaHTML = null; this.archivo = null; this.valores = null; this.listener = oListener; // this.onError = null; this.onRetry = null; this.retrys = 0; this.curRetry = 0; if(!metodo) this.metodo = 'POST'; else this.metodo = metodo; } Request.prototype.pedir = function(a, v, m, r){ //inicializamos if(!!a) this.archivo = a; if(!!v) this.valores = v; if(!!m) this.metodo = m; if(!r) this.curRetry = 0; // this.respuestaXML = null; this.respuestaHTML = null; // this.cancelar(this.pedido); // this.pedido.onreadystatechange = this.procesar.closure(this); // this.pedido.open(this.metodo, this.archivo, true); // if(this.valores){ this.valores = this.valores.puntualChars(); this.pedido.send(this.valores); } else this.pedido.send(); } Request.prototype.procesar = function(){ var termino = false; if(this.pedido && this.pedido.readyState == 4){ var stat = this.pedido.status; if((stat >= 200 && stat < 300) || stat == 304 || stat == 1223){ if(this.pedido.responseXML) this.respuestaXML = this.pedido.responseXML.documentElement; this.respuestaHTML = this.pedido.responseText; this.cancelar(); if(this.listener && this.listener.onRequestLoad) this.listener.onRequestLoad(); else if(typeof(this.listener)=='function'){ this.listener(); } } else if(this.curRetry < this.retrys){ this.curRetry++; this.pedir(false, false, false, true); if(typeof(this.onRetry) == 'function'){ this.onRetry(); } } else{ if(this.reportar){ ERROR.reportar("Error en clase Request."+ "\nESTADO: "+this.pedido.status+" "+this.pedido.statusText+ "\nARCHIVO: "+this.archivo+ "\nMETODO: "+this.metodo); } if(this.onError && (typeof(this.onError) == 'function' || typeof(this.onError) == 'object')){ this.onError(); } this.cancelar(); } } } Request.prototype.cancelar = function(){ cancelarPedido(this.pedido); } // String.prototype.puntualChars = function(){ var chrs = new Array({'chr':'€', 'ent':'€'}), i, str = this.toString(); for(i = 0; i < chrs.length; i++){ str = str.replace(chrs[i]['chr'], chrs[i]['ent']); } return str; } String.prototype.unPuntualChars = function(){ var chrs = new Array({'chr':'€', 'ent':'€'}), i, str = this.toString(); for(i = 0; i < chrs.length; i++){ str = str.replace(chrs[i]['ent'], chrs[i]['chr']); } return str; } /* FUNCION DE CREACION DE XMLHttpRequest */ crearXHR = function(){ var r = null if (window.XMLHttpRequest) r = new XMLHttpRequest() else if(window.ActiveXObject) { var msp = new Array('Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP') for(var i = 0; i < msp.length; i++){ try { r = new ActiveXObject(msp[i]) } catch (e){} } } return r } /* FUNCION DE DETENCION DE XMLHttpRequest */ cancelarPedido = function(reqXHR){ if(reqXHR!=null){ reqXHR.onreadystatechange=new Function()//una funcion vacia... reqXHR.abort() } } // ReportarError = function(f, m){ this.archivo = (!!f)? f:'xmlHttpRequest/reportarError.php'; this.metodo = (!!m)? m:'POST'; this.req = new Request(); this.req.reportar = false; this.alerta = true; this.reportar = function(msj){ var msg = "Ha ocurrido un error.\nLos administradores del sistema ya han sido notificados del mismo."+ "\nSi el error continua pongase en contacto con los mismos."; alert(msj); this.req.pedir(this.archivo, msj, this.metodo); if(this.alerta){ if(LayError){ LayLoader.showed = Blocker.showed = 1; LayLoader.hide(); Blocker.hide(); LayError.message = msg; LayError.onAcept = function(){ LayError.hide(); Blocker.hide(); }; LayError.onCancel = function(){ LayLoader.hide(); Blocker.hide(); }; Blocker.show(); LayError.show(); } else{ alert(msg); } } return false; }; } ERROR = new ReportarError(); /*//////////// File: Tween.js Creation Date: January 20 2006 Author: Philippe Maegerman Email: mx2004-at-pandora.be Website: http://jsTween.blogspot.com Download: http://cfpim.coffeeflower.com/jsTween/Tween.js *///////////// function Delegate() {} Delegate.create = function (o, f) { var a = new Array() ; var l = arguments.length ; for(var i = 2 ; i < l ; i++) a[i - 2] = arguments[i] ; return function() { var aP = [].concat(arguments, a) ; f.apply(o, aP); } } Tween = function(obj, prop, func, begin, finish, duration, suffixe){ this.init(obj, prop, func, begin, finish, duration, suffixe) } var t = Tween.prototype; t.obj = new Object(); t.prop=''; t.func = function (t, b, c, d) { return c*t/d + b; }; t.begin = 0; t.change = 0; t.prevTime = 0; t.prevPos = 0; t.looping = false; t._duration = 0; t._time = 0; t._pos = 0; t._position = 0; t._startTime = 0; t._finish = 0; t.name = ''; t.suffixe = ''; t._listeners = new Array(); t.setTime = function(t){ this.prevTime = this._time; if (t > this.getDuration()) { if (this.looping) { this.rewind (t - this._duration); this.update(); this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'}); } else { this._time = this._duration; this.update(); this.stop(); this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'}); } } else if (t < 0) { this.rewind(); this.update(); } else { this._time = t; this.update(); } } t.getTime = function(){ return this._time; } t.setDuration = function(d){ this._duration = (d == null || d <= 0) ? 100000 : d; } t.getDuration = function(){ return this._duration; } t.setPosition = function(p){ this.prevPos = this._pos; var a = this.suffixe != '' ? this.suffixe : ''; this.obj[this.prop] = Math.round(p) + a; this._pos = p; this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'}); } t.getPosition = function(t){ if (t == undefined) t = this._time; return this.func(t, this.begin, this.change, this._duration); }; t.setFinish = function(f){ this.change = f - this.begin; }; t.geFinish = function(){ return this.begin + this.change; }; t.init = function(obj, prop, func, begin, finish, duration, suffixe){ if (!arguments.length) return; this._listeners = new Array(); this.addListener(this); if(suffixe) this.suffixe = suffixe; this.obj = obj; this.prop = prop; this.begin = begin; this._pos = begin; this.setDuration(duration); if (func!=null && func!='') { this.func = func; } this.setFinish(finish); } t.start = function(){ this.rewind(); this.startEnterFrame(); this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'}); //alert('in'); } t.rewind = function(t){ this.stop(); this._time = (t == undefined) ? 0 : t; this.fixTime(); this.update(); } t.fforward = function(){ this._time = this._duration; this.fixTime(); this.update(); } t.update = function(){ this.setPosition(this.getPosition(this._time)); } t.startEnterFrame = function(){ this.stopEnterFrame(); this.isPlaying = true; this.onEnterFrame(); } t.onEnterFrame = function(){ if(this.isPlaying) { this.nextFrame(); setTimeout(Delegate.create(this, this.onEnterFrame), 0); } } t.nextFrame = function(){ this.setTime((this.getTimer() - this._startTime) / 1000); } t.stop = function(){ this.stopEnterFrame(); this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'}); } t.stopEnterFrame = function(){ this.isPlaying = false; } t.continueTo = function(finish, duration){ this.begin = this._pos; this.setFinish(finish); if (this._duration != undefined) this.setDuration(duration); this.start(); } t.resume = function(){ this.fixTime(); this.startEnterFrame(); this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'}); } t.yoyo = function (){ this.continueTo(this.begin,this._time); } t.addListener = function(o){ this.removeListener (o); return this._listeners.push(o); } t.removeListener = function(o){ var a = this._listeners; var i = a.length; while (i--) { if (a[i] == o) { a.splice (i, 1); return true; } } return false; } t.broadcastMessage = function(){ var arr = new Array(); for(var i = 0; i < arguments.length; i++){ arr.push(arguments[i]) } var e = arr.shift(); var a = this._listeners; var l = a.length; for (var i=0; i document.body.offsetHeight)? HScreen():document.body.offsetHeight) + 'px'; } // var Messages = function(sType){ this.init(sType); } var p = Messages.prototype; p.oEle = null; p.oAcept = null; p.oCancel = null; p.oClose = null; p.oMessage = null; p.onAcept = null; p.onCancel = null; p.message = null; p.init = function(sType){ var sId = 'lay' + sType; this.oEle = $(sId); if(!this.oEle){ return alert('Messages.init: Error al localizar el objeto.'); } // this.oAcept = $(sId + 'BtnAceptar'); if(!this.oAcept){ return alert('Messages.init: Error al localizar el boton aceptar.'); } AddEvent(this.oAcept, 'click', this.acept.closure(this)); imgRollOver(this.oAcept, this.oAcept.src.replace('ff'+ID_IDIOMA+'.gif', 'n'+ID_IDIOMA+'.gif')); // if(sType == 'Confirm'){ this.oCancel = $(sId + 'BtnCancelar'); if(!this.oCancel){ return alert('Messages.init: Error al localizar el boton cancelar.'); } AddEvent(this.oCancel, 'click', this.cancel.closure(this)); imgRollOver(this.oCancel, this.oCancel.src.replace('ff'+ID_IDIOMA+'.gif', 'n'+ID_IDIOMA+'.gif')); } // this.oClose = $(sId + 'BtnCerrar'); if(!this.oClose){ return alert('Messages.init: Error al localizar el boton cerrar.'); } this.oMessage = $(sId + 'Msj'); if(!this.oMessage){ return alert('Messages.init: Error al localizar el cuadro del mensaje.'); } AddEvent(this.oClose, 'click', this.cancel.closure(this)); // AddEvent(this.oEle, 'keypress', function(e){ if(e.keyCode==27){ this.cancel(); }}.closure(this)); }; p.show = function(){ if(!!this.message){ this.oMessage.innerHTML = this.message; } this.oEle.style.marginTop = (document.documentElement.scrollTop - Math.ceil(this.oEle.offsetHeight / 2)) + 'px'; this.oEle.style.marginLeft = '-' + Math.ceil(this.oEle.offsetWidth / 2) + 'px'; this.oEle.style.visibility = 'visible'; try{ if(!this.oCancel){ this.oAcept.focus(); }else{ this.oCancel.focus(); } }catch(e){ }; } p.hide = function(){ this.oEle.style.visibility = 'hidden'; this.oEle.style.marginTop = '-10000px'; } p.acept = function(){ if(typeof(this.onAcept) == 'function'){ this.onAcept(); } } p.cancel = function(){ this.hide(); if(typeof(this.onCancel) == 'function'){ this.onCancel(); } } var aSolActs = new Object; function cambiarSolapa(id, pos, on, off, event){ if(!!aSolActs[id]){ aSolActs[id]['tit'].className = off; aSolActs[id]['con'].style.display = 'none'; } aSolActs[id] = new Object; aSolActs[id]['tit'] = $('titSolDeCont'+id+'Pos'+pos); aSolActs[id]['tit'].className = on; aSolActs[id]['con'] = $('conSolDeCont'+id+'Pos'+pos); aSolActs[id]['con'].style.display = 'block'; if(event) StopEvent(event); } function getScrollPos(){ if(Nav.esOp) return {y:window.pageYOffset, x:window.pageXOffset}; else return {y:document.documentElement.scrollTop, x:document.documentElement.scrollLeft}; } function getWindowDims(){ if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight}; else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight}; } function getBodyWHAvaible(){ if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight}; else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight}; } function getBodyDims(){ if(Nav.esOp) return {w:document.body.clientWidth, h:document.body.clientHeight}; else return {w:document.body.offsetWidth, h:document.body.offsetHeight}; } function WScreen(){ return (Nav.esIE)? document.documentElement.clientWidth : window.innerWidth; } function HScreen(){ return (Nav.esIE)? document.documentElement.clientHeight : window.innerHeight; } function YPos(){ return (Nav.esIE)? document.documentElement.scrollTop : window.pageYOffset; } function XPos(){ return (Nav.esIE)? document.documentElement.scrollLeft : window.pageXOffset; } function HBody(){ return document.documentElement.scrollHeight; } function WBody(){ return document.documentElement.scrollWidth; } var centrarContenido = function(contenido){ if(contenido && typeof(contenido) == "string")contenido = $(contenido); if(!contenido){ alert("Error en funcion centrarContenido: Contenido inexistente"); return false; } var scrll = getScrollPos(); var dims = getBodyWHAvaible(); contenido.style.top = (Math.round((dims.h - contenido.offsetHeight)/2)+scrll.y)+"px"; contenido.style.left = (Math.round((dims.w - contenido.offsetWidth)/2)+scrll.x)+"px"; } var MostrarContenido = function(contenido,e){ if(contenido && typeof(contenido) == "string")contenido = $(contenido); if(!contenido){ alert("Error en funcion MostrarPopUp: Contenido inexistente"); return false; } centrarContenido(contenido); contenido.style.visibility = "visible"; if(e)StopEvent(e); } var OcultarContenido = function(contenido,e){ if(contenido && typeof(contenido) == "string")contenido = $(contenido); contenido.style.visibility = "hidden"; contenido.style.top = '-'+(contenido.offsetHeight+100)+"px"; if(e)StopEvent(e); } var blockeadorGeneral = null; var mostrarBlockeador = function(mostrar){ if(!blockeadorGeneral){ blockeadorGeneral = $("blockeadorGeneral"); if(Nav.esIE || Nav.esIE7) blockeadorGeneral.style.filter = 'alpha(opacity=45)'; else blockeadorGeneral.style.MozOpacity = ".45"; } if(mostrar){ var alto = HScreen(); if(alto < HBody())alto = HBody(); var scrn = getBodyDims(); blockeadorGeneral.style.display = "block"; blockeadorGeneral.style.height = alto+"px"; blockeadorGeneral.style.width = scrn.w+"px"; } else blockeadorGeneral.style.display = "none"; } var solAntList = null; var cambiarSolapaLista = function(contenedor,clase,titSol,indiceSolapa,e){ $(contenedor).className = clase; if(!solAntList)solAntList = $('solListado'); if(solAntList)solAntList.className = ''; try{ oCookie.set('solOrden', titSol.id); } catch(e){} titSol.className = 'on'; solAntList = titSol; if(e)StopEvent(e); } var solapaListaDefecto = function(){ var id = oCookie.get('solOrden'); sol = $(id); if(sol){ FireEvent(sol,'click'); } } var solapaLista = function(conf){ var oConf = conf; var solAnt = null; if(!oConf.indice)oConf.indice = ''; this.cambiarSolapaLista = function(titSol,clase,e){ $(oConf.contenedor).className = clase; if(!solAnt){ if(this.defecto == 'galeria')solAnt = $('solListado'+oConf.indice); else solAnt = $('solGaleria'+oConf.indice); } if(solAnt)solAnt.className = ''; try{ oCookie.set('solOrden'+oConf.indice, titSol.id); } catch(e){} titSol.className = 'on'; solAnt = titSol; if(e)StopEvent(e); } this.solapaListaDefecto = function(){ var id = oCookie.get('solOrden'+oConf.indice); sol = $(id); if(sol){ FireEvent(sol,'click'); } else{ if(this.defecto == 'galeria')FireEvent($('solGaleria'+oConf.indice),'click'); else FireEvent($('solListado'+oConf.indice),'click'); } } } var mostrarSubMenu = function(id, e){ var desde = hasta = 0, obj = $(id); // if(obj && (e || e == 'init')){ if(parseInt(obj.style.height) == 0 || obj.style.height=='') desde = 0, hasta = obj.scrollHeight; else if(parseInt(obj.style.height) == obj.scrollHeight || obj.style.height=='auto') desde = obj.scrollHeight, hasta = 0; if(desde != hasta){ var tm = new Tween(obj.style, 'height', Tween.strongEaseOut, desde, hasta, 2, 'px'); tm.start(); } } if(e && e != 'init')StopEvent(e); } var verSubTop = function(obj,subMenu,display){ var men = $(subMenu); if(men){ if(!Nav.esIE && display == 'block'){ //obj.style.position = 'absolute'; //men.style.marginTop = obj.offsetHeight+'px'; //obj.style.position = ''; } men.style.display = display; } } function getElementPos(ele){ var p = ele.style.position; ele.style.position = 'relative'; var x = ele.offsetLeft; var y = ele.offsetTop; ele.style.position = p; return {'x':x, 'y':y}; } function setOpacity(opa, ele){ if(!window.innerWidth){ ele.style.filter = 'alpha(opacity='+opa+')'; } else{ ele.style.opacity = (opa / 100); } } function strongEaseInOut(t,b,c,d){ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; } var oToolTip = new Object(); oToolTip.mostrar = function(e,conf){ return false; } oToolTip.ocultar = function(e,conf){ return false; } var setBusqueda = function(url,e){ oCookie.unset('clavePrivada'); oCookie.set('clavePrivada', $('clavePrivada').value); oCookie.unset('paginaBusqueda'); oCookie.set('paginaBusqueda', 1); document.location = url; if(e)StopEvent(e); } var setPagina = function(anex,pagina,e){ oCookie.unset('pagina'+anex); oCookie.set('pagina'+anex, pagina); if(e)StopEvent(e); } var analizarEnterBuscar = function(e){ if(e.keyCode == 13){ FireEvent($('btnBuscar'),'click'); StopEvent(e); } } function writeInElement(elem, tld, name, acc, inner){ elem['href'] = 'mailto:' + acc + '@' + name + '.' + tld; if(inner){ elem['innerHTML'] = acc + '@' + name + '.' + tld; } } function serialize( mixed_value ) { // http://kevin.vanzonneveld.net // + original by: Arpad Ray (mailto:arpad@php.net) // + improved by: Dino // + bugfixed by: Andrej Pavlovic // + bugfixed by: Garagoth // % note: We feel the main purpose of this function should be to ease the transport of data between php & js // % note: Aiming for PHP-compatibility, we have to translate objects to arrays // * example 1: serialize(['Kevin', 'van', 'Zonneveld']); // * returns 1: 'a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}' // * example 2: serialize({firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'}); // * returns 2: 'a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}' var _getType = function( inp ) { var type = typeof inp, match; var key; if (type == 'object' && !inp) { return 'null'; } if (type == "object") { if (!inp.constructor) { return 'object'; } var cons = inp.constructor.toString(); if (match = cons.match(/(\w+)\(/)) { cons = match[1].toLowerCase(); } var types = ["boolean", "number", "string", "array"]; for (key in types) { if (cons == types[key]) { type = types[key]; break; } } } return type; }; var type = _getType(mixed_value); var val, ktype = ''; switch (type) { case "function": val = ""; break; case "undefined": val = "N"; break; case "boolean": val = "b:" + (mixed_value ? "1" : "0"); break; case "number": val = (Math.round(mixed_value) == mixed_value ? "i" : "d") + ":" + mixed_value; break; case "string": val = "s:" + mixed_value.length + ":\"" + mixed_value + "\""; break; case "array": case "object": val = "a"; /* if (type == "object") { var objname = mixed_value.constructor.toString().match(/(\w+)\(\)/); if (objname == undefined) { return; } objname[1] = serialize(objname[1]); val = "O" + objname[1].substring(1, objname[1].length - 1); } */ var count = 0; var vals = ""; var okey; var key; for (key in mixed_value) { ktype = _getType(mixed_value[key]); if (ktype == "function") { continue; } okey = (key.match(/^[0-9]+$/) ? parseInt(key) : key); vals += serialize(okey) + serialize(mixed_value[key]); count++; } val += ":" + count + ":{" + vals + "}"; break; } if (type != "object" && type != "array") val += ";"; return val; } function unserialize(data){ // http://kevin.vanzonneveld.net // + original by: Arpad Ray (mailto:arpad@php.net) // + improved by: Pedro Tainha (http://www.pedrotainha.com) // + bugfixed by: dptr1988 // + revised by: d3x // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // % note: We feel the main purpose of this function should be to ease the transport of data between php & js // % note: Aiming for PHP-compatibility, we have to translate objects to arrays // * example 1: unserialize('a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}'); // * returns 1: ['Kevin', 'van', 'Zonneveld'] // * example 2: unserialize('a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}'); // * returns 2: {firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'} var error = function (type, msg, filename, line){throw new window[type](msg, filename, line);}; var read_until = function (data, offset, stopchr){ var buf = []; var chr = data.slice(offset, offset + 1); var i = 2; while(chr != stopchr){ if((i+offset) > data.length){ error('Error', 'Invalid'); } buf.push(chr); chr = data.slice(offset + (i - 1),offset + i); i += 1; } return [buf.length, buf.join('')]; }; var read_chrs = function (data, offset, length){ buf = []; for(var i = 0;i < length;i++){ var chr = data.slice(offset + (i - 1),offset + i); buf.push(chr); } return [buf.length, buf.join('')]; }; var _unserialize = function (data, offset){ if(!offset) offset = 0; var buf = []; var dtype = (data.slice(offset, offset + 1)).toLowerCase(); var dataoffset = offset + 2; var typeconvert = new Function('x', 'return x'); var chrs = 0; var datalength = 0; switch(dtype){ case "i": typeconvert = new Function('x', 'return parseInt(x)'); var readData = read_until(data, dataoffset, ';'); var chrs = readData[0]; var readdata = readData[1]; dataoffset += chrs + 1; break; case "b": typeconvert = new Function('x', 'return (parseInt(x) == 1)'); var readData = read_until(data, dataoffset, ';'); var chrs = readData[0]; var readdata = readData[1]; dataoffset += chrs + 1; break; case "d": typeconvert = new Function('x', 'return parseFloat(x)'); var readData = read_until(data, dataoffset, ';'); var chrs = readData[0]; var readdata = readData[1]; dataoffset += chrs + 1; break; case "n": readdata = null; break; case "s": var ccount = read_until(data, dataoffset, ':'); var chrs = ccount[0]; var stringlength = ccount[1]; dataoffset += chrs + 2; var readData = read_chrs(data, dataoffset+1, parseInt(stringlength)); var chrs = readData[0]; var readdata = readData[1]; dataoffset += chrs + 2; if(chrs != parseInt(stringlength) && chrs != readdata.length){ error('SyntaxError', 'String length mismatch'); } break; case "a": var readdata = {}; var keyandchrs = read_until(data, dataoffset, ':'); var chrs = keyandchrs[0]; var keys = keyandchrs[1]; dataoffset += chrs + 2; for(var i = 0;i < parseInt(keys);i++){ var kprops = _unserialize(data, dataoffset); var kchrs = kprops[1]; var key = kprops[2]; dataoffset += kchrs; var vprops = _unserialize(data, dataoffset); var vchrs = vprops[1]; var value = vprops[2]; dataoffset += vchrs; readdata[key] = value; } dataoffset += 1; break; default: error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype); break; } return [dtype, dataoffset - offset, typeconvert(readdata)]; }; return _unserialize(data, 0)[2]; } var mostrarMenuHermanas = function(idCategoria,e){ $('menuHermanas'+idCategoria).style.display = 'block'; if(e)StopEvent(e); } var ocultarMenuHermanas = function(idCategoria){ $('menuHermanas'+idCategoria).style.display = 'none'; }// JavaScript Document ToolTip = function(oConfig){ // var z = 1; var css = ''; var msg = ''; var contenedor = null; // if(oConfig && oConfig.zIndex) z = oConfig.zIndex-1; if(oConfig && oConfig.css) css = oConfig.css; if(oConfig && oConfig.mensaje) msg = oConfig.mensaje; if(oConfig && oConfig.contenedor)contenedor = $(oConfig.contenedor); var oT = this; // this.cont = document.createElement('div'); this.cont.style.position = 'absolute'; this.cont.style.display = 'none'; this.cont.style.zIndex = z; this.cont.unselectable = true; if(!contenedor)document.body.insertBefore(this.cont, document.body.firstChild); else contenedor.appendChild(this.cont); // this.iframe = document.createElement('iframe'); this.iframe.style.position = 'absolute'; this.iframe.style.zIndex = z; this.iframe.style.width = 0; this.iframe.border = 0; this.iframe.scrolling = 'no'; this.iframe.frameBorder = 0; this.iframe.disabled = true; this.cont.appendChild(this.iframe); // this.tip = document.createElement('div'); this.tip.style.position = 'relative'; this.tip.style.zIndex = z + 1; this.tip.style.width = 0; if(css) this.tip.className = css; if(msg) this.tip.innerHTML = msg; this.tip.unselectable = true; this.cont.appendChild(this.tip); this.iframe.style.left = 0+"px"; this.tip.style.left = 0+"px"; // this.ocultar = function(){ this.cont.style.display = 'none'; if(this.ele)RemEvent(this.ele,"mousemove",this.controlarUbicacion.closure(this)); } this.mostrar = function(event,msg, css){ // this.mensaje(msg); if(css) this.tip.className = css; // this.cont.style.visibility = "hidden"; this.cont.style.display = 'block'; this.iframe.style.width = 0; this.iframe.style.height = 0; this.tip.style.width = 'auto'; this.tip.style.height = 'auto'; // //this.controlarTamanios(); //this.controlarUbicacion(); if(Nav.esIE){ this.ele = window.event.srcElement; } else{ this.ele = event.target; } RemEvent(this.ele,"mousemove",this.controlarUbicacion.closure(this)); AddEvent(this.ele,"mousemove",this.controlarUbicacion.closure(this)); if(Nav.esIE){ window.event.cancelBubble = true; window.event.returnValue = false; } else event.preventDefault(); this.cont.style.visibility = "visible"; } this.mensaje = function(msg){ if(msg) this.tip.innerHTML = msg; } this.controlarUbicacion = function(event){ if(Nav.esIE){ if(event){ this.cont.style.top = (event.clientY + document.documentElement.scrollTop+ 19) + 'px'; if(event.clientX + this.cont.offsetWidth - 2 + document.documentElement.scrollLeft < document.body.offsetWidth){ this.cont.style.left = (event.clientX - 2 + document.documentElement.scrollLeft) + 'px'; } else{ this.cont.style.left = (event.clientX + document.documentElement.scrollLeft + 10 - this.cont.offsetWidth) + 'px'; } window.event.cancelBubble = true; window.event.returnValue = false; } } else{ if(event){ this.cont.style.top = (event.clientY + window.scrollY+ 19) + 'px'; if(event.clientX + this.cont.offsetWidth - 2 + window.scrollX < document.body.offsetWidth){ this.cont.style.left = (event.clientX - 2 + window.scrollX) + 'px'; } else{ this.cont.style.left = (event.clientX + window.scrollX + 10 - this.cont.offsetWidth) + 'px'; } event.preventDefault(); } } } this.controlarTamanios = function(){ // this.iframe.style.width = (this.tip.offsetWidth + 2) + 'px'; this.iframe.style.height = (this.tip.offsetHeight + 2) + 'px'; this.tip.style.width = (this.tip.offsetWidth - 4) + 'px'; this.tip.style.height = (this.tip.offsetHeight - 4) + 'px'; } //this.cont.attachEvent('onmouseover', this.ocultar.closure(this)); } var URL_ROOT = '/'; var ID_IDIOMA = '1';