Object.extend(Math,{aleatorio:function(d,a,c){var b=Math.random();b=(!c)?Math.floor(b*(a-d+1)):(b*(a-d));return b+d}});Aplicacion=Class.create({initialize:function(){if(typeof(Cargador)!="undefined"){var d={anchoPag:900,moverX:true,moverY:true,ajusteAncho:10,ajusteAlto:10,swf:{ruta:"cargar.php?arch=flash/cargador.swf",ancho:21,alto:21,params:{wmode:"transparent"}}};this.cargador=new Cargador(d)}if(typeof(Ventana)!="undefined"){ventana=new Ventana()}var c=("https:"==document.location.protocol?"https://ssl.":"http://www.")+"google-analytics.com/ga.js";var a=new Element("script",{src:c});var b=function(){if(!a.readyState||/loaded|complete/.test(a.readyState)){var e=_gat._getTracker("UA-503372-1");e._trackPageview()}};a.observe("load",b);a.observe("readystatechange",b);document.body.appendChild(a)},comprobarTamanyo:function(){var a=$("todo");this.capaPie=a.select(".contenidoInf .pie").first();this.capaPieInt=this.capaPie.firstDescendant();this.alturaTodoIni=a.getHeight();this.alturaPieIni=this.capaPie.getHeight();Event.observe(window,"resize",this._comprobarTamanyo.bind(this));this._comprobarTamanyo()},_comprobarTamanyo:function(){var b=document.viewport.getDimensions().height;var a=(b>this.alturaTodoIni)?(b-this.alturaTodoIni+this.alturaPieIni):this.alturaPieIni;this.capaPie.setHeight(a);this.capaPieInt.setStyle({paddingTop:Math.max(0,a-30-12)+"px"})},accionInicioInicio:function(){var l=new Control.Tabs("isaTabs");var g=new UI.Carousel("iniUltimosProyectos",{container:".iniContenedorProys"});var k=new UI.Carousel("iniUltimasNoticias",{animating:false,container:".iniContenedorNotsInt"});var i=k.elements;var d=i.length;var e=Math.aleatorio(0,d-1);k.scrollTo(e);new PeriodicalExecuter(function(){if(++e>=d){e=0}k.scrollTo(e)},8);var a=function(){this.request();return false};var f=function(){this.addClassName("isaBtnEntrarOver")};var c=function(){this.removeClassName("isaBtnEntrarOver")};var b=$("form_acl_usuario_global");var m=$("form_usuario_webmail");var j=$("btnEntrarUsuAcl");var h=$("btnEntrarWebmail");b.onsubmit=a;m.onsubmit=a;j.observe("mouseover",f);j.observe("mouseout",c);h.observe("mouseover",f);h.observe("mouseout",c);if(typeof(Prototips)!="undefined"){Prototips.addCfg("tipsProys",{effect:"appear",hook:{target:"topLeft",tip:"bottomLeft"},offset:{x:10,y:-4}},true)}},accionInicioContenidoInf:function(){var b=$("iniInfOfertas");if(b){var c=new UI.Carousel(b,{animating:false,container:".iniInfContenedorOfertas"});var e=c.elements;var d=e.length;var a=Math.aleatorio(0,d-1);c.scrollTo(a);new PeriodicalExecuter(function(){if(++a>=d){a=0}c.scrollTo(a)},8)}},accionContactoInicio:function(){var a=$("form_contacto");var b=$("btnBorrarFrmCnt");var c=$("btnEnviarFrmCnt");$("btnBorrarFrmCnt").observe("click",function(){a.reset()});$("btnEnviarFrmCnt").observe("click",function(){a.request()})},accionNoticiasInicio:function(){var a=$("ultimasNoticias");this.carruselNoticias=new UI.Carousel(a,{animating:false,container:".notsContenedorNots"});a.select("a").each(function(b){b.onclick=function(){SWFAddress.setValue(b.href.split("/").last());return false}});this.accionNoticiasInicioCrearScroll();SWFAddress.addEventListener(SWFAddressEvent.CHANGE,function(c){var b=c.path.ltrim("/");if(!b.blank()){pajax.getCtrl().cargarNoticia(b)}})},accionNoticiasInicioCrearScroll:function(){var a=$("notsNotSelScroll");this.deslizador=new Deslizador("notsNoticiaSel",{btnMas:"notsBtnScrollArriba",btnMenos:"notsBtnScrollAbajo",detector:{onConDeslizamiento:a.show.bind(a),onSinDeslizamiento:a.hide.bind(a)}})},accionQueHacemosInicio:function(){$("qHacVisorSecciones").select("div.qHacVisorTxt").each(function(c,f){var d=c.getHeight();var e=300-d;if(e<80){c.setStyle({marginTop:(e-5)+"px"})}});var b=new Control.Tabs("qHacSecciones");var a=$("sub-"+b.links.first().href.split("#").last());b.observe("afterChange",function(c){var d=$("sub-"+c.id);if(d){d.show();if(a){a.hide()}a=d}})},accionQueHicimosInicio:function(f){this.cargador.mostrar();var t=$("qHicSupCatsDcha");var b=$("qHizSupCatsIzda");var r=$("qHicSupIconoProy");t.select("a.qHicSupCatDcha").each(function(u){var v=$w(u.className).last()+"Over";if(!u.hasClassName("seleccionada")){u.observe("mouseover",function(){u.addClassName(v)});u.observe("mouseout",function(){u.removeClassName(v)})}else{u.addClassName(v);u.onclick=function(){return false}}});b.select("a.qHicSupCatIzda").each(function(u){if(u.hasClassName("seleccionada")){u.onclick=function(){return false}}});var s=$("qHicSupProy");var e=$("proyectos");var n=null;var l={};var d=false;var c=135;var a=0.3;var h=0.5;var i=1;var o=40;var g=80;var j=6;var q=0;var k=false;var p=e.childElements();var m=function(v){var u=Event.extend(v).target;if(u){elEvTag=u.tagName.toUpperCase();elEvClase=u.className;return(!(elEvTag=="A"&&elEvClase=="qHacInfProy")&&!(elEvTag=="IMG"&&elEvClase=="reflected"))}return false};e.setStyle({left:o+"px"});p.each(function(G){var C=G.firstDescendant();var H=C.firstDescendant();H.removeAttribute("alt");var A=c/H.width;var F=H.height/H.width;var y=H.width;var w=H.height;H.width=A*y;H.height=A*w;Reflection.add(H,{height:0.3,opacity:0.3});var K=H.up();var v=H.next();var E=w-H.height-15;C.setStyle({width:H.width+"px",height:H.height+"px",paddingTop:Math.max(0,E)+"px"});H.setOpacity(h);var J,x,u;var I=function(L){H.width=L;H.height=L*F;C.setStyle({width:L+"px",height:H.height+"px"});K.setStyle({width:L+"px",height:H.height+"px"})};var D=function(){v.show()};var z=function(){[J,x,u].each(function(L){if(L){L.cancel();L=null}})};var B=C.href.split("/").last();l[B]=C;C.seleccionado=false;C.observe("mouseover",function(L){if(q!=0||C.seleccionado||m(L)){return}C.addClassName("qHacInfProyOver");v.hide();if(!Prototype.Browser.IE||Prototype.Browser.IEVersion>=7){z();J=new Effect.Tween(H,H.width,y,{duration:a},I);x=new Effect.Opacity(H,{from:H.getOpacity(),to:i,duration:a});u=new Effect.Morph(C,{style:"padding-top: 0px;",duration:a})}else{I(y);H.setOpacity(i);C.setStyle({paddingTop:"0px"})}});C.observe("mouseout",function(L){if(C.seleccionado||m(L)){return}C.removeClassName("qHacInfProyOver");if(!Prototype.Browser.IE||Prototype.Browser.IEVersion>=7){z();J=new Effect.Tween(H,H.width,A*y,{duration:a,afterFinish:D},I);x=new Effect.Opacity(H,{from:H.getOpacity(),to:h,duration:a});u=new Effect.Morph(C,{style:"padding-top: "+E+"px;",duration:a})}else{I(A*y);H.setOpacity(h);C.setStyle({paddingTop:E+"px"});D()}});C.onclick=function(){return false};C.observe("click",function(L){if(C.seleccionado){return}d=true;SWFAddress.setValue(B)});if(f==B){C.fireObservers("mouseover");C.seleccionado=true;n=C}});e.hide().setStyle({visibility:"visible"});this.cargador.ocultar();Effect.Appear(e,{duration:1,afterFinish:function(){if(p.length>5){var F=$("qHazInf");var E=F.getDimensions();var z=o;var G=z;var v=G;var H=(135+15)*p.length+o*2;var w=E.width-H-(z*2);var u;var C=function(){u=F.cumulativeOffset()};C();Event.observe(window,"resize",C);document.observe("mousemove",function(K){var J=Event.pointerX(K);var I=Event.pointerY(K);if(I>u.top&&I<(u.top+E.height)){if(J>u.left&&J<(u.left+g)){q=(G<z-2)?j:0;return}else{if(J>(u.left+E.width-g)&&J<(u.left+E.width)){q=(G>w+2)?-j:0;return}}}q=0});var y;var x;var B;var D=false;var A=setInterval(function(){if(v>z){v=z}else{if(v<w){v=w}else{v+=q}}y=v-G;if(y!=0){D=true;B=y/20;x=Math.abs(B);G+=(x>=1)?Math.round(B):B/x;e.setStyle({left:G+"px"})}else{D=false;q=0}},5)}}});SWFAddress.addEventListener(SWFAddressEvent.CHANGE,function(x){var w=x.path.ltrim("/");if(!w.blank()){var u=l[w];if(!u||u.seleccionado){return}if(!d){u.fireObservers("mouseover")}d=false;u.seleccionado=true;if(n){n.seleccionado=false;n.fireObservers("mouseout")}n=u;var v=pajax.getCtrl().invocarMetodo("mostrarProyecto",[w],{asynchronous:false});if(v){t.hide();b.show();s.show();if(r){r.show()}this.queHicimosIniciarCarruselImgs()}}}.bind(this));if(f){this.queHicimosIniciarCarruselImgs()}},queHicimosIniciarCarruselImgs:function(){var a=$("qHicProyImgsCarrusel");if(a){var d=new UI.Carousel("qHicProyImgsCarrusel",{container:".qHicProyContenedorImgs"})}var c=$("qHicProyData");var b=c.firstDescendant();b.setStyle({marginTop:(c.getHeight()-b.getHeight())+"px"})}});var app=new Aplicacion();