").html(e).find(r.selector):p(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",i('
').insertAfter(e).hide()),e=e.show().detach(),r.wrap.bind("onReset",function(){i(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case"image":e=r.tpl.image.replace("{href}",o);break;case"swf":e='
"}(!p(e)||!e.parent().is(r.inner))&&r.inner.append(e),l.trigger("beforeShow"),r.inner.css("overflow","yes"===n?"scroll":"no"===n?"hidden":n),l._setDimension(),l.reposition(),l.isOpen=!1,l.coming=null,l.bindEvents(),l.isOpened?s.prevMethod&&l.transitions[s.prevMethod]():i(".fancybox-wrap").not(r.wrap).stop(!0).trigger("onReset").remove(),l.transitions[l.isOpened?r.nextMethod:r.openMethod](),l._preloadImages()}},_setDimension:function(){var e,t,n,o,a,r,s,c,d,p=l.getViewport(),h=0,m=!1,y=!1,m=l.wrap,x=l.skin,v=l.inner,w=l.current,y=w.width,b=w.height,k=w.minWidth,C=w.minHeight,O=w.maxWidth,W=w.maxHeight,_=w.scrolling,S=w.scrollOutside?w.scrollbarWidth:0,T=w.margin,L=u(T[1]+T[3]),E=u(T[0]+T[2]);if(m.add(x).add(v).width("auto").height("auto").removeClass("fancybox-tmp"),T=u(x.outerWidth(!0)-x.width()),e=u(x.outerHeight(!0)-x.height()),t=L+T,n=E+e,o=f(y)?(p.w-t)*u(y)/100:y,a=f(b)?(p.h-n)*u(b)/100:b,"iframe"===w.type){if(d=w.content,w.autoHeight&&1===d.data("ready"))try{d[0].contentWindow.document.location&&(v.width(o).height(9999),r=d.contents().find("body"),S&&r.css("overflow-x","hidden"),a=r.outerHeight(!0))}catch(e){}}else(w.autoWidth||w.autoHeight)&&(v.addClass("fancybox-tmp"),w.autoWidth||v.width(o),w.autoHeight||v.height(a),w.autoWidth&&(o=v.width()),w.autoHeight&&(a=v.height()),v.removeClass("fancybox-tmp"));if(y=u(o),b=u(a),c=o/a,k=u(f(k)?u(k,"w")-t:k),O=u(f(O)?u(O,"w")-t:O),C=u(f(C)?u(C,"h")-n:C),W=u(f(W)?u(W,"h")-n:W),r=O,s=W,w.fitToView&&(O=Math.min(p.w-t,O),W=Math.min(p.h-n,W)),t=p.w-L,E=p.h-E,w.aspectRatio?(y>O&&(y=O,b=u(y/c)),b>W&&(b=W,y=u(b*c)),y
t||L>E)&&y>k&&b>C&&!(19O&&(y=O,b=u(y/c)),v.width(y).height(b),m.width(y+T),p=m.width(),L=m.height();else y=Math.max(k,Math.min(y,y-(p-t))),b=Math.max(C,Math.min(b,b-(L-E)));S&&"auto"===_&&bt||L>E)&&y>k&&b>C,y=w.aspectRatio?yC&&b ').appendTo(l.coming?l.coming.parent:e.parent),this.fixed=!1,e.fixed&&l.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(e){var t=this;e=i.extend({},this.defaults,e),this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(e),this.fixed||(a.bind("resize.overlay",i.proxy(this.update,this)),this.update()),e.closeClick&&this.overlay.bind("click.overlay",function(e){if(i(e.target).hasClass("fancybox-overlay"))return l.isActive?l.close():t.close(),!1}),this.overlay.css(e.css).show()},close:function(){var e,t;a.unbind("resize.overlay"),this.el.hasClass("fancybox-lock")&&(i(".fancybox-margin").removeClass("fancybox-margin"),e=a.scrollTop(),t=a.scrollLeft(),this.el.removeClass("fancybox-lock"),a.scrollTop(e).scrollLeft(t)),i(".fancybox-overlay").remove().hide(),i.extend(this,{overlay:null,fixed:!1})},update:function(){var e,i="100%";this.overlay.width(i).height("100%"),s?(e=Math.max(t.documentElement.offsetWidth,t.body.offsetWidth),r.width()>e&&(i=r.width())):r.width()>a.width()&&(i=r.width()),this.overlay.width(i).height(r.height())},onReady:function(e,t){var n=this.overlay;i(".fancybox-overlay").stop(!0,!0),n||this.create(e),e.locked&&this.fixed&&t.fixed&&(n||(this.margin=r.height()>a.height()&&i("html").css("margin-right").replace("px","")),t.locked=this.overlay.append(t.wrap),t.fixed=!1),!0===e.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(e,t){var n,o;t.locked&&(!1!==this.margin&&(i("*").filter(function(){return"fixed"===i(this).css("position")&&!i(this).hasClass("fancybox-overlay")&&!i(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),n=a.scrollTop(),o=a.scrollLeft(),this.el.addClass("fancybox-lock"),a.scrollTop(n).scrollLeft(o)),this.open(e)},onUpdate:function(){this.fixed||this.update()},afterClose:function(e){this.overlay&&!l.coming&&this.overlay.fadeOut(e.speedOut,i.proxy(this.close,this))}},l.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(e){var t=l.current,n=t.title,o=e.type;if(i.isFunction(n)&&(n=n.call(t.element,t)),h(n)&&""!==i.trim(n)){switch(t=i('