window.addEvent("domready",TB_init);TB_WIDTH=0;TB_HEIGHT=0;var TB_doneOnce=0;function TB_init(){$$("a.smoothbox").each(function(A){A.onclick=TB_bind})}function TB_bind(B){var B=new Event(B);B.preventDefault();this.blur();var A=this.title||this.name||"";var C=this.rel||false;TB_show(A,this.href,C);this.onclick=TB_bind;return false}function TB_objectHide(A){var B=$A(document.getElementsByTagName("object"));B.extend(document.getElementsByTagName(window.ie?"select":"embed"));B.each(function(C){if(A){C.lbBackupStyle=C.style.visibility}C.style.visibility=A?"hidden":C.lbBackupStyle})}function TB_show(Q,E,B){TB_objectHide(true);if(!$("TB_overlay")){new Element("iframe").setProperty("id","TB_HideSelect").injectInside(document.body);$("TB_HideSelect").setOpacity(0);new Element("div").setProperty("id","TB_overlay").injectInside(document.body);$("TB_overlay").setOpacity(0);TB_overlaySize();new Element("div").setProperty("id","TB_load").injectInside(document.body);$("TB_load").innerHTML="<img src='loading.gif' />";TB_load_position();new Fx.Style("TB_overlay","opacity",{duration:400,transition:Fx.Transitions.sineInOut}).start(0,0.6)}if(!$("TB_load")){new Element("div").setProperty("id","TB_load").injectInside(document.body);$("TB_load").innerHTML="<img src='loading.gif' />";TB_load_position()}if(!$("TB_window")){new Element("div").setProperty("id","TB_window").injectInside(document.body);$("TB_window").setOpacity(0)}$("TB_overlay").onclick=TB_remove;window.onscroll=TB_positionEffect;var R=E.match(/(.+)?/)[1]||E;var O=/\.(jpe?g|png|gif|bmp)/gi;if(R.match(O)){var U={caption:"",url:"",html:""};var L=U,M=U,A="";if(B){function I(W,X,V){return{caption:W.title,url:W.href,html:"<span id='TB_"+X+"'>&nbsp;&nbsp;<a href='#'>"+V+"</a></span>"}}var C=[];$$("a.smoothbox").each(function(V){if(V.rel==B){C[C.length]=V}});var T=false;for(var P=0;P<C.length;P++){var J=C[P];var G=J.href.match(O);if(J.href==E){T=true;A="Imagen "+(P+1)+" de "+(C.length)}else{if(T){M=I(J,"next","Siguiente &gt;");break}else{L=I(J,"prev","&lt; Anterior")}}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var X=window.getWidth()-150;var b=window.getHeight()-150;var Y=imgPreloader.width;var W=imgPreloader.height;if(Y>X){W=W*(X/Y);Y=X;if(W>b){Y=Y*(b/W);W=b}}else{if(W>b){Y=Y*(b/W);W=b;if(Y>X){W=W*(X/Y);Y=X}}}TB_WIDTH=Y+30;TB_HEIGHT=W+60;$("TB_window").innerHTML+="<a href='' id='TB_ImageOff' title='Cerrar'><img id='TB_Image' src='"+E+"' width='"+Y+"' height='"+W+"' alt='"+Q+"'/></a><div id='TB_caption'>"+Q+"<div id='TB_secondLine'>"+A+L.html+M.html+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>cerrar</a></div>";$("TB_closeWindowButton").onclick=TB_remove;function V(c){return function(){$("TB_window").remove();new Element("div").setProperty("id","TB_window").injectInside(document.body);TB_show(c.caption,c.url,B);return false}}var a=V(L);var Z=V(M);if($("TB_prev")){$("TB_prev").onclick=a}if($("TB_next")){$("TB_next").onclick=Z}document.onkeydown=function(c){var c=new Event(c);switch(c.code){case 27:TB_remove();break;case 190:if($("TB_next")){document.onkeydown=null;Z()}break;case 188:if($("TB_prev")){document.onkeydown=null;a()}break}};$("TB_ImageOff").onclick=TB_remove;TB_position();TB_showWindow()};imgPreloader.src=E}else{var D=E.match(/\?(.+)/)[1];var S=TB_parseQuery(D);TB_WIDTH=(S.width*1)+30;TB_HEIGHT=(S.height*1)+40;var H=TB_WIDTH-30,N=TB_HEIGHT-45;if(E.indexOf("TB_iframe")!=-1){urlNoQuery=E.split("TB_");$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+Q+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>cerrar</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(H+29)+"px;height:"+(N+17)+"px;' onload='TB_showWindow()'> </iframe>"}else{$("TB_window").innerHTML+="<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+Q+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>cerrar</a></div></div><div id='TB_ajaxContent' style='width:"+H+"px;height:"+N+"px;'></div>"}$("TB_closeWindowButton").onclick=TB_remove;if(E.indexOf("TB_inline")!=-1){$("TB_ajaxContent").innerHTML=($(S.inlineId).innerHTML);TB_position();TB_showWindow()}else{if(E.indexOf("TB_iframe")!=-1){TB_position();if(frames.TB_iframeContent==undefined){$(document).keyup(function(W){var V=W.keyCode;if(V==27){TB_remove()}});TB_showWindow()}}else{var F=function(){TB_position();TB_showWindow()};var K=new Ajax(E,{method:"get",update:$("TB_ajaxContent"),onComplete:F}).request()}}}window.onresize=function(){TB_position();TB_load_position();TB_overlaySize()};document.onkeyup=function(V){var V=new Event(V);if(V.code==27){TB_remove()}}}function TB_showWindow(){if(TB_doneOnce==0){TB_doneOnce=1;var A=new Fx.Style("TB_window","opacity",{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){if($("TB_load")){$("TB_load").remove()}}}).start(0,1)}else{$("TB_window").setStyle("opacity",1);if($("TB_load")){$("TB_load").remove()}}}function TB_remove(){TB_objectHide(false);$("TB_overlay").onclick=null;document.onkeyup=null;document.onkeydown=null;if($("TB_imageOff")){$("TB_imageOff").onclick=null}if($("TB_closeWindowButton")){$("TB_closeWindowButton").onclick=null}if($("TB_prev")){$("TB_prev").onclick=null}if($("TB_next")){$("TB_next").onclick=null}new Fx.Style("TB_window","opacity",{duration:250,transition:Fx.Transitions.sineInOut,onComplete:function(){$("TB_window").remove()}}).start(1,0);new Fx.Style("TB_overlay","opacity",{duration:400,transition:Fx.Transitions.sineInOut,onComplete:function(){$("TB_overlay").remove()}}).start(0.6,0);window.onscroll=null;window.onresize=null;$("TB_HideSelect").remove();TB_init();TB_doneOnce=0;return false}function TB_position(){$("TB_window").setStyles({width:TB_WIDTH+"px",left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+"px",top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+"px"})}function TB_positionEffect(){new Fx.Styles("TB_window",{duration:75,transition:Fx.Transitions.sineInOut}).start({left:(window.getScrollLeft()+(window.getWidth()-TB_WIDTH)/2)+"px",top:(window.getScrollTop()+(window.getHeight()-TB_HEIGHT)/2)+"px"})}function TB_overlaySize(){$("TB_overlay").setStyles({height:"0px",width:"0px"});$("TB_HideSelect").setStyles({height:"0px",width:"0px"});$("TB_overlay").setStyles({height:window.getScrollHeight()+"px",width:window.getScrollWidth()+"px"});$("TB_HideSelect").setStyles({height:window.getScrollHeight()+"px",width:window.getScrollWidth()+"px"})}function TB_load_position(){if($("TB_load")){$("TB_load").setStyles({left:(window.getScrollLeft()+(window.getWidth()-56)/2)+"px",top:(window.getScrollTop()+((window.getHeight()-20)/2))+"px",display:"block"})}}function TB_parseQuery(C){if(!C){return{}}var E={};var B=C.split(/[;&]/);for(var A=0;A<B.length;A++){var D=B[A].split("=");if(!D||D.length!=2){continue}E[unescape(D[0])]=unescape(D[1]).replace(/\+/g," ")}return E};