/*
* venobox - jquery plugin
* version: 1.8.2
* @requires jquery >= 1.7.0
*
* examples at http://veno.es/venobox/
* license: mit license
* license uri: https://github.com/nicolafranchini/venobox/blob/master/license
* copyright 2013-2018 nicola franchini - @nicolafranchini
*
*/
!function(e){"use strict";var o,t,a,i,s,n,c,r,d,l,v,u,b,p,m,f,h,g,k,x,y,w,c,_,p,b,e,o,u,d,m,n,v,z,r,x,y,j,w,q;e.fn.extend({venobox:function($){var i=this,a={arrowscolor:"#b6b6b6",autoplay:!1,bgcolor:"#fff",border:"0",closebackground:"#161617",closecolor:"#d2d2d2",framewidth:"",frameheight:"",infinigall:!1,htmlclose:"×",htmlnext:"next",htmlprev:"prev",numeratio:!1,numerationbackground:"#161617",numerationcolor:"#d2d2d2",numerationposition:"top",overlayclose:!0,overlaycolor:"rgba(23,23,23,0.85)",spinner:"double-bounce",spincolor:"#d2d2d2",titleattr:"title",titlebackground:"#161617",titlecolor:"#d2d2d2",titleposition:"top",cb_pre_open:function(){return!0},cb_post_open:function(){},cb_pre_close:function(){return!0},cb_post_close:function(){},cb_post_resize:function(){},cb_after_nav:function(){},cb_init:function(){}},h=e.extend(a,$);return h.cb_init(i),this.each(function(){function $(){y=o.data("gall"),h=o.data("numeratio"),b=o.data("infinigall"),p=e('.vbox-item[data-gall="'+y+'"]'),w=p.eq(p.index(o)+1),c=p.eq(p.index(o)-1),w.length||b!==!0||(w=p.eq(0)),p.length>1?(u=p.index(o)+1,a.html(u+" / "+p.length)):u=1,h===!0?a.show():a.hide(),""!==x?i.show():i.hide(),w.length||b===!0?(e(".vbox-next").css("display","block"),_=!0):(e(".vbox-next").css("display","none"),_=!1),p.index(o)>0||b===!0?(e(".vbox-prev").css("display","block"),p=!0):(e(".vbox-prev").css("display","none"),p=!1),(p===!0||_===!0)&&(r.on(ne.down,t),r.on(ne.move,z),r.on(ne.up,f))}function a(e){return e.length<1?!1:m?!1:(m=!0,g=e.data("overlay")||e.data("overlaycolor"),v=e.data("framewidth"),u=e.data("frameheight"),s=e.data("border"),t=e.data("bgcolor"),d=e.data("href")||e.attr("href"),o=e.data("autoplay"),x=e.attr(e.data("titleattr"))||"",e===c&&r.addclass("animated").addclass("swipe-right"),e===w&&r.addclass("animated").addclass("swipe-left"),void r.animate({opacity:0},500,function(){k.css("background",g),r.removeclass("animated").removeclass("swipe-left").removeclass("swipe-right").css({"margin-left":0,"margin-right":0}),"iframe"==e.data("vbtype")?j():"inline"==e.data("vbtype")?oe():"ajax"==e.data("vbtype")?g():"video"==e.data("vbtype")||"vimeo"==e.data("vbtype")||"youtube"==e.data("vbtype")?k(o):(r.html(''),te()),o=e,$(),m=!1,h.cb_after_nav(o,u,w,c)}))}function q(e){27===e.keycode&&s(),37==e.keycode&&p===!0&&a(c),39==e.keycode&&_===!0&&a(w)}function s(){var o=h.cb_pre_close(o,u,w,c);return o===!1?!1:(e("body").off("keydown",q).removeclass("vbox-open"),o.focus(),void k.animate({opacity:0},500,function(){k.remove(),m=!1,h.cb_post_close()}))}function t(e){r.addclass("animated"),v=r=e.pagey,z=x=e.pagex,d=!0}function z(e){if(d===!0){x=e.pagex,r=e.pagey,j=x-z,w=r-v;var o=math.abs(j),t=math.abs(w);o>t&&100>=o&&(e.preventdefault(),r.css("margin-left",j))}}function f(e){if(d===!0){d=!1;var o=o,t=!1;y=x-z,0>y&&_===!0&&(o=w,t=!0),y>0&&p===!0&&(o=c,t=!0),math.abs(y)>=q&&t===!0?a(o):r.css({"margin-left":0,"margin-right":0})}}function g(){e.ajax({url:d,cache:!1}).done(function(e){r.html('
'+e+"
"),te()}).fail(function(){r.html('error retrieving contents, please retry
'),ae()})}function j(){r.html(''),ae()}function k(e){var o,t=l(d),a=e?"?rel=0&autoplay=1":"?rel=0",i=a+ee(d);"vimeo"==t.type?o="https://player.vimeo.com/video/":"youtube"==t.type&&(o="https://www.youtube.com/embed/"),r.html(''),ae()}function l(e){if(e.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([a-za-z0-9._%-]*)(\&\s+)?/),regexp.$3.indexof("youtu")>-1)var o="youtube";else if(regexp.$3.indexof("vimeo")>-1)var o="vimeo";return{type:o,id:regexp.$6}}function ee(e){var o="",t=decodeuricomponent(e),a=t.split("?");if(void 0!==a[1]){var i,s,n=a[1].split("&");for(s=0;s'+e(d).html()+""),ae()}function te(){n=r.find("img"),n.length?n.each(function(){e(this).one("load",function(){ae()})}):ae()}function ae(){i.html(x),r.find(">:first-child").addclass("figlio").css({width:v,height:u,padding:s,background:t}),e("img.figlio").on("dragstart",function(e){e.preventdefault()}),ie(),r.animate({opacity:"1"},"slow",function(){})}function ie(){var o=r.outerheight(),t=e(window).height();f=t>o+60?(t-o)/2:"30px",r.css("margin-top",f),r.css("margin-bottom",f),h.cb_post_resize()}if(o=e(this),o.data("venobox"))return!0;i.vbclose=function(){s()},o.addclass("vbox-item"),o.data("framewidth",h.framewidth),o.data("frameheight",h.frameheight),o.data("border",h.border),o.data("bgcolor",h.bgcolor),o.data("numeratio",h.numeratio),o.data("infinigall",h.infinigall),o.data("overlaycolor",h.overlaycolor),o.data("titleattr",h.titleattr),o.data("venobox",!0),o.on("click",function(b){b.preventdefault(),o=e(this);var p=h.cb_pre_open(o);if(p===!1)return!1;switch(i.vbnext=function(){a(w)},i.vbprev=function(){a(c)},g=o.data("overlay")||o.data("overlaycolor"),v=o.data("framewidth"),u=o.data("frameheight"),o=o.data("autoplay")||h.autoplay,s=o.data("border"),t=o.data("bgcolor"),_=!1,p=!1,m=!1,d=o.data("href")||o.attr("href"),l=o.data("css")||"",x=o.attr(o.data("titleattr"))||"",b='',h.spinner){case"rotating-plane":b+='
';break;case"double-bounce":b+='
';break;case"wave":b+='
';break;case"wandering-cubes":b+='
';break;case"spinner-pulse":b+='
';break;case"three-bounce":b+='
';break;case"cube-grid":b+='
'}return b+="
",e=''+h.htmlnext+''+h.htmlprev+"",m='0/0
'+h.htmlclose+"
",n='",e("body").append(n).addclass("vbox-open"),e(".vbox-preloader .sk-child, .vbox-preloader .sk-rotating-plane, .vbox-preloader .sk-rect, .vbox-preloader .sk-cube, .vbox-preloader .sk-spinner-pulse").css("background-color",h.spincolor),k=e(".vbox-overlay"),c=e(".vbox-container"),r=e(".vbox-content"),a=e(".vbox-num"),i=e(".vbox-title"),i.css(h.titleposition,"-1px"),i.css({color:h.titlecolor,"background-color":h.titlebackground}),e(".vbox-close").css({color:h.closecolor,"background-color":h.closebackground}),e(".vbox-num").css(h.numerationposition,"-1px"),e(".vbox-num").css({color:h.numerationcolor,"background-color":h.numerationbackground}),e(".vbox-next span, .vbox-prev span").css({"border-top-color":h.arrowscolor,"border-right-color":h.arrowscolor}),r.html(""),r.css("opacity","0"),k.css("opacity","0"),$(),k.animate({opacity:1},250,function(){"iframe"==o.data("vbtype")?j():"inline"==o.data("vbtype")?oe():"ajax"==o.data("vbtype")?g():"video"==o.data("vbtype")||"vimeo"==o.data("vbtype")||"youtube"==o.data("vbtype")?k(o):(r.html(''),te()),h.cb_post_open(o,u,w,c)}),e("body").keydown(q),e(".vbox-prev").on("click",function(){a(c)}),e(".vbox-next").on("click",function(){a(w)}),!1});var se=".vbox-overlay";h.overlayclose||(se=".vbox-close"),e(document).on("click",se,function(o){(e(o.target).is(".vbox-overlay")||e(o.target).is(".vbox-content")||e(o.target).is(".vbox-close")||e(o.target).is(".vbox-preloader"))&&s()}),z=0,x=0,y=0,q=50,d=!1;var ne={down:"touchmousedown",up:"touchmouseup",move:"touchmousemove"},ce=function(o){var t;switch(o.type){case"mousedown":t=ne.down;break;case"mouseup":t=ne.up;break;case"mouseout":t=ne.up;break;case"mousemove":t=ne.move;break;default:return}var a=de(t,o,o.pagex,o.pagey);e(o.target).trigger(a)},re=function(o){var t;switch(o.type){case"touchstart":t=ne.down;break;case"touchend":t=ne.up;break;case"touchmove":t=ne.move;break;default:return}var a,i=o.originalevent.touches[0];a=t==ne.up?de(t,o,null,null):de(t,o,i.pagex,i.pagey),e(o.target).trigger(a)},de=function(o,t,a,i){return e.event(o,{pagex:a,pagey:i,originalevent:t})};"ontouchstart"in window?(e(document).on("touchstart",re),e(document).on("touchmove",re),e(document).on("touchend",re)):(e(document).on("mousedown",ce),e(document).on("mouseup",ce),e(document).on("mouseout",ce),e(document).on("mousemove",ce)),e(window).resize(function(){e(".vbox-content").length&&settimeout(ie(),800)})})}})}(jquery);