Object.extend(Event,{wheel:function(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera){b=-b}}else{if(a.detail){b=-a.detail/3}}return Math.round(b)},teclaPulsada:function(b){b=(b)?b:event;var a=(b.charCode)?b.charCode:((b.keyCode)?b.keyCode:((b.which)?b.which:0));return a}});Object.extend(String.prototype,{ltrim:function(a){if(!a){a="\\s"}return this.replace(new RegExp("^["+a+"]+"),"")},rtrim:function(a){if(!a){a="\\s"}return this.replace(new RegExp("["+a+"]+$"),"")},trim:function(a){return this.ltrim(a).rtrim(a)},ucfirst:function(){return this.charAt(0).toUpperCase()+this.substring(1)}});Element.addMethods({setWidth:function(b,a,c){b=$(b);b.style.width=(!isNaN(a))?a+"px":a;if(c){b.fire("element:resize",{width:a})}return b},setHeight:function(a,b,c){a=$(a);a.style.height=(!isNaN(b))?b+"px":b;if(c){a.fire("element:resize",{height:b})}return a},setSize:function(b,a,c){b=$(b);return b.setWidth(a).setHeight(c)},setTop:function(b,a){b=$(b);b.style.top=a+"px";return b},setLeft:function(b,a){b=$(b);b.style.left=a+"px";return b},setOffset:function(a,b){a=$(a);a.style.top=b.top+"px";a.style.left=b.left+"px";return a},rollOver:function(a,b){a=$(a);if(b==undefined){b="Over"}if(!a.className.endsWith(b)){a.className+=b}return a},rollOut:function(a,b){a=$(a);if(b===undefined){b="Over"}if(a.className.endsWith(b)){a.className=a.className.slice(0,a.className.length-b.length)}return a},focoOn:function(a){return Element.rollOver(a,"Foco")},focoOff:function(a){return Element.rollOut(a,"Foco")},removeAllChild:function(a){var b=$(a);if(!b){return null}var c=[];while(b.childNodes.length){c[c.length]=b.removeChild(b.childNodes[0])}return c},clic:function(a){var c=$(a);if(c.dispatchEvent){var b=c.ownerDocument.createEvent("MouseEvents");b.initMouseEvent("click",true,true,c.ownerDocument.defaultView,1,0,0,0,0,false,false,false,false,0,null);c.dispatchEvent(b)}else{if(c.fireEvent){c.fireEvent("onclick")}}},addClassName:function(a,b){if(!(a=$(a))){return}if(!a.hasClassName(b)){a.className=b+(a.className?" ":"")+a.className}return a},setLastClassName:function(a,b){if(!(a=$(a))){return}if(!a.hasClassName(b)){var c=$w(a.className);if(c.length>0){c[c.length-1]=b}else{c.push(b)}a.className=c.join(" ")}return a}});Object.extend(Object,{implode:function(d,c){if(typeof(c)=="undefined"){c=", "}var b="";var a="";for(prop in d){b+=a+prop+"="+d[prop];a=c}return b}});Object.extend(Array.prototype,{crearRoll:function(){for(var b=0,a=this.length;b<a;b++){var c=this[b];c.observe("mouseover",function(){Element.rollOver(this,"Over")});c.observe("mouseout",function(){Element.rollOut(this,"Over")})}}});Form.serializeElements=function(g,b){if(typeof b!="object"){b={hash:!!b}}else{if(b.hash===undefined){b.hash=true}}var c,f,a=false,e=b.submit;var d=g.inject({},function(h,k){if(!k.disabled&&k.name){c=k.name;f=$(k).getValue();if((k.type!="submit"||(!a&&e!==false&&(!e||c==e)&&(a=true)))){var l=c.search(/\[/);if(l==-1){if(c in h){if(k.type!="radio"){if(k.type=="checkbox"&&!f){return h}if(!Object.isArray(h[c])){h[c]=[h[c]]}h[c].push(f)}else{if(f){h[c]=f}}}else{h[c]=f}}else{var j=h;var m=c.substr(0,l);c.scan(/\[(.*?)\]/,function(o){var n=o[1].strip();if(Object.isUndefined(j[m])){j[m]=(n.length==0)?[]:{}}if(n.length==0){n=j[m].length}j=j[m];m=n});if(k.type!="checkbox"||f){j[m]=f}}}}return h});return b.hash?d:Object.toQueryString(d)};Object.extend(Form.Element.Serializers,{selectMany:function(e){var a=[],f=e.length;if(!f){return null}var b=e.getAttribute("todos");if(b===undefined||!b){for(var d=0;d<f;d++){var c=e.options[d];if(c.selected){a.push(this.optionValue(c))}}}else{for(var d=0;d<f;d++){a.push(this.optionValue(e.options[d]))}}return a}});Object.extend(Form.Methods,{getElement:function(b,a){return $(b[a])},limpiar:function(a){a.getElements().each(function(b){if((b.tagName=="INPUT"&&b.type&&b.type!="submit"&&b.type!="reset"&&b.type!="button")||b.tagName=="TEXTAREA"){b.value=""}})},request:function(c,b){c=$(c);b=Object.clone(b||{});var d=b.parameters,a=(b.action)?b.action:(c.readAttribute("action")||"");if(a.blank()){a=("enviar-"+c.readAttribute("id").dasherize()).camelize()}b.parameters=c.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(b.parameters,d)}if(typeof(b.prototype)=="undefined"&&Placom.estaCargadoJs("placom/PAjax")){return pajax.invocarMetodo(null,a,[b.parameters],b)}else{if(c.hasAttribute("method")&&!b.method){b.method=c.method}return new Ajax.Request(a,b)}},enviar:function(f,b){f=$(f);b=Object.clone(b||{});var a=((b.action)?b.action:(f.readAttribute("action")||".")).rtrim()+"/";var e=(typeof(b.target)=="string")?b.target:(f.readAttribute("target")||null);var g=f.serialize(true);for(var d in g){var c=g[d];if(c){a+=encodeURIComponent(d)+"/"+encodeURIComponent(g[d])+"/"}}Placom.irA(a,e)},serialize:function(b,a){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}if(typeof(Placom_Editor_EditArea)!="undefined"){Placom_Editor_EditArea.substituirElementosForm(b)}return Form.serializeElements(Form.getElements(b),a)}});Element.addMethods();GeneradorEventos=Class.create(Enumerable,{initialize:function(){this.detectores=[]},_each:function(a){this.detectores._each(a)},agregarDetector:function(a){if(!this.include(a)){this.detectores.push(a)}return this},agregarDetectorEvento:function(b,a){var c={};c[b]=a;this.agregarDetector(c);return this},eliminarDetector:function(a){this.detectores=this.detectores.without(a);return this},dispararEvento:function(b,a){if(typeof(a)=="undefined"){a=[]}this.each(function(d){if(Object.isFunction(d[b])){try{d[b].apply(d,a)}catch(c){}}});return this}});var Icono={iconizar:function(){var a=$$(".pcIcono");for(var c=0,b=a.length;c<b;c++){$I(a[c]).iconizar()}}};Icono.Methods={iconoOver:function(a){elemento=this;var h=this.iconoImg();if(h!==undefined){if(h.__ouSrc){h.src=h.__ouSrc}else{var k=(typeof(h.src__orig)=="undefined")?h.src:h.src__orig;var d=k.length;var f=k.lastIndexOf(".");var g=k.substr(f);h.__ovSrc=k;var j=k.substr(0,f);var b="Over";if(this.rel){var e=this.rel.split(",");for(var c=0;c<e.length;c++){if(e[c].strip().endsWith(b)){b=e[c];break}}}j+=((!j.endsWith(b))?b+g:g);h.src=j;h.__ouSrc=j}}if(elemento.id&&Placom.estaCargadoJs("placom/Prototip")){Prototips.crearEnElemento(this,a);Event.stop(a)}return elemento},iconoOut:function(b){if(!this.seleccionado){elemento=this;var a=this.iconoImg();if(a!==undefined&&a.__ovSrc){a.src=a.__ovSrc}}return elemento},iconoLimpiar:function(){var a=this.iconoImg();a.__ouSrc=false;a.__ovSrc=false;return this},iconoImg:function(){return this.down("img:not([class~=pcImgFija])")},iconizar:function(){if(this.__iconizado){return this}this.__iconizado=true;this.seleccionado=false;this.observe("mouseover",this.iconoOver.bindAsEventListener(this));this.observe("mouseout",this.iconoOut.bindAsEventListener(this));if(this.hasClassName("pcIconoRollable")){this.observe("mouseover",function(){Element.rollOver(this,"Over")});this.observe("mouseout",function(){Element.rollOut(this,"Over")})}if(this.onclick){this.href="javascript:void(0);"}this.removeAttribute("title");if(Prototype.Browser.IE){this.select("img[alt]").each(function(a){a.removeAttribute("alt")})}return this},setSeleccionado:function(a){this.seleccionado=a;return this}};function $I(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($I(arguments[a]))}return d}b=$(b);if(!b||b._iconoExtendido){return b}Object.extend(b,Icono.Methods);b._iconoExtendido=Prototype.emptyFunction;return b}var Placom=(function(){var _rutaCargador="cargar.php?";var _rutaBase=$$("base")[0];_rutaBase=(_rutaBase)?_rutaBase.href:"./";var _cabecera=$$("head")[0];var _jsCargados={};var _jsCacheCodigos={};var _funcEvaluar=null;var _esDepuracion=false;var _lenguaje;if(Prototype.Browser.IE){Prototype.Browser.IEVersion=parseFloat(navigator.appVersion.split(";")[1].strip().split(" ")[1]);if(Prototype.Browser.IEVersion>=8){Object.extend(Element._attributeTranslations.write.names,{"class":"class","for":"for"})}}var _cargarCss=function(css){var enlaces=document.getElementsByTagName("link");for(var i=0,le=enlaces.length;i<le;i++){if(enlaces[i].href==css){return}}var estilo=document.createElement("LINK");estilo.type="text/css";estilo.rel="stylesheet";estilo.href=css;_cabecera.insert({bottom:estilo})};var _cargarJs=function(js,variable){if(!Placom.estaCargadoJs(js)){var codigoJs=window.top.Placom.getCodigoJs(js);if(codigoJs){_jsCargados[js]=true;Placom.evaluar(codigoJs)}var params={};params[variable]=js;new Ajax.Request(_rutaCargador,{method:"get",asynchronous:false,evalJSON:false,evalJS:false,parameters:params,onSuccess:function(transporte){_jsCargados[js]=true;window.top.Placom.setCodigoJs(js,transporte.responseText);Placom.evaluar(transporte.responseText)},onFailure:function(transport){Placom.mostrarError("Imposible cargar: "+js)},onException:function(request,excepcion){Placom.mostrarError("[Placom.cargarJs] Imposible cargar: "+js)}})}};var _funcInsertarScript=function(codigo){var s=document.createElement("script");s.type="text/javascript";s.text=codigo;_cabecera.appendChild(s);if(Placom.enServidor){_cabecera.removeChild(s)}};return{enServidor:(window.location.hostname!="placom"),prefPag:"./",peticion:{},esDepuracion:function(){return _esDepuracion},mostrarError:function(mensaje){if(Placom.esDepuracion()&&window.console){console.error(mensaje)}},setPeticion:function(prefPag,modulo,controlador,accion,esDepuracion){this.prefPag=prefPag;this.peticion.modulo=modulo;this.peticion.controlador=controlador;this.peticion.accion=accion;_esDepuracion=esDepuracion;return this},getRutaBase:function(){return _rutaBase},getRutaIni:function(){return _rutaBase+this.prefPag},getLocalizacion:function(){return{prefPag:this.prefPag,base:_rutaBase,direccion:window.location.href}},getLenguaje:function(){if(!_lenguaje){var etiquetaHtml=$$("html")[0];if(etiquetaHtml){_lenguaje=etiquetaHtml.readAttribute("lang");if(!_lenguaje){_lenguaje=etiquetaHtml.readAttribute("xml:lang")}}if(!_lenguaje){_lenguaje="es"}}return _lenguaje},getImgg:function(img){return _rutaCargador+"imgg="+img},cargarCssg:function(css){_cargarCss(_rutaCargador+"cssg="+css);return this},cargarCss:function(css,ruta){if(!css.startsWith("http://")&&ruta!=undefined&&!ruta.strip().empty()){css=ruta+css}if(css.startsWith("http://")){if(!css.endsWith(".css")){css+=".css"}}else{css=_rutaCargador+"css="+css}_cargarCss(css);return this},cargarJsg:function(js){_cargarJs(js,"jsg");return this},cargarJs:function(js){_cargarJs(js,"js");return this},cargadoJs:function(js){_jsCargados[js]=1;return this},estaCargadoJs:function(js){return(typeof(_jsCargados[js])!="undefined")},getCodigoJs:function(js){return _jsCacheCodigos[js]},setCodigoJs:function(js,codigo){return _jsCacheCodigos[js]=codigo},evaluar:function(codigo){if(typeof(codigo)!="string"){return false}_funcInsertarScript(codigo)},tipoVar:function(value){var s=typeof value;if(s==="object"){if(value){if(typeof(value.length)==="number"&&!(value.propertyIsEnumerable("length"))&&typeof(value.splice)==="function"){s="array"}}else{s="null"}}return s},irA:function(ruta,objetivo){if(!ruta.startsWith("http://")){ruta=_rutaBase+ruta}if(objetivo){var formulario=new Element("form",{id:"__irA",target:objetivo,method:"get",action:ruta});window.document.body.appendChild(formulario);$("__irA").submit();window.document.body.removeChild(formulario)}else{if(Prototype.Browser.IE){var enlace=new Element("a",{id:"__irA",target:"_self",href:ruta});window.document.body.appendChild(enlace);setTimeout("$('__irA').click();",100)}else{window.location.assign(ruta)}}},saltarA:function(ruta){this.irA(this.prefPag+ruta)},lanzarCallback:function(callback){switch(typeof(callback)){case"object":if(typeof(callback.scope)=="string"){callback.scope=window.eval(callback.scope)}func=(typeof(callback.func)=="string")?callback.scope[callback.func]:callback.func;if(typeof(func)=="undefined"){throw new Error("Funcion '"+callback.func+"' inexistente")}func.apply(callback.scope,callback.args);break;case"function":callback.call();break;case"string":window.eval(callback);break}},resolucionPantalla:function(){return{ancho:screen.width,alto:screen.height}},tamanyoPantalla:function(){var xScroll,yScroll;var windowWidth,windowHeight;var pageHeight,pageWidth;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight}}if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight}else{if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight}}}if(yScroll<windowHeight){pageHeight=windowHeight}else{pageHeight=yScroll}if(xScroll<windowWidth){pageWidth=windowWidth}else{pageWidth=xScroll}return{anchoPag:pageWidth,altoPag:pageHeight,ancho:windowWidth,alto:windowHeight}},scrollPantalla:function(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=="number"){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft}}}return{x:scrOfX,y:scrOfY}},deshabilitarClick:function(e){var deshabilitar=false;if(document.all){if((event.button==2||event.button==3)&&event.srcElement.tagName=="IMG"){deshabilitar=true}}else{if(document.layers){if(e.which==3){deshabilitar=true}}else{if(document.getElementById){if(e.which==3&&e.target.tagName=="IMG"){deshabilitar=true}}}}if(deshabilitar){if(this.msjDeshabImg){alert(this.msjDeshabImg)}return false}},deshabilitarClickImgs:function(){this.msjDeshabImg=(arguments.length>1&&typeof(arguments[1])!="string")?arguments[1]:"Función deshabilitada";if(document.all){document.onmousedown=this.deshabilitarClick.bind(this)}else{if(document.getElementById){document.onmouseup=this.deshabilitarClick.bind(this)}else{if(document.layers){for(i=0;i<document.images.length;i++){document.images[i].onmousedown=this.deshabilitarClick.bind(this)}}}}document.oncontextmenu=new Function("return false;")},abrirPopUp:function(dir,ancho,alto,opciones){if(typeof(ventanaPopUp)!="undefined"&&ventanaPopUp!=null&&!ventanaPopUp.closed&&ventanaPopUp.location){ventanaPopUp.location.href=dir}else{var x=(screen.width-ancho)/2;var y=(screen.height-alto)/2;opciones=Object.extend({channelmode:"no",directories:"no",fullscreen:"no",location:"no",toolbar:"no",resizable:"no",menubar:"no",status:"no",titlebar:"no",marginwidth:"0",marginheight:"0",frameborder:"0"},opciones||{});ventanaPopUp=window.open(dir,"","width="+(ancho)+", height="+(alto)+", "+Object.implode(opciones));ventanaPopUp.moveTo(x,y);if(ventanaPopUp&&!ventanaPopUp.opener){ventanaPopUp.opener=self}}if(!window.focus){ventanaPopUp.focus()}}}})();