").html(t).find(e.selector):u(t)&&(t.data(c)||t.data(c,i('
').insertAfter(t).hide()),t=t.show().detach(),e.wrap.bind("onReset",function(){i(this).find(t).length&&t.hide().replaceAll(t.data(c)).data(c,!1)}));break;case"image":t=e.tpl.image.replace("{href}",a);break;case"swf":t='
"}u(t)&&t.parent().is(e.inner)||e.inner.append(t),l.trigger("beforeShow"),e.inner.css("overflow","yes"===o?"scroll":"no"===o?"hidden":o),l._setDimension(),l.reposition(),l.isOpen=!1,l.coming=null,l.bindEvents(),l.isOpened?d.prevMethod&&l.transitions[d.prevMethod]():i(".fancybox-wrap").not(e.wrap).stop(!0).trigger("onReset").remove(),l.transitions[l.isOpened?e.nextMethod:e.openMethod](),l._preloadImages()}},_setDimension:function(){var e,t,n,o,a,r,s,d,c,u,p,f,v,y,b,_=l.getViewport(),C=0,w=!1,x=!1,I=l.wrap,k=l.skin,E=l.inner,S=l.current,$=S.width,T=S.height,B=S.minWidth,N=S.minHeight,P=S.maxWidth,A=S.maxHeight,L=S.scrolling,D=S.scrollOutside?S.scrollbarWidth:0,O=S.margin,M=m(O[1]+O[3]),j=m(O[0]+O[2]);if(I.add(k).add(E).width("auto").height("auto").removeClass("fancybox-tmp"),e=m(k.outerWidth(!0)-k.width()),t=m(k.outerHeight(!0)-k.height()),n=M+e,o=j+t,a=h($)?(_.w-n)*m($)/100:$,r=h(T)?(_.h-o)*m(T)/100:T,"iframe"===S.type){if(y=S.content,S.autoHeight&&1===y.data("ready"))try{y[0].contentWindow.document.location&&(E.width(a).height(9999),b=y.contents().find("body"),D&&b.css("overflow-x","hidden"),r=b.outerHeight(!0))
}catch(V){}}else(S.autoWidth||S.autoHeight)&&(E.addClass("fancybox-tmp"),S.autoWidth||E.width(a),S.autoHeight||E.height(r),S.autoWidth&&(a=E.width()),S.autoHeight&&(r=E.height()),E.removeClass("fancybox-tmp"));if($=m(a),T=m(r),c=a/r,B=m(h(B)?m(B,"w")-n:B),P=m(h(P)?m(P,"w")-n:P),N=m(h(N)?m(N,"h")-o:N),A=m(h(A)?m(A,"h")-o:A),s=P,d=A,S.fitToView&&(P=Math.min(_.w-n,P),A=Math.min(_.h-o,A)),f=_.w-M,v=_.h-j,S.aspectRatio?($>P&&($=P,T=m($/c)),T>A&&(T=A,$=m(T*c)),B>$&&($=B,T=m($/c)),N>T&&(T=N,$=m(T*c))):($=Math.max(B,Math.min($,P)),S.autoHeight&&"iframe"!==S.type&&(E.width($),T=E.height()),T=Math.max(N,Math.min(T,A))),S.fitToView)if(E.width($).height(T),I.width($+e),u=I.width(),p=I.height(),S.aspectRatio)for(;(u>f||p>v)&&$>B&&T>N&&!(C++>19);)T=Math.max(N,Math.min(A,T-10)),$=m(T*c),B>$&&($=B,T=m($/c)),$>P&&($=P,T=m($/c)),E.width($).height(T),I.width($+e),u=I.width(),p=I.height();else $=Math.max(B,Math.min($,$-(u-f))),T=Math.max(N,Math.min(T,T-(p-v)));D&&"auto"===L&&r>T&&f>$+e+D&&($+=D),E.width($).height(T),I.width($+e),u=I.width(),p=I.height(),w=(u>f||p>v)&&$>B&&T>N,x=S.aspectRatio?s>$&&d>T&&a>$&&r>T:(s>$||d>T)&&(a>$||r>T),i.extend(S,{dim:{width:g(u),height:g(p)},origWidth:a,origHeight:r,canShrink:w,canExpand:x,wPadding:e,hPadding:t,wrapSpace:p-k.outerHeight(!0),skinSpace:k.height()-T}),!y&&S.autoHeight&&T>N&&A>T&&!x&&E.height("auto")},_getPosition:function(e){var t=l.current,i=l.getViewport(),n=t.margin,o=l.wrap.width()+n[1]+n[3],a=l.wrap.height()+n[0]+n[2],r={position:"absolute",top:n[0],left:n[3]};return t.autoCenter&&t.fixed&&!e&&a<=i.h&&o<=i.w?r.position="fixed":t.locked||(r.top+=i.y,r.left+=i.x),r.top=g(Math.max(r.top,r.top+(i.h-a)*t.topRatio)),r.left=g(Math.max(r.left,r.left+(i.w-o)*t.leftRatio)),r},_afterZoomIn:function(){var e=l.current;e&&(l.isOpen=l.isOpened=!0,l.wrap.css("overflow","visible").addClass("fancybox-opened"),l.update(),(e.closeClick||e.nextClick&&l.group.length>1)&&l.inner.css("cursor","pointer").bind("click.fb",function(t){i(t.target).is("a")||i(t.target).parent().is("a")||(t.preventDefault(),l[e.closeClick?"close":"next"]())}),e.closeBtn&&i(e.tpl.closeBtn).appendTo(l.skin).bind("click.fb",function(e){e.preventDefault(),l.close()}),e.arrows&&l.group.length>1&&((e.loop||e.index>0)&&i(e.tpl.prev).appendTo(l.outer).bind("click.fb",l.prev),(e.loop||e.index
').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){return i(e.target).hasClass("fancybox-overlay")?(l.isActive?l.close():t.close(),!1):void 0}),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",""):!1),t.locked=this.overlay.append(t.wrap),t.fixed=!1),e.showEarly===!0&&this.beforeShow.apply(this,arguments)},beforeShow:function(e,t){var n,o;t.locked&&(this.margin!==!1&&(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,n,o=l.current,a=o.title,r=e.type;if(i.isFunction(a)&&(a=a.call(o.element,o)),p(a)&&""!==i.trim(a)){switch(t=i('