function $(i){ return document.getElementById(i); } function ltrim(str){ return str.replace(/^(\s+)/g, ''); } function rtrim(str){ return str.replace(/(\s+)$/g, ''); } function trim(str){ return ltrim(rtrim(str)); } 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 opacity(e, n){ var o = (typeof(e)=='object')? e : $(e); if(!!o){ if(Nav.esIE) o.style.filter = 'alpha(opacity='+n+')'; else if(Nav.esFf) o.style.MozOpacity = (n < 100)? '.'+n : 1; else if(Nav.esOp) o.style.opacity = (n < 100)? '.'+n : 1; } o = null; } 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(); } } // 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; // if(!metodo) this.metodo = 'POST'; else this.metodo = metodo; } Request.prototype.pedir = function(a, v, m){ //inicializamos if(!!a) this.archivo = a; if(!!v) this.valores = v; if(!!m) this.metodo = m; // 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){ if(this.pedido.status == 200){ if(this.pedido.responseXML) this.respuestaXML = this.pedido.responseXML.documentElement; this.respuestaHTML = this.pedido.responseText; termino = true; } else if((this.pedido.status >= 12029 && this.pedido.status <= 12031) || // this.pedido.status == 12152 || this.pedido.status == 12159){ //cancelado por el servidor this.pedir(); } else if(this.reportar){ ERROR.reportar(" Error en clase Request.\nESTADO: "+this.pedido.status+" "+this.pedido.statusText+"\nARCHIVO: "+this.archivo+"\nMETODO: "+this.metodo); termino = true; } if(termino == true){ this.cancelar(); if(this.listener && this.listener.onRequestLoad) this.listener.onRequestLoad(); else if(typeof(this.listener)=='function') this.listener(); } } } 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){ this.req.pedir(this.archivo, msj, this.metodo); if(this.alerta) alert("Ha ocurrido un error.\nLos administradores del sistema ya han sido notificados del mismo.\nSi el error continua pongase en contacto con los mismos."+msj); return false; }; } ERROR = new ReportarError(); // JavaScript Document var msjVacio = function(o, m, h){ this.init(o, m, h); } var p = msjVacio.prototype; //PROPs p.oEle = null; p.sMsj = ''; p.bHTML = false; //METs p.init = function(o, m, h){ if(!o) return alert('msjVacio.init: El objeto no existe.'); this.oEle = o; this.sMsj = m; this.oEle.__msjVacio = m; if(h === true) this.bHTML = true; AddEvent(this.oEle, "focus", function(){ this.onfocus(); }.closure(this)); AddEvent(this.oEle, "blur", function(){ this.onblur(); }.closure(this)); }; p.destroy = function(){ EliminarClosures(this); this.oEle = null; }; // p.onfocus = function(){ var t = this.oEle.tagName.toLowerCase(); if((t == 'input' || t == 'textarea') && trim(this.oEle.value) == this.sMsj) this.oEle.value = ''; else if(t != 'input' && t != 'textarea' && trim(this.oEle.innerText) == this.sMsj) this.oEle.innerText = ''; }; p.onblur = function(){ var t = this.oEle.tagName.toLowerCase(); if(t == 'input' || t == 'textarea'){ if(trim(this.oEle.value) == '') this.oEle.value = this.sMsj; else this.oEle.value = trim(this.oEle.value); } else{ if(trim(this.oEle.innerText) == '') this.oEle.innerText = this.sMsj; else if(this.bHTML) this.oEle.innerHTML = trim(this.oEle.innerHTML); else this.oEle.innerText = trim(this.oEle.innerText); } };// JavaScript Document var contenidoEditable = function(o, e){ this.init(o, e); } var p = contenidoEditable.prototype; //PROPs this.oEle = null; this.bEnter = false; //METs p.init = function(o, e){ if(!o) return alert('contenidoEditable.init: El objeto no existe.'); this.oEle = o; this.oEle.contentEditable = "true"; if(e === true) this.bEnter = e; AddEvent(this.oEle, "paste", function(){ this.onpaste(); }.closure(this)); AddEvent(this.oEle, "drop", function(){ this.ondrop(); }.closure(this)); AddEvent(this.oEle, "keydown", function(){ this.onkeydown(); }.closure(this)); }; p.destroy = function(){ EliminarClosures(this); this.oEle = null; }; // p.onpaste = function(){ var text = window.clipboardData.getData('Text'); if(text) document.selection.createRange().text = text.replace(RegExp(/([\n\r])/gi), ''); event.returnValue = false; return false; }; p.ondrop = function(){ var text = event.dataTransfer.getData('Text'); if(text){ event.dataTransfer.setData('URL', text); window.clipboardData.setData('URL', text); } event.returnValue = false;//esto frena el copiado porque no puedo saber donde va a pegar lo que arrastro return false; }; p.onkeydown = function(){ if((event.ctrlKey && (event.keyCode == 78 || event.keyCode == 83 || event.keyCode == 75 || event.keyCode == 77))// || (this.bEnter == true && event.keyCode == 13)){ event.returnValue = false; return false; } };/*//////////// 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; ithis.limiteInferior && (this.tamanio + (direccion)*intervalo) b.offsetHeight){ h = a.offsetHeight; } else{ h = b.offsetHeight; } a.style.height = b.style.height = h + 'px'; } } // JavaScript Document ToolTip = function(oConfig){ // var z = 1; var css = ''; var msg = ''; // if(oConfig && oConfig.zIndex) z = oConfig.zIndex-1; if(oConfig && oConfig.css) css = oConfig.css; if(oConfig && oConfig.mensaje) msg = oConfig.mensaje; 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; document.body.insertBefore(this.cont, document.body.firstChild); // 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 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 alingCols(){ var a = $('divPos4'), b = $('divPos5'), h = 0; if(!!a && !!b){ if(a.offsetHeight > b.offsetHeight){ h = a.offsetHeight; } else{ h = b.offsetHeight; } a.style.height = b.style.height = h + 'px'; } } AddEvent(window, 'load', alingCols);