text: /*!
   * Galereya v0.9.94
   * http://vodkabears.github.com/galereya
   *
   * Licensed under the MIT license
   * Copyright (c) 2013, VodkaBears
   */
  !function(a){"use strict";function b(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=this,w=a([]),x=a([]),y=a([]),z=a([]),A=[],B=[],C=[],D=[],E=0,F=300,G=300,H=!1,I={spacing:0,wave:!0,waveTimeout:300,modifier:"",slideShowSpeed:1e4,cellFadeInSpeed:200,noCategoryName:"all",disableSliderOnClick:!1,load:function(a){a()},onCellClick:function(){}},J={windowResize:function(){Z()},bodyClick:function(b){0===a(b.target).closest(".galereya-cats").length&&x.removeClass("open")},categoriesListClick:function(b){var c=a(b.target),d=b.target.nodeName;"SPAN"===d&&(c=c.parent()),c.is(":first-child")||Y(c.find("span").text()),x.toggleClass("open")},cellClick:function(a){v.options.disableSliderOnClick||$(parseInt(this.getAttribute("data-visibleIndex"),10)),v.options.onCellClick(a)},sliderNextClick:function(){bb("next")},sliderPrevClick:function(){bb("prev")},sliderCloseClick:function(){_()},sliderPlayClick:function(){u?fb():eb()},bodyKeyDown:function(a){H&&(37===a.which||39===a.which)&&a.preventDefault()},bodyKeyUp:function(a){if(H)switch(a.which){case 27:_();break;case 37:i.click();break;case 39:h.click()}}},K=function(){v.addClass("galereya").addClass(v.options.modifier),R(function(){S(),Z(),T(),v.options.wave&&L()&&X(),gb()})},L=function(){var a=document.createElement("div").style,b="transition"in a||"WebkitTransition"in a||"MozTransition"in a||"msTransition"in a||"OTransition"in a;return b},M=function(a){var b=a.css("transitionDuration")||a.css("webkitTransitionDuration")||a.css("mozTransitionDuration")||a.css("oTransitionDuration")||a.css("msTransitionDuration")||0;return b=1e3*parseFloat(b)},N=function(){F=w.width(),G=w.height(),E=Math.floor((v.width()-10)/(F+v.options.spacing)),1>E&&(E=1),o=E*F+(E-1)*v.options.spacing,p=Math.ceil(e.length/E)*G},O=function(b){var c=a(document.createElement("img")).attr("src",b);return v.append(c),e=e.add(c),c},P=function(a,b){var c=a.addClass("galereya-cell-img").wrap('<div class="galereya-cell" data-index="'+w.length+'"></div>').parent().append('<div class="galereya-cell-desc">                                <div class="galereya-cell-desc-title">'+b.title+'</div>                                <div class="galereya-cell-desc-text">'+b.description+"</div>                            </div>").append('<div class="galereya-cell-overlay" />');return c.click(J.cellClick),w=w.add(c),d.append(c),c},Q=function(b){var c={lowsrc:b.lowsrc||"",fullsrc:b.fullsrc||"",title:b.title||"",description:b.description||"",category:b.category||""};return c.category&&(c.category=c.category.toLowerCase(),-1===a.inArray(c.category,B)&&B.push(c.category)),A.push(c),c},R=function(a){var b;e=v.find("img").each(function(a,c){b={lowsrc:c.getAttribute("src")||"",fullsrc:c.getAttribute("data-fullsrc")||"",title:c.getAttribute("title")||c.getAttribute("alt")||"",description:c.getAttribute("data-desc")||"",category:c.getAttribute("data-category")||""},Q(b)}),v.options.load(function(b){if(b&&b.length)for(var c,d=0,e=b.length;e>d;d++)c=Q(b[d]),O(c.lowsrc);a()})},S=function(){if(B.length>0){x=a('<ul class="galereya-cats" />'),c=a('<div class="galereya-top" />'),v.prepend(c.html(x)),x.append('<li class="galereya-cats-item"><span>'+v.options.noCategoryName+"</span></li>");for(var b=0;b<B.length;b++)x.append('<li class="galereya-cats-item"><span>'+B[b]+"</span></li>")}var m,n,o;e.wrapAll('<div class="galereya-grid" />').each(function(b,c){m=a(c),n=A[b].title,o=A[b].description,m.addClass("galereya-cell-img").wrap('<div class="galereya-cell" data-index="'+b+'"></div>').parent().append('<div class="galereya-cell-desc">                                <div class="galereya-cell-desc-title">'+n+'</div>                                <div class="galereya-cell-desc-text">'+o+"</div>                            </div>").append('<div class="galereya-cell-overlay" />')}),w=v.find(".galereya-cell"),d=v.find(".galereya-grid"),f=a('<div class="galereya-slider" />'),g=a('<div class="galereya-slider-container" />'),h=a('<div class="galereya-slider-nav right" />'),i=a('<div class="galereya-slider-nav left" />'),j=a('<div class="galereya-slider-desc" />'),k=a('<div class="galereya-slider-close" />'),l=a('<div class="galereya-slider-play" />'),f.addClass(v.options.modifier).append(g).append(h).append(i).append(j).append(j).append(k).append(l),a(document.body).append(f),v.show()},T=function(b,c){if(b=b||0,!(b>=e.length)){if(clearTimeout(r),c&&A[b].category!==c)return void setTimeout(function(){T(++b,c)},0);var d=e[b],f=function(){H?a(this).parent().show():a(this).parent().fadeIn(v.options.cellFadeInSpeed,"linear"),r=setTimeout(function(){T(++b,c)},v.options.cellFadeInSpeed/2)};d.complete?f.call(d):a(d).attr("src",d.src).load(f),U(b)}},U=function(b){var c,d=w[b];V(d,C.length),c=C.push(d)-1,a(d).addClass("visible").attr("data-visibleIndex",c)},V=function(a,b){var c,e,f,g;g=b%E,c=g*F+v.options.spacing*g,b>=E?(f=C[b-E],e=f.offsetTop+f.offsetHeight+v.options.spacing):e=0;var h=e+a.offsetHeight;h>p&&(p=h,d.height(p+d[0].offsetTop)),a.style.top=e+"px",a.style.left=c+"px"},W=function(){C=[],p=0,w.stop(!0,!0).fadeOut(200).removeClass("visible")},X=function(b){b=b||0,b>=w.length&&(b=0);var c=a(w[b]);c.addClass("wave"),setTimeout(function(){c.removeClass("wave"),X(++b)},v.options.waveTimeout)},Y=function(a){t=a,x.empty().prepend('<li class="galereya-cats-item"><span>'+a+"</span></li>"),W(),a===v.options.noCategoryName?T(0):(x.append('<li class="galereya-cats-item"><span>'+v.options.noCategoryName+"</span></li>"),T(0,a));for(var b,c=0,d=B.length;d>c;c++)b=B[c],b!==a&&x.append('<li class="galereya-cats-item"><span>'+b+"</span></li>")},Z=function(){N(),0===z.length&&(z=y.find(".galereya-slide-img")),z.css("margin-top",(a(window).height()-z.height())/2),d.width(o),p=0;for(var b=0,c=C.length;c>b;b++)V(C[b],b)},$=function(b){if(H)return void setTimeout(function(){$(b)},50);fb(),g.empty(),s=b;var c=M(f),d=function(){m=a("html").css("overflow"),n=a("body").css("overflow"),q=a(window).scrollTop(),a("html, body").css("overflow","hidden")};f.show(0,function(){f.addClass("opened"),L()?setTimeout(d,c+50):d()}),H=!0,bb(),db()},_=function(){if(H){a("html").css("overflow",m),a("body").css("overflow",n),a(window).scrollTop(q);var b=M(f),c=function(){fb(),D=[],g.empty(),f.hide(),H=!1};f.removeClass("opened"),L()?setTimeout(c,b+50):c()}},ab=function(b){clearInterval(u);var c,d,e=C[b],f=parseInt(e.getAttribute("data-index"),10);return c=a('<div class="galereya-slider-slide" />').html('<div class="galereya-slide-loader"></div>'),d=a('<img class="galereya-slide-img" src="'+A[f].fullsrc+'" alt="'+A[f].title+'" />').load(function(){c.html(d),d.css("margin-top",(a(window).height()-d.height())/2),u&&eb()}),c},bb=function(b){b=b||"next",u&&(fb(),eb());var c,d,e,f=b.toLowerCase(),h=C.length;if("next"===f){if(0===D.length)c=s,f="";else if(c=s+1,c>=h)return;d=D[c],d||(d=ab(c),d.addClass(f),g.append(d),D[c]=d),cb(d,"current"),cb(y,"prev")}else if("prev"===f){if(0!==D.length&&(f=""),c=s-1,0>c)return;d=D[c],d||(d=ab(c),d.addClass(f),g.prepend(d),D[c]=d),cb(d,"current"),cb(y,"next")}s=c,y=d,e=C[s].getAttribute("data-index"),j.empty().html('<div class="galereya-slider-desc-title">'+A[e].title+" </div>"+A[e].description),z=d.find(".galereya-slide-img"),z.css("margin-top",(a(window).height()-z.height())/2),db()},cb=function(a,b){setTimeout(function(){a.removeClass("prev").removeClass("next").removeClass("current").addClass(b)},50)},db=function(){var a=C.length;s>=a-1?(fb(),l.hide(),h.hide()):(l.show(),h.show()),0>=s?i.hide():i.show()},eb=function(){l.addClass("pause"),u=setInterval(function(){h.click()},v.options.slideShowSpeed)},fb=function(){l.removeClass("pause"),clearInterval(u),u=null},gb=function(){a(window).bind("resize",J.windowResize),a(document.body).click(J.bodyClick).keydown(J.bodyKeyDown).keyup(J.bodyKeyUp),x.click(J.categoriesListClick),w.click(J.cellClick),h.click(J.sliderNextClick),i.click(J.sliderPrevClick),k.click(J.sliderCloseClick),l.click(J.sliderPlayClick)};return this.options=a.extend({},I,b),this.openSlider=$,this.closeSlider=_,this.changeCategory=Y,this.startSlideShow=eb,this.stopSlideShow=fb,this.nextSlide=function(){h.click()},this.prevSlide=function(){i.click()},this.loadMore=function(a){if(a&&a.length){for(var b,c,d=0,e=w.length,f=e,g=a.length;g>d;d++,f++)b=Q(a[d]),c=O(b.lowsrc),P(c,b);T(e,t)}},K(),this.length>1&&this.each(function(){a(this).galereya(b)}),this}a.fn.galereya=b}(jQuery);