cops/resources/fancybox/jquery.fancybox.pack.js
Sébastien Lucas 700c27e0fc Move Fancybox to the resources directory.
--HG--
rename : fancybox/blank.gif => resources/fancybox/blank.gif
rename : fancybox/fancybox_loading.gif => resources/fancybox/fancybox_loading.gif
rename : fancybox/fancybox_overlay.png => resources/fancybox/fancybox_overlay.png
rename : fancybox/fancybox_sprite.png => resources/fancybox/fancybox_sprite.png
rename : fancybox/helpers/fancybox_buttons.png => resources/fancybox/helpers/fancybox_buttons.png
rename : fancybox/helpers/jquery.fancybox-buttons.css => resources/fancybox/helpers/jquery.fancybox-buttons.css
rename : fancybox/helpers/jquery.fancybox-buttons.js => resources/fancybox/helpers/jquery.fancybox-buttons.js
rename : fancybox/helpers/jquery.fancybox-media.js => resources/fancybox/helpers/jquery.fancybox-media.js
rename : fancybox/helpers/jquery.fancybox-thumbs.css => resources/fancybox/helpers/jquery.fancybox-thumbs.css
rename : fancybox/helpers/jquery.fancybox-thumbs.js => resources/fancybox/helpers/jquery.fancybox-thumbs.js
rename : fancybox/jquery.fancybox.css => resources/fancybox/jquery.fancybox.css
rename : fancybox/jquery.fancybox.pack.js => resources/fancybox/jquery.fancybox.pack.js
2013-05-06 17:49:22 +02:00

1 line
23 KiB
JavaScript

(function(l,o,i,e){var d=i(l),a=i(o),p=i.fancybox=function(){p.open.apply(this,arguments)},k=navigator.userAgent.match(/msie/i),c=null,f=o.createTouch!==e,j=function(q){return q&&q.hasOwnProperty&&q instanceof i},b=function(q){return q&&i.type(q)==="string"},m=function(q){return b(q)&&q.indexOf("%")>0},h=function(q){return(q&&!(q.style.overflow&&q.style.overflow==="hidden")&&((q.clientWidth&&q.scrollWidth>q.clientWidth)||(q.clientHeight&&q.scrollHeight>q.clientHeight)))},n=function(s,r){var q=parseInt(s,10)||0;if(r&&m(s)){q=p.getViewport()[r]/100*q}return Math.ceil(q)},g=function(q,r){return n(q,r)+"px"};i.extend(p,{version:"2.1.4",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:true,autoHeight:false,autoWidth:false,autoResize:true,autoCenter:!f,fitToView:true,aspectRatio:false,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:true,closeBtn:true,closeClick:false,nextClick:false,mouseWheel:true,autoPlay:false,playSpeed:3000,preload:3,modal:false,loop:true,ajax:{dataType:"html",headers:{"X-fancyBox":true}},iframe:{scrolling:"auto",preload:true},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:true,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+(k?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:true,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:true,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:true,title:true},onCancel:i.noop,beforeLoad:i.noop,afterLoad:i.noop,beforeShow:i.noop,afterShow:i.noop,beforeChange:i.noop,beforeClose:i.noop,afterClose:i.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:false,isOpen:false,isOpened:false,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:false},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(r,q){if(!r){return}if(!i.isPlainObject(q)){q={}}if(false===p.close(true)){return}if(!i.isArray(r)){r=j(r)?i(r).get():[r]}i.each(r,function(w,x){var v={},s,A,y,z,u,B,t;if(i.type(x)==="object"){if(x.nodeType){x=i(x)}if(j(x)){v={href:x.data("fancybox-href")||x.attr("href"),title:x.data("fancybox-title")||x.attr("title"),isDom:true,element:x};if(i.metadata){i.extend(true,v,x.metadata())}}else{v=x}}s=q.href||v.href||(b(x)?x:null);A=q.title!==e?q.title:v.title||"";y=q.content||v.content;z=y?"html":(q.type||v.type);if(!z&&v.isDom){z=x.data("fancybox-type");if(!z){u=x.prop("class").match(/fancybox\.(\w+)/);z=u?u[1]:null}}if(b(s)){if(!z){if(p.isImage(s)){z="image"}else{if(p.isSWF(s)){z="swf"}else{if(s.charAt(0)==="#"){z="inline"}else{if(b(x)){z="html";y=x}}}}}if(z==="ajax"){B=s.split(/\s+/,2);s=B.shift();t=B.shift()}}if(!y){if(z==="inline"){if(s){y=i(b(s)?s.replace(/.*(?=#[^\s]+$)/,""):s)}else{if(v.isDom){y=x}}}else{if(z==="html"){y=s}else{if(!z&&!s&&v.isDom){z="inline";y=x}}}}i.extend(v,{href:s,type:z,content:y,title:A,selector:t});r[w]=v});p.opts=i.extend(true,{},p.defaults,q);if(q.keys!==e){p.opts.keys=q.keys?i.extend({},p.defaults.keys,q.keys):false}p.group=r;return p._start(p.opts.index)},cancel:function(){var q=p.coming;if(!q||false===p.trigger("onCancel")){return}p.hideLoading();if(p.ajaxLoad){p.ajaxLoad.abort()}p.ajaxLoad=null;if(p.imgPreload){p.imgPreload.onload=p.imgPreload.onerror=null}if(q.wrap){q.wrap.stop(true,true).trigger("onReset").remove()}p.coming=null;if(!p.current){p._afterZoomOut(q)}},close:function(q){p.cancel();if(false===p.trigger("beforeClose")){return}p.unbindEvents();if(!p.isActive){return}if(!p.isOpen||q===true){i(".fancybox-wrap").stop(true).trigger("onReset").remove();p._afterZoomOut()}else{p.isOpen=p.isOpened=false;p.isClosing=true;i(".fancybox-item, .fancybox-nav").remove();p.wrap.stop(true,true).removeClass("fancybox-opened");p.transitions[p.current.closeMethod]()}},play:function(s){var q=function(){clearTimeout(p.player.timer)},u=function(){q();if(p.current&&p.player.isActive){p.player.timer=setTimeout(p.next,p.current.playSpeed)}},r=function(){q();a.unbind(".player");p.player.isActive=false;p.trigger("onPlayEnd")},t=function(){if(p.current&&(p.current.loop||p.current.index<p.group.length-1)){p.player.isActive=true;a.bind({"onCancel.player beforeClose.player":r,"onUpdate.player":u,"beforeLoad.player":q});u();p.trigger("onPlayStart")}};if(s===true||(!p.player.isActive&&s!==false)){t()}else{r()}},next:function(r){var q=p.current;if(q){if(!b(r)){r=q.direction.next}p.jumpto(q.index+1,r,"next")}},prev:function(r){var q=p.current;if(q){if(!b(r)){r=q.direction.prev}p.jumpto(q.index-1,r,"prev")}},jumpto:function(r,t,q){var s=p.current;if(!s){return}r=n(r);p.direction=t||s.direction[(r>=s.index?"next":"prev")];p.router=q||"jumpto";if(s.loop){if(r<0){r=s.group.length+(r%s.group.length)}r=r%s.group.length}if(s.group[r]!==e){p.cancel();p._start(r)}},reposition:function(t,q){var s=p.current,r=s?s.wrap:null,u;if(r){u=p._getPosition(q);if(t&&t.type==="scroll"){delete u.position;r.stop(true,true).animate(u,200)}else{r.css(u);s.pos=i.extend({},s.dim,u)}}},update:function(s){var q=(s&&s.type),r=!q||q==="orientationchange";if(r){clearTimeout(c);c=null}if(!p.isOpen||c){return}c=setTimeout(function(){var t=p.current;if(!t||p.isClosing){return}p.wrap.removeClass("fancybox-tmp");if(r||q==="load"||(q==="resize"&&t.autoResize)){p._setDimension()}if(!(q==="scroll"&&t.canShrink)){p.reposition(s)}p.trigger("onUpdate");c=null},(r&&!f?0:300))},toggle:function(q){if(p.isOpen){p.current.fitToView=i.type(q)==="boolean"?q:!p.current.fitToView;if(f){p.wrap.removeAttr("style").addClass("fancybox-tmp");p.trigger("onUpdate")}p.update()}},hideLoading:function(){a.unbind(".loading");i("#fancybox-loading").remove()},showLoading:function(){var r,q;p.hideLoading();r=i('<div id="fancybox-loading"><div></div></div>').click(p.cancel).appendTo("body");a.bind("keydown.loading",function(s){if((s.which||s.keyCode)===27){s.preventDefault();p.cancel()}});if(!p.defaults.fixed){q=p.getViewport();r.css({position:"absolute",top:(q.h*0.5)+q.y,left:(q.w*0.5)+q.x})}},getViewport:function(){var q=(p.current&&p.current.locked)||false,r={x:d.scrollLeft(),y:d.scrollTop()};if(q){r.w=q[0].clientWidth;r.h=q[0].clientHeight}else{r.w=f&&l.innerWidth?l.innerWidth:d.width();r.h=f&&l.innerHeight?l.innerHeight:d.height()}return r},unbindEvents:function(){if(p.wrap&&j(p.wrap)){p.wrap.unbind(".fb")}a.unbind(".fb");d.unbind(".fb")},bindEvents:function(){var r=p.current,q;if(!r){return}d.bind("orientationchange.fb"+(f?"":" resize.fb")+(r.autoCenter&&!r.locked?" scroll.fb":""),p.update);q=r.keys;if(q){a.bind("keydown.fb",function(u){var s=u.which||u.keyCode,t=u.target||u.srcElement;if(s===27&&p.coming){return false}if(!u.ctrlKey&&!u.altKey&&!u.shiftKey&&!u.metaKey&&!(t&&(t.type||i(t).is("[contenteditable]")))){i.each(q,function(v,w){if(r.group.length>1&&w[s]!==e){p[v](w[s]);u.preventDefault();return false}if(i.inArray(s,w)>-1){p[v]();u.preventDefault();return false}})}})}if(i.fn.mousewheel&&r.mouseWheel){p.wrap.bind("mousewheel.fb",function(x,y,t,s){var w=x.target||null,u=i(w),v=false;while(u.length){if(v||u.is(".fancybox-skin")||u.is(".fancybox-wrap")){break}v=h(u[0]);u=i(u).parent()}if(y!==0&&!v){if(p.group.length>1&&!r.canShrink){if(s>0||t>0){p.prev(s>0?"down":"left")}else{if(s<0||t<0){p.next(s<0?"up":"right")}}x.preventDefault()}}})}},trigger:function(r,t){var q,s=t||p.coming||p.current;if(!s){return}if(i.isFunction(s[r])){q=s[r].apply(s,Array.prototype.slice.call(arguments,1))}if(q===false){return false}if(s.helpers){i.each(s.helpers,function(v,u){if(u&&p.helpers[v]&&i.isFunction(p.helpers[v][r])){u=i.extend(true,{},p.helpers[v].defaults,u);p.helpers[v][r](u,s)}})}a.trigger(r)},isImage:function(q){return b(q)&&q.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(q){return b(q)&&q.match(/\.(swf)((\?|#).*)?$/i)},_start:function(r){var s={},w,q,t,u,v;r=n(r);w=p.group[r]||null;if(!w){return false}s=i.extend(true,{},p.opts,w);u=s.margin;v=s.padding;if(i.type(u)==="number"){s.margin=[u,u,u,u]}if(i.type(v)==="number"){s.padding=[v,v,v,v]}if(s.modal){i.extend(true,s,{closeBtn:false,closeClick:false,nextClick:false,arrows:false,mouseWheel:false,keys:null,helpers:{overlay:{closeClick:false}}})}if(s.autoSize){s.autoWidth=s.autoHeight=true}if(s.width==="auto"){s.autoWidth=true}if(s.height==="auto"){s.autoHeight=true}s.group=p.group;s.index=r;p.coming=s;if(false===p.trigger("beforeLoad")){p.coming=null;return}t=s.type;q=s.href;if(!t){p.coming=null;if(p.current&&p.router&&p.router!=="jumpto"){p.current.index=r;return p[p.router](p.direction)}return false}p.isActive=true;if(t==="image"||t==="swf"){s.autoHeight=s.autoWidth=false;s.scrolling="visible"}if(t==="image"){s.aspectRatio=true}if(t==="iframe"&&f){s.scrolling="scroll"}s.wrap=i(s.tpl.wrap).addClass("fancybox-"+(f?"mobile":"desktop")+" fancybox-type-"+t+" fancybox-tmp "+s.wrapCSS).appendTo(s.parent||"body");i.extend(s,{skin:i(".fancybox-skin",s.wrap),outer:i(".fancybox-outer",s.wrap),inner:i(".fancybox-inner",s.wrap)});i.each(["Top","Right","Bottom","Left"],function(y,x){s.skin.css("padding"+x,g(s.padding[y]))});p.trigger("onReady");if(t==="inline"||t==="html"){if(!s.content||!s.content.length){return p._error("content")}}else{if(!q){return p._error("href")}}if(t==="image"){p._loadImage()}else{if(t==="ajax"){p._loadAjax()}else{if(t==="iframe"){p._loadIframe()}else{p._afterLoad()}}}},_error:function(q){i.extend(p.coming,{type:"html",autoWidth:true,autoHeight:true,minWidth:0,minHeight:0,scrolling:"no",hasError:q,content:p.coming.tpl.error});p._afterLoad()},_loadImage:function(){var q=p.imgPreload=new Image();q.onload=function(){this.onload=this.onerror=null;p.coming.width=this.width;p.coming.height=this.height;p._afterLoad()};q.onerror=function(){this.onload=this.onerror=null;p._error("image")};q.src=p.coming.href;if(q.complete!==true){p.showLoading()}},_loadAjax:function(){var q=p.coming;p.showLoading();p.ajaxLoad=i.ajax(i.extend({},q.ajax,{url:q.href,error:function(r,s){if(p.coming&&s!=="abort"){p._error("ajax",r)}else{p.hideLoading()}},success:function(r,s){if(s==="success"){q.content=r;p._afterLoad()}}}))},_loadIframe:function(){var q=p.coming,r=i(q.tpl.iframe.replace(/\{rnd\}/g,new Date().getTime())).attr("scrolling",f?"auto":q.iframe.scrolling).attr("src",q.href);i(q.wrap).bind("onReset",function(){try{i(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(s){}});if(q.iframe.preload){p.showLoading();r.one("load",function(){i(this).data("ready",1);if(!f){i(this).bind("load.fb",p.update)}i(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();p._afterLoad()})}q.content=r.appendTo(q.inner);if(!q.iframe.preload){p._afterLoad()}},_preloadImages:function(){var v=p.group,u=p.current,q=v.length,s=u.preload?Math.min(u.preload,q-1):0,t,r;for(r=1;r<=s;r+=1){t=v[(u.index+r)%q];if(t.type==="image"&&t.href){new Image().src=t.href}}},_afterLoad:function(){var r=p.coming,t=p.current,y="fancybox-placeholder",v,w,x,s,q,u;p.hideLoading();if(!r||p.isActive===false){return}if(false===p.trigger("afterLoad",r,t)){r.wrap.stop(true).trigger("onReset").remove();p.coming=null;return}if(t){p.trigger("beforeChange",t);t.wrap.stop(true).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()}p.unbindEvents();v=r;w=r.content;x=r.type;s=r.scrolling;i.extend(p,{wrap:v.wrap,skin:v.skin,outer:v.outer,inner:v.inner,current:v,previous:t});q=v.href;switch(x){case"inline":case"ajax":case"html":if(v.selector){w=i("<div>").html(w).find(v.selector)}else{if(j(w)){if(!w.data(y)){w.data(y,i('<div class="'+y+'"></div>').insertAfter(w).hide())}w=w.show().detach();v.wrap.bind("onReset",function(){if(i(this).find(w).length){w.hide().replaceAll(w.data(y)).data(y,false)}})}}break;case"image":w=v.tpl.image.replace("{href}",q).replace("&","&amp;");break;case"swf":w='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+q+'"></param>';u="";i.each(v.swf,function(z,A){w+='<param name="'+z+'" value="'+A+'"></param>';u+=" "+z+'="'+A+'"'});w+='<embed src="'+q+'" type="application/x-shockwave-flash" width="100%" height="100%"'+u+"></embed></object>";break}if(!(j(w)&&w.parent().is(v.inner))){v.inner.append(w)}p.trigger("beforeShow");v.inner.css("overflow",s==="yes"?"scroll":(s==="no"?"hidden":s));p._setDimension();p.reposition();p.isOpen=false;p.coming=null;p.bindEvents();if(!p.isOpened){i(".fancybox-wrap").not(v.wrap).stop(true).trigger("onReset").remove()}else{if(t.prevMethod){p.transitions[t.prevMethod]()}}p.transitions[p.isOpened?v.nextMethod:v.openMethod]();p._preloadImages()},_setDimension:function(){var T=p.getViewport(),P=0,V=false,X=false,B=p.wrap,N=p.skin,Y=p.inner,K=p.current,L=K.width,I=K.height,E=K.minWidth,x=K.minHeight,R=K.maxWidth,J=K.maxHeight,D=K.scrolling,v=K.scrollOutside?K.scrollbarWidth:0,H=K.margin,w=n(H[1]+H[3]),u=n(H[0]+H[2]),s,r,O,Q,G,F,M,z,y,U,t,W,q,A,C;B.add(N).add(Y).width("auto").height("auto").removeClass("fancybox-tmp");s=n(N.outerWidth(true)-N.width());r=n(N.outerHeight(true)-N.height());O=w+s;Q=u+r;G=m(L)?(T.w-O)*n(L)/100:L;F=m(I)?(T.h-Q)*n(I)/100:I;if(K.type==="iframe"){A=K.content;if(K.autoHeight&&A.data("ready")===1){try{if(A[0].contentWindow.document.location){Y.width(G).height(9999);C=A.contents().find("body");if(v){C.css("overflow-x","hidden")}F=C.height()}}catch(S){}}}else{if(K.autoWidth||K.autoHeight){Y.addClass("fancybox-tmp");if(!K.autoWidth){Y.width(G)}if(!K.autoHeight){Y.height(F)}if(K.autoWidth){G=Y.width()}if(K.autoHeight){F=Y.height()}Y.removeClass("fancybox-tmp")}}L=n(G);I=n(F);y=G/F;E=n(m(E)?n(E,"w")-O:E);R=n(m(R)?n(R,"w")-O:R);x=n(m(x)?n(x,"h")-Q:x);J=n(m(J)?n(J,"h")-Q:J);M=R;z=J;if(K.fitToView){R=Math.min(T.w-O,R);J=Math.min(T.h-Q,J)}W=T.w-w;q=T.h-u;if(K.aspectRatio){if(L>R){L=R;I=n(L/y)}if(I>J){I=J;L=n(I*y)}if(L<E){L=E;I=n(L/y)}if(I<x){I=x;L=n(I*y)}}else{L=Math.max(E,Math.min(L,R));if(K.autoHeight&&K.type!=="iframe"){Y.width(L);I=Y.height()}I=Math.max(x,Math.min(I,J))}if(K.fitToView){Y.width(L).height(I);B.width(L+s);U=B.width();t=B.height();if(K.aspectRatio){while((U>W||t>q)&&L>E&&I>x){if(P++>19){break}I=Math.max(x,Math.min(J,I-10));L=n(I*y);if(L<E){L=E;I=n(L/y)}if(L>R){L=R;I=n(L/y)}Y.width(L).height(I);B.width(L+s);U=B.width();t=B.height()}}else{L=Math.max(E,Math.min(L,L-(U-W)));I=Math.max(x,Math.min(I,I-(t-q)))}}if(v&&D==="auto"&&I<F&&(L+s+v)<W){L+=v}Y.width(L).height(I);B.width(L+s);U=B.width();t=B.height();V=(U>W||t>q)&&L>E&&I>x;X=K.aspectRatio?(L<M&&I<z&&L<G&&I<F):((L<M||I<z)&&(L<G||I<F));i.extend(K,{dim:{width:g(U),height:g(t)},origWidth:G,origHeight:F,canShrink:V,canExpand:X,wPadding:s,hPadding:r,wrapSpace:t-N.outerHeight(true),skinSpace:N.height()-I});if(!A&&K.autoHeight&&I>x&&I<J&&!X){Y.height("auto")}},_getPosition:function(s){var w=p.current,r=p.getViewport(),u=w.margin,t=p.wrap.width()+u[1]+u[3],q=p.wrap.height()+u[0]+u[2],v={position:"absolute",top:u[0],left:u[3]};if(w.autoCenter&&w.fixed&&!s&&q<=r.h&&t<=r.w){v.position="fixed"}else{if(!w.locked){v.top+=r.y;v.left+=r.x}}v.top=g(Math.max(v.top,v.top+((r.h-q)*w.topRatio)));v.left=g(Math.max(v.left,v.left+((r.w-t)*w.leftRatio)));return v},_afterZoomIn:function(){var q=p.current;if(!q){return}p.isOpen=p.isOpened=true;p.wrap.css("overflow","visible").addClass("fancybox-opened");p.update();if(q.closeClick||(q.nextClick&&p.group.length>1)){p.inner.css("cursor","pointer").bind("click.fb",function(r){if(!i(r.target).is("a")&&!i(r.target).parent().is("a")){r.preventDefault();p[q.closeClick?"close":"next"]()}})}if(q.closeBtn){i(q.tpl.closeBtn).appendTo(p.skin).bind("click.fb",function(r){r.preventDefault();p.close()})}if(q.arrows&&p.group.length>1){if(q.loop||q.index>0){i(q.tpl.prev).appendTo(p.outer).bind("click.fb",p.prev)}if(q.loop||q.index<p.group.length-1){i(q.tpl.next).appendTo(p.outer).bind("click.fb",p.next)}}p.trigger("afterShow");if(!q.loop&&q.index===q.group.length-1){p.play(false)}else{if(p.opts.autoPlay&&!p.player.isActive){p.opts.autoPlay=false;p.play()}}},_afterZoomOut:function(q){q=q||p.current;i(".fancybox-wrap").trigger("onReset").remove();i.extend(p,{group:{},opts:{},router:false,current:null,isActive:false,isOpened:false,isOpen:false,isClosing:false,wrap:null,skin:null,outer:null,inner:null});p.trigger("afterClose",q)}});p.transitions={getOrigPosition:function(){var t=p.current,r=t.element,w=t.orig,v={},q=50,x=50,u=t.hPadding,y=t.wPadding,s=p.getViewport();if(!w&&t.isDom&&r.is(":visible")){w=r.find("img:first");if(!w.length){w=r}}if(j(w)){v=w.offset();if(w.is("img")){q=w.outerWidth();x=w.outerHeight()}}else{v.top=s.y+(s.h-x)*t.topRatio;v.left=s.x+(s.w-q)*t.leftRatio}if(p.wrap.css("position")==="fixed"||t.locked){v.top-=s.y;v.left-=s.x}v={top:g(v.top-u*t.topRatio),left:g(v.left-y*t.leftRatio),width:g(q+y),height:g(x+u)};return v},step:function(r,s){var u,w,x,q=s.prop,t=p.current,v=t.wrapSpace,y=t.skinSpace;if(q==="width"||q==="height"){u=s.end===s.start?1:(r-s.start)/(s.end-s.start);if(p.isClosing){u=1-u}w=q==="width"?t.wPadding:t.hPadding;x=r-w;p.skin[q](n(q==="width"?x:x-(v*u)));p.inner[q](n(q==="width"?x:x-(v*u)-(y*u)))}},zoomIn:function(){var u=p.current,r=u.pos,s=u.openEffect,t=s==="elastic",q=i.extend({opacity:1},r);delete q.position;if(t){r=this.getOrigPosition();if(u.openOpacity){r.opacity=0.1}}else{if(s==="fade"){r.opacity=0.1}}p.wrap.css(r).animate(q,{duration:s==="none"?0:u.openSpeed,easing:u.openEasing,step:t?this.step:null,complete:p._afterZoomIn})},zoomOut:function(){var t=p.current,r=t.closeEffect,s=r==="elastic",q={opacity:0.1};if(s){q=this.getOrigPosition();if(t.closeOpacity){q.opacity=0.1}}p.wrap.animate(q,{duration:r==="none"?0:t.closeSpeed,easing:t.closeEasing,step:s?this.step:null,complete:p._afterZoomOut})},changeIn:function(){var v=p.current,s=v.nextEffect,r=v.pos,q={opacity:1},u=p.direction,w=200,t;r.opacity=0.1;if(s==="elastic"){t=u==="down"||u==="up"?"top":"left";if(u==="down"||u==="right"){r[t]=g(n(r[t])-w);q[t]="+="+w+"px"}else{r[t]=g(n(r[t])+w);q[t]="-="+w+"px"}}if(s==="none"){p._afterZoomIn()}else{p.wrap.css(r).animate(q,{duration:v.nextSpeed,easing:v.nextEasing,complete:p._afterZoomIn})}},changeOut:function(){var s=p.previous,r=s.prevEffect,q={opacity:0.1},t=p.direction,u=200;if(r==="elastic"){q[t==="down"||t==="up"?"top":"left"]=(t==="up"||t==="left"?"-":"+")+"="+u+"px"}s.wrap.animate(q,{duration:r==="none"?0:s.prevSpeed,easing:s.prevEasing,complete:function(){i(this).trigger("onReset").remove()}})}};p.helpers.overlay={defaults:{closeClick:true,speedOut:200,showEarly:true,css:{},locked:!f,fixed:true},overlay:null,fixed:false,create:function(q){q=i.extend({},this.defaults,q);if(this.overlay){this.close()}this.overlay=i('<div class="fancybox-overlay"></div>').appendTo("body");this.fixed=false;if(q.fixed&&p.defaults.fixed){this.overlay.addClass("fancybox-overlay-fixed");this.fixed=true}},open:function(r){var q=this;r=i.extend({},this.defaults,r);if(this.overlay){this.overlay.unbind(".overlay").width("auto").height("auto")}else{this.create(r)}if(!this.fixed){d.bind("resize.overlay",i.proxy(this.update,this));this.update()}if(r.closeClick){this.overlay.bind("click.overlay",function(s){if(i(s.target).hasClass("fancybox-overlay")){if(p.isActive){p.close()}else{q.close()}}})}this.overlay.css(r.css).show()},close:function(){i(".fancybox-overlay").remove();d.unbind("resize.overlay");this.overlay=null;if(this.margin!==false){i("body").css("margin-right",this.margin);this.margin=false}if(this.el){this.el.removeClass("fancybox-lock")}},update:function(){var r="100%",q;this.overlay.width(r).height("100%");if(k){q=Math.max(o.documentElement.offsetWidth,o.body.offsetWidth);if(a.width()>q){r=a.width()}}else{if(a.width()>d.width()){r=a.width()}}this.overlay.width(r).height(a.height())},onReady:function(q,r){i(".fancybox-overlay").stop(true,true);if(!this.overlay){this.margin=a.height()>d.height()||i("body").css("overflow-y")==="scroll"?i("body").css("margin-right"):false;this.el=o.all&&!o.querySelector?i("html"):i("body");this.create(q)}if(q.locked&&this.fixed){r.locked=this.overlay.append(r.wrap);r.fixed=false}if(q.showEarly===true){this.beforeShow.apply(this,arguments)}},beforeShow:function(q,r){if(r.locked){this.el.addClass("fancybox-lock");if(this.margin!==false){i("body").css("margin-right",n(this.margin)+r.scrollbarWidth)}}this.open(q)},onUpdate:function(){if(!this.fixed){this.update()}},afterClose:function(q){if(this.overlay&&!p.isActive){this.overlay.fadeOut(q.speedOut,i.proxy(this.close,this))}}};p.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(r){var t=p.current,v=t.title,q=r.type,u,s;if(i.isFunction(v)){v=v.call(t.element,t)}if(!b(v)||i.trim(v)===""){return}u=i('<div class="fancybox-title fancybox-title-'+q+'-wrap">'+v+"</div>");switch(q){case"inside":s=p.skin;break;case"outside":s=p.wrap;break;case"over":s=p.inner;break;default:s=p.skin;u.appendTo("body");if(k){u.width(u.width())}u.wrapInner('<span class="child"></span>');p.current.margin[2]+=Math.abs(n(u.css("margin-bottom")));break}u[(r.position==="top"?"prependTo":"appendTo")](s)}};i.fn.fancybox=function(s){var r,t=i(this),q=this.selector||"",u=function(y){var x=i(this).blur(),v=r,w,z;if(!(y.ctrlKey||y.altKey||y.shiftKey||y.metaKey)&&!x.is(".fancybox-wrap")){w=s.groupAttr||"data-fancybox-group";z=x.attr(w);if(!z){w="rel";z=x.get(0)[w]}if(z&&z!==""&&z!=="nofollow"){x=q.length?i(q):t;x=x.filter("["+w+'="'+z+'"]');v=x.index(this)}s.index=v;if(p.open(x,s)!==false){y.preventDefault()}}};s=s||{};r=s.index||0;if(!q||s.live===false){t.unbind("click.fb-start").bind("click.fb-start",u)}else{a.undelegate(q,"click.fb-start").delegate(q+":not('.fancybox-item, .fancybox-nav')","click.fb-start",u)}this.filter("[data-fancybox-start=1]").trigger("click");return this};a.ready(function(){if(i.scrollbarWidth===e){i.scrollbarWidth=function(){var r=i('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),s=r.children(),q=s.innerWidth()-s.height(99).innerWidth();r.remove();return q}}if(i.support.fixedPosition===e){i.support.fixedPosition=(function(){var r=i('<div style="position:fixed;top:20px;"></div>').appendTo("body"),q=(r[0].offsetTop===20||r[0].offsetTop===15);r.remove();return q}())}i.extend(p.defaults,{scrollbarWidth:i.scrollbarWidth(),fixed:i.support.fixedPosition,parent:i("body")})})}(window,document,jQuery));