include("lib.prototype");$E=function(b){if(window.event&&window.event.inicializado){return window.event.evento}else{if(b&&b.inicializado){return b.evento}}var a=b&&b.evento?b:b&&new Evento(b);if(a){a.evento.evento=a}return a};var Evento=Class.create({evento:null,tecla:null,alt:null,ctrl:null,shift:null,caracter:null,elemento:null,x:null,y:null,initialize:function(b,a){if(window.event){this.evento=window.event;this.tecla=window.event.keyCode}else{this.evento=b;this.tecla=b.which}this.initTeclas();switch(this.tecla){case this.SLASH:this.caracter="/";break;case this.DOT:this.caracter=".";break;case this.DASH:this.caracter="-";break;case this.BACKSLASH:this.caracter="\\";break;default:if(!this.esEspecial()){this.caracter=String.fromCharCode(this.tecla)}else{this.caracter=13}break}this.alt=this.evento.altKey;this.ctrl=this.evento.ctrlKey;this.shift=this.evento.shiftKey;if(this.evento.layerX&&this.evento.layerY){this.x=this.evento.layerX;this.y=this.evento.layerY}else{this.x=this.evento.offsetX;this.y=this.evento.offsetY}if(window.scrollX&&window.scrollY){this.X=this.evento.clientX+window.scrollX;this.Y=this.evento.clientY+window.scrollY}else{this.X=this.evento.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;this.Y=this.evento.clientY+document.documentElement.scrollTop+document.body.scrollTop}if(this.evento.srcElement){this.elemento=this.evento.srcElement}else{if(this.evento.target){this.elemento=this.evento.target}else{Logger.warning("No hay elemento que genere el evento!!!!")}}if(a){Logger.debug(this.toString())}},toString:function(){var a="";a+="Evento\n";a+="evento:"+this.evento+"\n";a+="tecla:"+this.tecla+"\n";a+="caracter:"+this.caracter+"\n";a+="alt:"+this.alt+"\n";a+="ctrl:"+this.ctrl+"\n";a+="shift:"+this.shift+"\n";a+="elemento:"+this.elemento+"\n";a+="x:"+this.x+"\n";a+="y:"+this.y+"\n";a+="X:"+this.X+"\n";a+="Y:"+this.Y+"\n";return a},cancelar:function(a){if(!a||!this.esEspecial()){try{event.keyCode=0}catch(a){}try{event.returnValue=false}catch(a){}Event.stop(this.evento)}},esEspecial:function(){return !this.tecla||(this.tecla==this.TAB)||(this.tecla==this.BACKSPACE)||(this.tecla==this.ENTER)||(this.tecla==this.FIN)||(this.tecla==this.INICIO)||(this.tecla==this.IZQUIERDA)||(this.tecla==this.ARRIBA)||(this.tecla==this.DERECHA)||(this.tecla==this.ABAJO)||(this.tecla==this.ESC)||(this.tecla==this.SUPR)},esIngreso:function(){return !this.esEspecial()||(this.tecla==this.BACKSPACE)||(this.tecla==this.SUPR)},esFuncion:function(){return !Object.isNumber(this.tecla)||(this.F1==this.tecla)||(this.F2==this.tecla)||(this.F3==this.tecla)||(this.F4==this.tecla)||(this.F5==this.tecla)||(this.F6==this.tecla)||(this.F7==this.tecla)||(this.F8==this.tecla)||(this.F9==this.tecla)||(this.F10==this.tecla)||(this.F11==this.tecla)||(this.F12==this.tecla)},getSelLength:function(){if(document.getSelection){return(document.getSelection()+"").length}else{if(this.evento.elemento&&Object.isNumber(this.evento.elemento.selectionStart)){return this.evento.elemento.selectionEnd-this.evento.elemento.selectionStart}else{if(window.getSelection){return(window.getSelection()+"").length}else{if(document.selection){return(document.selection.createRange().text+"").length}else{return -1}}}}},initTeclas:function(){this.TAB=9;this.BACKSPACE=8;this.ENTER=13;this.SHIFT=16;this.CTRL=17;this.ESC=27;this.ESPACIO=32;this.PGUP=33;this.PGDOWN=34;this.FIN=35;this.INICIO=36;this.IZQUIERDA=37;this.ARRIBA=38;this.DERECHA=39;this.ABAJO=40;this.INS=45;this.SUPR=46;this.PUNTO=190;this.DECIMAL=110;this.F1=112;this.F2=113;this.F3=114;this.F4=115;this.F5=116;this.F6=117;this.F7=118;this.F8=119;this.F9=120;this.F10=121;this.F11=122;this.F12=123;this.DOT=190;this.SLASH=191;if(Prototype.Browser.IE){this.DASH=189}else{this.DASH=109}this.BACKSLASH=220}});