(function(a){a.visor={version:"2.5.6"};a.fn.visor=function(u){u=jQuery.extend({animationSpeed:"normal",opacity:0.8,showTitle:false,allowresize:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"botones",hideflash:false,wmode:"opaque",autoplay:false,modal:false,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Agrandar la imagen">Agrandar</a><div class="pp_hoverContainer"><a class="pp_next" href="#">siguiente</a><a class="pp_previous" href="#">anterior</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><a class="pp_close" href="#">Cerrar</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Anterior</a><p class="currentTextHolder">0/0</p><a href="#" class="pp_arrow_next">Siguiente</a></div></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div> 						</div></div><div class="pp_overlay"></div><div class="ppt"></div>',image_markup:'<img id="fullResImage" src="" />'},u);if(a.browser.msie&&parseInt(a.browser.version)==6){u.theme="botonesie6"}if(a(".pp_overlay").size()==0){v()}var e=true,i=false,t,o,z,c,m,n,s,w,g=a(window).height(),y=a(window).width(),d=0,r=f();a(window).scroll(function(){r=f();j();q()});a(window).resize(function(){j();q()});a(document).keydown(function(A){if(o.is(":visible")){switch(A.keyCode){case 37:a.visor.changePage("previous");break;case 39:a.visor.changePage("next");break;case 27:if(!u.modal){a.visor.close()}break}}});a(this).each(function(){a(this).bind("click",function(){_self=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var A=new Array(),C=new Array(),B=new Array();if(theGallery){a("a[rel*="+theGallery+"]").each(function(D){if(a(this)[0]===a(_self)[0]){d=D}A.push(a(this).attr("href"));C.push(a(this).find("img").attr("alt"));B.push(a(this).attr("title"))})}else{A=a(this).attr("href");C=(a(this).find("img").attr("alt"))?a(this).find("img").attr("alt"):"";B=(a(this).attr("title"))?a(this).attr("title"):""}a.visor.open(A,C,B);return false})});a.visor.open=function(C,B,A){if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","hidden")}if(u.hideflash){a("object,embed").css("visibility","hidden")}images=a.makeArray(C);titles=a.makeArray(B);descriptions=a.makeArray(A);image_set=(a(images).size()>0)?true:false;h(a(images).size());a(".pp_loaderIcon").show();c.show().fadeTo(u.animationSpeed,u.opacity);o.find(".currentTextHolder").text((d+1)+u.counter_separator_label+a(images).size());if(descriptions[d]){o.find(".pp_description").show().html(unescape(descriptions[d]))}else{o.find(".pp_description").hide().text("")}if(titles[d]&&u.showTitle){hasTitle=true;z.html(unescape(titles[d]))}else{hasTitle=false}movie_width=(parseFloat(b("width",images[d])))?b("width",images[d]):u.default_width.toString();movie_height=(parseFloat(b("height",images[d])))?b("height",images[d]):u.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat((a(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat((a(window).width()*parseFloat(movie_width)/100)-100);i=true}o.fadeIn(function(){imgPreloader="";switch(x(images[d])){case"image":imgPreloader=new Image();nextImage=new Image();if(image_set&&d>a(images).size()){nextImage.src=images[d+1]}prevImage=new Image();if(image_set&&images[d-1]){prevImage.src=images[d-1]}o.find("#pp_full_res")[0].innerHTML=u.image_markup;o.find("#fullResImage").attr("src",images[d]);imgPreloader.onload=function(){t=k(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.onerror=function(){alert("La imagen no se ha podido cargar.");a.visor.close()};imgPreloader.src=images[d];break}if(!imgPreloader){o.find("#pp_full_res")[0].innerHTML=toInject;_showContent()}})};a.visor.changePage=function(A){if(A=="previous"){d--;if(d<0){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled")){return}d++}if(!e){e=true}l(function(){a.visor.open(images,titles,descriptions)});a("a.pp_expand,a.pp_contract").fadeOut(u.animationSpeed)};a.visor.close=function(){o.find("object,embed").css("visibility","hidden");a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(u.animationSpeed);c.fadeOut(u.animationSpeed,function(){a("#pp_full_res").html("");o.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");j();if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","visible")}if(u.hideflash){a("object,embed").css("visibility","visible")}d=0;u.callback()});e=true};_showContent=function(){a(".pp_loaderIcon").hide();projectedTop=r.scrollTop+((g/2)-(t.containerHeight/2));if(projectedTop<0){projectedTop=0+z.height()}o.find(".pp_content").animate({height:t.contentHeight},u.animationSpeed);o.animate({top:projectedTop,left:(y/2)-(t.containerWidth/2),width:t.containerWidth},u.animationSpeed,function(){o.find(".pp_hoverContainer,#fullResImage").height(t.height).width(t.width);o.find(".pp_fade").fadeIn(u.animationSpeed);if(image_set&&x(images[d])=="image"){o.find(".pp_hoverContainer").show()}else{o.find(".pp_hoverContainer").hide()}if(u.showTitle&&hasTitle){z.css({top:o.offset().top-25,left:o.offset().left+20,display:"none"});z.fadeIn(u.animationSpeed)}if(t.resized){a("a.pp_expand,a.pp_contract").fadeIn(u.animationSpeed)}u.changepicturecallback()})};function l(A){o.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");o.find(".pp_fade").fadeOut(u.animationSpeed,function(){a(".pp_loaderIcon").show();if(A){A()}});z.fadeOut(u.animationSpeed)}function h(A){if(d==A-1){o.find("a.pp_next").css("visibility","hidden");o.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{o.find("a.pp_next").css("visibility","visible");o.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){a.visor.changePage("next");return false})}if(d==0){o.find("a.pp_previous").css("visibility","hidden");o.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{o.find("a.pp_previous").css("visibility","visible");o.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){a.visor.changePage("previous");return false})}if(A>1){a(".pp_nav").show()}else{a(".pp_nav").hide()}}function k(B,A){hasBeenResized=false;p(B,A);imageWidth=B;imageHeight=A;if(((w>y)||(s>g))&&e&&u.allowresize&&!i){hasBeenResized=true;notFitting=true;while(notFitting){if((w>y)){imageWidth=(y-200);imageHeight=(A/B)*imageWidth}else{if((s>g)){imageHeight=(g-200);imageWidth=(B/A)*imageHeight}else{notFitting=false}}s=imageHeight;w=imageWidth}p(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(s),containerWidth:Math.floor(w)+40,contentHeight:Math.floor(m),contentWidth:Math.floor(n),resized:hasBeenResized}}function p(B,A){B=parseFloat(B);A=parseFloat(A);$pp_details=o.find(".pp_details");$pp_details.width(B);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo(a("body")).css({position:"absolute",top:-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if(a.browser.msie&&a.browser.version==7){detailsHeight+=8}$pp_details.remove();m=A+detailsHeight;n=B;s=m+z.height()+o.find(".pp_top").height()+o.find(".pp_bottom").height();w=B}function x(A){return"image"}function j(){if(e){titleHeight=z.height();contentHeight=o.height();contentwidth=o.width();projectedTop=(g/2)+r.scrollTop-((contentHeight+titleHeight)/2);o.css({top:projectedTop,left:(y/2)+r.scrollLeft-(contentwidth/2)});z.css({top:projectedTop-titleHeight,left:(y/2)+r.scrollLeft-(contentwidth/2)+20})}}function f(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}}else{if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}}else{if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}}}}function q(){g=a(window).height();y=a(window).width();c.css({height:a(document).height()})}function v(){a("body").append(u.markup);o=a(".pp_pic_holder");z=a(".ppt");c=a("div.pp_overlay");o.attr("class","pp_pic_holder "+u.theme);var A=a(document).height();c.css({opacity:0,height:A-4}).bind("click",function(){if(!u.modal){a.visor.close()}});a("a.pp_close").bind("click",function(){a.visor.close();return false});a("a.pp_expand").bind("click",function(){$this=a(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");e=false}else{$this.removeClass("pp_contract").addClass("pp_expand");e=true}l(function(){a.visor.open(images,titles,descriptions)});o.find(".pp_fade").fadeOut(u.animationSpeed);return false});o.find(".pp_previous, .pp_arrow_previous").bind("click",function(){a.visor.changePage("previous");return false});o.find(".pp_next, .pp_arrow_next").bind("click",function(){a.visor.changePage("next");return false})}j()};function b(e,d){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&]"+e+"=([^&#]*)";var g=new RegExp(c);var f=g.exec(d);if(f==null){return""}else{return f[1]}}})(jQuery);