include("lib.prototype");if(!modularjs.loaded["lib.onload"]){__onload__=false;addOnLoad=function(a){if(__onload__){a()}else{document.observe("dom:loaded",a)}};addOnLoad(function(){__onload__=true})}modularjs.loaded["lib.onload"]=true;if(!modularjs.loaded["fitbank.evento"]){$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}})}modularjs.loaded["fitbank.evento"]=true;if(!modularjs.loaded["fitbank.util"]){if(!modularjs.loaded["lib.split"]){ /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ ;var split;split=split||function(b){var e=String.prototype.split,d=/()??/.exec("")[1]===b,a;a=function(n,k,j){if(Object.prototype.toString.call(k)!=="[object RegExp]"){return e.call(n,k,j)}var h=[],i=(k.ignoreCase?"i":"")+(k.multiline?"m":"")+(k.extended?"x":"")+(k.sticky?"y":""),f=0,k=new RegExp(k.source,i+"g"),g,l,m,o;n+="";if(!d){g=new RegExp("^"+k.source+"$(?!\\s)",i)}j=j===b?-1>>>0:j>>>0;while(l=k.exec(n)){m=l.index+l[0].length;if(m>f){h.push(n.slice(f,l.index));if(!d&&l.length>1){l[0].replace(g,function(){for(var p=1;p1&&l.index=j){break}}if(k.lastIndex===l.index){k.lastIndex++}}if(f===n.length){if(o||!k.test("")){h.push("")}}else{h.push(n.slice(f))}return h.length>j?h.slice(0,j):h};String.prototype.split=function(g,f){return a(this,g,f)};return a}()}modularjs.loaded["lib.split"]=true;var Util={selectors:["input:not([readonly='']), select:not([readonly='']), textarea:not([readonly=''])","[type!='hidden']",".record, [class*='control']"],getCaret:function(a){var b="";return b},applySelectors:function(){var a=new Element("input");var b=true;this.selectors.each(function(d){if(b){a=c.form;b=false}var e=Prototype.Selector.select(d,a);a=new Element("input");e.each(function(f){if(f.type==="select-one"){var g=new Element("input",{id:f.id,"class":f.className});g.value=f.options[f.selectedIndex].value;a.appendChild(g)}else{if(f.type==="checkbox"){var g=new Element("input",{id:f.id,"class":f.className});g.value=f.value;a.appendChild(g)}else{a.appendChild(f.clone(true))}}})});return a.childElements()},getOriginalElements:function(){var b={};var a=Util.applySelectors();a.each(function(d){b[d.id]=d.value});return b},checkForChanges:function(a){if(!a||!c.form||!c.formulario){return false}var e=false;var d={};var b=Util.applySelectors();b.each(function(f){if(f.type!=="select-one"){d[f.id]=f.value}else{d[f.id]=f.options[f.selectedIndex].text}});$H(a).each(function(g){if(d[g.key]){var f=g.value!==d[g.key];e=e||f}});return e},getStyleClass:function(b){for(var a=0;a/g,">")},firstUpperOtherLower:function(a){return a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()},getContentWindow:function(a){a=$(a);return a.contentWindow||a},getMensaje:function(d,b){var a=b+"_MOBILE";if(window.Mobile&&d[a]){return d[a]}else{return d[b]}},initHtmlElement:function(b,d){var a=$(b);var e=$(b+"_oculto");if(d&&d=="1"){e.widget=e;e.oculto=e}else{e.widget=a;e.oculto=e}a.oculto=e;a.widget=a;e.hide=Element.hideCurry(a);e.show=Element.showCurry(a)},initHiddenInput:function(a,b){a=$(a);if(!a){return}a.sync=function(f,d){a.changeValue(f.value,d&&d.options||d)};a.setValueOculto=function(d){d.changeValue(a.value)};Util._initHiddenInput(a,b)},initCheckBox:function(a){a=$(a);a.valueOn=a.getAttribute("value-on");a.valueOff=a.getAttribute("value-off");a.hide=Element.hideCurry(a.next("label"));a.show=Element.showCurry(a.next("label"));a.sync=function(b){a.setChecked(b.target.value==a.valueOn,b&&b.options||b)};a.fixValue=function(){var b=a.checked?a.valueOn:a.valueOff;a.value=b;return b};a.setValueOculto=function(b){b.value=a.fixValue()};Util._initHiddenInput(a,"checkbox")},initComboBox:function(a){a=$(a);a.on("keyup",function(b){a.fireDOMEvent("change",{generated:false})});a.sync=function(d){for(var b=0;b0)){return}if(!b){var d=function(p){var o=parseInt(p.getStyle("width"));p.setStyle("width:"+o+"px")};m&&m.select("th, td").each(d);var g=(((i&&i.getHeight()||0)+4)+(n*((j&&j.getHeight()||0)+h)));a&&a.setStyle({display:"block",overflowY:"auto",overflowX:"auto",height:g+"px"});i&&i.setStyle({display:"block"});f&&f.setStyle({display:"block"});k&&k.setStyle({display:"block"})}else{if(b){}else{var l=n*j.getHeight()+(i?i.getHeight():0)+(k?k.getHeight():0);e.setStyle({overflowY:"auto",overflowX:"hidden",paddingRight:"20px",height:l+"px"})}}},initDeleteRecord:function(a){c.$N(a).each(function(b){if(b.widget){b=b.widget}b.setDisabled(true);b.on("change",function(f){var d=b.up("td").up("tr");if(b.checked){d.addClassName("delete-record")}else{d.removeClassName("delete-record")}c.formulario.evalFormulas(b);c.calcular()})})},generarIdUnicoTemporal:function(){var a="_id_";a+=Math.round(Math.random()*999);a+="_";a+=Math.round(Math.random()*999);a+="_";a+=Math.round(Math.random()*999);return a},generarIdUnicoPermanente:function(){return"ID_"+Util.generarIdUnicoTemporal()},eliminarReferenciasCirculares:function(e){var a={};function b(g){var f=typeof g;return !g||f=="string"||f=="number"||f=="boolean"}function d(l){var h;if(!b(l)){a[l]=true}if(l instanceof Array){h=[];for(var g=0;ge){d.scrollTop=a+b.getHeight()-d.getHeight()-g}}}},ensureInside:function(b,e){b=$(b);e=($(e)||document.viewport);var h=b.getDimensions();var a=e.getDimensions();var g=b.viewportOffset();var f=a.height-g.top-h.height;if(f<0){b.style.top=(parseInt("0"+b.style.top,10)+f)+"px"}g=b.viewportOffset();f=g.top;if(f<0){b.style.top=(parseInt("0"+b.style.top,10)-f)+"px"}g=b.viewportOffset();f=a.width-g.left-h.width;if(f<0){b.style.left=(parseInt("0"+b.style.left,10)+f)+"px"}g=b.viewportOffset();f=g.left;if(f<0){b.style.left=(parseInt("0"+b.style.left,10)-f)+"px"}},center:function(a,b){b=b||a.getOffsetParent();var e=(b.getHeight()-a.getHeight())/2;var d=(b.getWidth()-a.getWidth())/2;if(e<0){e=0}if(d<0){d=0}a.absolutize();a.setStyle({top:e+"px",left:d+"px"})},relativize2:function(e){e=$(e);var f=e.positionedOffset();e.relativize();var d=e.positionedOffset();var b=f[0]-d[0];var a=f[1]-d[1];e.moveMargin(b,a);e.nextSiblings().each(function(g){if(e.visible()){g.moveMargin(b,a)}})},moveMargin:function(d,b,a){if(b!=0){d.style.marginLeft=(parseInt(d.style.marginLeft)+b)+"px"}if(a!=0){d.style.marginTop=(parseInt(d.style.marginTop)+a)+"px"}},fireDOMEvent:function(d,e,b){d=$(d);b=Object.extend({generated:true},b);if(document.createEventObject){var a=document.createEventObject();a.options=b;return d.fireEvent("on"+e,a)}else{var a=document.createEvent("HTMLEvents");a.initEvent(e,true,true);a.options=b;return !d.dispatchEvent(a)}},getOriginalDimensions:function(d){d=$(d);var b;var f;if(d.tagName=="IMG"){b=d.width;f=d.height}else{b=d.getWidth();f=d.getHeight()}d.removeAttribute("width");d.removeAttribute("height");var e=d.getHeight();var a=d.getWidth();if(d.tagName=="IMG"){d.width=b;d.height=f}else{d.setStyle({width:b+"px",height:f+"px"})}return{width:a,height:e}},hide:function(b){b=$(b);b.style.display="none";var a=b.next();if(a&&a.hasClassName("asistente-icono")){a.style.display="none"}return b},show:function(b){b=$(b);b.style.display="";var a=b.next();if(a&&a.hasClassName("asistente-icono")){a.style.display=""}return b},hideCurry:function(a){return function(){a.hide()}},showCurry:function(a){return function(){a.show()}},syncCurry:function(a){return function(b){a.sync(b)}},setValueOcultoCurry:function(a,b){return function(){a.setValueOculto(b)}}});Element.addMethods({changeValue:function(d,e,b){if(d.nodeName=="SPAN"||d.nodeName=="LABEL"){var a=d.innerHTML;if(e!=a){d.update(e);return true}else{return false}}var a=d.value;d._formatValue(e,b);if(a!=d.value){d.fireDOMEvent("change",b);return true}else{return false}},_processValue:function(e,d){e=$(e);var b=e.value;var a=false;if(e.value!=""){Validar.ok(e,"required")}else{Validar.ok(e,"empty")}e._formatValue(e.value,d);if(b!=e.value){if(!d.partial){e.fireDOMEvent("change",d)}a=true}c.formulario.evalFormulas(e);return a},_formatValue:function(b,f,a){var h=f;var d=null;a=a||{};try{(b.formatters||$A()).each(function(e){d=e.constructor.simpleClassName;h=e.transform(h,a.partial);Validar.ok(b,d)})}catch(g){Validar.error(b,g,d);return b.value}h=typeof h!="undefined"&&h!=null&&h.toString()||"";if(b.value!=h){var i=b.value.length-b.getCaretPosition();b.value="";b.value=h;b.setCaretPosition(b.value.length-i,false)}(b.formatters||$A()).each(function(e){e.changeValues(b,a.partial)})},getObjectValue:function(a){a=$(a);return typeof a.objectValue!="undefined"?a.objectValue:a.value},getWidget:function(a){a=$(a);return typeof a.widget!="undefined"?a.widget:a},getCaretPosition:function(a){a=$(a);if(!a.focused){return -1}try{if(a.type==="date"||a.type==="number"){return a.value.length}if(typeof document.selection!="undefined"){var b=document.selection.createRange();b.moveStart("character",-a.value.length);return b.text.length}else{if(typeof a.selectionStart!="undefined"){return a.selectionStart}}}catch(d){console.log("No se puede obtener la posicion en el texto: "+d)}return a.value.length},setCaretPosition:function(d,e,a){d=$(d);if(!d.focused&&!a){return}else{d.focus()}if(d.type==="date"||d.type==="number"){return}if(typeof d.createTextRange!="undefined"){var b=d.createTextRange();b.collapse(true);b.moveEnd("character",e);b.moveStart("character",e);b.select()}else{if(typeof d.setSelectionRange!="undefined"){d.setSelectionRange(e,e)}}},setChecked:function(a,d,b){if(!Object.isElement(a)){a=c.$(a)}if(a.widget){a=a.widget}a.checked=d;a.fireDOMEvent("change",b)},setDisabled:function(a,b){if(!Object.isElement(a)){a=c.$(a)}if(a.widget){a=a.widget}if(a.type!="checkbox"&&a.type!="radio"&&a.type!="image"&&a.type!="select-one"&&a.type!="button"){a.readOnly=b}else{a.disabled=b}if(a.hasDatePicker){datePickerController[b?"disable":"enable"](a.id)}a.tabIndex=b?-1:a.originalTabIndex},getScrollFromBottom:function(a){return a.scrollHeight-a.clientHeight-a.scrollTop}});String.prototype.hashCode=function(){var b=0;for(var a=0;a0){Ajax.activeRequestCount--}}});document.disableContextMenu=function(){if(this.captureEvents){this.captureEvents(Event.MOUSEDOWN);this.onmousedown=function(a){if(a.which==2||a.which==3){return false}}}this.oncontextmenu=function(){return false}}}modularjs.loaded["fitbank.util"]=true;var Ventana=Class.create({titulo:null,divTitulo:null,elementoPadre:null,elemento:null,x:null,y:null,w:null,h:null,centrada:true,contenido:null,verFondo:true,bloqueoModal:false,destruirAlCerrar:true,selectable:true,movable:true,table:null,barra:null,onVer:function(){if(!this.selectable){this.divContenido.onmousedown=function(){return false}}},onCerrar:function(){},initialize:function(a){this.verFondo=Parametros["fitbank.ui.ventana.fondo.ENABLED"]=="true";this.movable=Parametros["fitbank.ui.ventana.MAKE_MOVABLE"]=="true";this.bloqueoModal=Parametros["fitbank.ui.ventana.BLOQUEOMODAL"]=="true";Object.extend(this,a);if(!this.elementoPadre){this.elementoPadre=document.body}else{this.elementoPadre=$(this.elementoPadre)}if(this.elemento){this.elemento=$(this.elemento);this.centrada=false}if(Mobile){this.centrada=false;this.x=0;this.y=0;this.w="100%";this.h="100%";this.verFondo=false;this.movable=false}this.crear();this.insertar()},crear:function(){this.div=new Element("div",{className:"ventana"}).hide();var a=function(e){return e+(Object.isNumber(e)?"px":"")};if(this.x){this.div.style.left=a(this.x)}if(this.y){this.div.style.top=a(this.y)}var b=new Element("div",{className:"titulo holo-action-bar"});this.div.insert(b);var d=new Element("a",{href:"#","class":"holo-up"}).update(new Element("img",{src:"img/cerrar.png"}));if(Mobile){b.insert(new Element("h1").update(d).insert(this.titulo))}else{b.insert(d);b.insert(new Element("span").update(this.titulo||"FitBank"))}d.on("click",this.cerrar.bind(this));if(this.movable){Util.makeMovable(this.div,b)}if(!Mobile){b.on("dblclick",function(f){this.divContenido.toggle()}.bind(this))}this.divTitulo=b;this.divContenido=new Element("div",{className:"contenido"});this.div.insert(this.divContenido);this.divContenido.style.width=a(this.w);this.divContenido.style.height=a(this.h);if(this.contenido){this.setContenido(this.contenido)}},setContenido:function(a){if(typeof a=="string"){a=new Element("span").update(a)}this.contenido=a;this.divContenido.update(this.contenido)},insertar:function(){if(this.elemento){Element.insert(this.elemento,{after:this.div})}else{Element.insert(this.elementoPadre,this.div)}},_getSecureModalStyle:function(){return Object.toJSON(new copyConstructor(getComputedStyle(Ventana.fondo)))},ver:function(){this.insertar();if(this.verFondo){Ventana.fondo.show();c&&c.form&&c.form.setStyle("pointer-events: none");var a=this._getSecureModalStyle();if(this.bloqueoModal){this.verFondoInterval=setInterval(function(){if(!Ventana.fondo.visible()||!Ventana.fondo.parentElement||a!=this._getSecureModalStyle()){clearInterval(this.verFondoInterval);alert("Acción no permitida");Entorno.caducar(null)}}.bind(this),1000)}Ventana.abiertas++}this.div.show();Element.addClassName.defer(this.div,"visible");var b=document.viewport.getHeight()-(Mobile?0:10);if(this.div.getHeight()>b){this.div.setStyle({height:b+"px"});this.divContenido.setStyle({height:(b-this.divTitulo.getHeight()-20)+"px"})}if(this.centrada){this.div.style.position="absolute";if(this.contenido.getWidth()&&!this.w){this.div.setStyle({width:(this.contenido.getWidth()+20)+"px"})}this.div.center()}this.visible=true;this.onVer()},esconder:function(){if(this.visible){if(this.verFondo){Ventana.abiertas--;if(!Ventana.abiertas){Ventana.fondo.hide();c&&c.form&&c.form.setStyle("pointer-events: initial");this.bloqueoModal&&this.verFondoInterval&&clearInterval(this.verFondoInterval)}}(function(){this.div.hide();this.visible=false}).bind(this).delay(0.2);this.div.removeClassName("visible")}},cerrar:function(){if(this.onCerrar()!==false){this.esconder();if(this.destruirAlCerrar){this.destruir.bind(this).delay(0.2)}}},destruir:function(){this.div.remove()}});addOnLoad(function(){Ventana.fondo=new Element("div",{className:"ventana-fondo"});document.body.appendChild(Ventana.fondo);Ventana.fondo.setOpacity(0.8);Ventana.fondo.hide();Ventana.abiertas=0});