function MarkerClusterer(n,t,i){var r,u;this.extend(MarkerClusterer,google.maps.OverlayView);this.map_=n;this.markers_=[];this.clusters_=[];this.sizes=[53,56,66,78,90];this.styles_=[];this.ready_=!1;r=i||{};this.gridSize_=r.gridSize||60;this.minClusterSize_=r.minimumClusterSize||2;this.maxZoom_=r.maxZoom||null;this.styles_=r.styles||[];this.imagePath_=r.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_;this.imageExtension_=r.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_;this.zoomOnClick_=!0;r.zoomOnClick!=undefined&&(this.zoomOnClick_=r.zoomOnClick);this.averageCenter_=!1;r.averageCenter!=undefined&&(this.averageCenter_=r.averageCenter);this.setupStyles_();this.setMap(n);this.prevZoom_=this.map_.getZoom();u=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var n=u.map_.getZoom(),t=u.map_.minZoom||0,i=Math.min(u.map_.maxZoom||100,u.map_.mapTypes[u.map_.getMapTypeId()].maxZoom);n=Math.min(Math.max(n,t),i);u.prevZoom_!=n&&(u.prevZoom_=n,u.resetViewport())});google.maps.event.addListener(this.map_,"idle",function(){u.redraw()});t&&(t.length||Object.keys(t).length)&&this.addMarkers(t,!1)}function Cluster(n){this.markerClusterer_=n;this.map_=n.getMap();this.gridSize_=n.getGridSize();this.minClusterSize_=n.getMinClusterSize();this.averageCenter_=n.isAverageCenter();this.center_=null;this.markers_=[];this.bounds_=null;this.clusterIcon_=new ClusterIcon(this,n.getStyles(),n.getGridSize())}function ClusterIcon(n,t,i){n.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView);this.styles_=t;this.padding_=i||0;this.cluster_=n;this.center_=null;this.map_=n.getMap();this.div_=null;this.sums_=null;this.visible_=!1;this.setMap(this.map_)}function debugLine(n,t,i){var r,f,u,e;if(n===!0&&(n="true"),n===!1&&(n="false"),r=n,typeof n=="object"){r="";for(name in n)f=n[name],r+=" "+name+": "+f}t!=!0||i||(r+=" "+Math.random());i==!0&&(u=jQuery("#debug_line"),u.width(200),u.height()>=500&&u.html(""),e=u.html(),r=e+"<br> -------------- <br>"+r);jQuery("#debug_line").show().html(r)}function debugSide(n){var t="",i;for(name in n)i=n[name],t+=name+" : "+i+"<br>";jQuery("#debug_side").show().html(t)}function trace(n){typeof console!="undefined"&&console.log(n)}function UGFunctions(){function u(n,t,i){t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent?t.attachEvent("on"+n,i):t[n]=i}var i=null,n=this,t={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};this.debugVar="";this.z__________FULL_SCREEN___________=function(){};this.toFullscreen=function(n){if(n.requestFullscreen)n.requestFullscreen();else if(n.mozRequestFullScreen)n.mozRequestFullScreen();else if(n.webkitRequestFullscreen)n.webkitRequestFullscreen();else if(n.msRequestFullscreen)n.msRequestFullscreen();else return!1;return!0};this.exitFullscreen=function(){if(n.isFullScreen()==!1)return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.msExitFullscreen)document.msExitFullscreen();else return!1;return!0};this.addFullScreenChangeEvent=function(n){document.webkitCancelFullScreen?u("webkitfullscreenchange",document,n):document.msExitFullscreen?u("MSFullscreenChange",document,n):document.mozCancelFullScreen?u("mozfullscreenchange",document,n):u("fullscreenchange",document,n)};this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange");jQuery(document).unbind("mozfullscreenchange");jQuery(document).unbind("webkitfullscreenchange");jQuery(document).unbind("MSFullscreenChange")};this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement};this.isFullScreen=function(){var n=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return n?!0:!1};this.z__________GET_PROPS___________=function(){};this.getBrowserPrefix=function(){var t,r,u,n;if(i!==null)return i;t=["webkit","Moz","ms","O"];r=document.createElement("div");for(u in t)if(n=t[u],n+"Transform"in r.style)return n=n.toLowerCase(),i=n,n;return i="",""};this.getImageInsideParentDataByImage=function(t,i,r){var f=t.parent(),u=n.getImageOriginalSize(t);return n.getImageInsideParentData(f,u.width,u.height,i,r)};this.getImageInsideParentData=function(n,t,i,r,u,f,e){var u,l,f,e,a;u||(u={});l={};typeof f=="undefined"&&(f=n.width());typeof e=="undefined"&&(e=n.height());u.padding_left&&(f-=u.padding_left);u.padding_right&&(f-=u.padding_right);u.padding_top&&(e-=u.padding_top);u.padding_bottom&&(e-=u.padding_bottom);var o=null,s="100%",h=null,c=null,v="display:block;margin:0px auto;";return t>0&&i>0&&(r=="down"&&t<f&&i<e?(s=i,o=t,c=(f-o)/2,h=(e-s)/2):r=="fill"?(a=t/i,s=e,o=s*a,o<f?(o=f,s=o/a,c=0,h=Math.round((s-e)/-2)):(h=0,c=Math.round((o-f)/-2))):(a=t/i,s=e,o=s*a,h=0,c=(f-o)/2,r!="fitvert"&&o>f&&(o=f,s=o/a,c=0,h=(e-s)/2)),o=Math.floor(o),s=Math.floor(s),h=Math.floor(h),c=Math.floor(c),v="position:absolute;"),u.padding_top&&(h+=u.padding_top),u.padding_left&&(c+=u.padding_left),l.imageWidth=o,l.imageHeight=s,l.imageTop=h,l.imageLeft=c,l.imageRight=c+o,l.imageBottom=h==0||s=="100%"?null:h+s,l.style=v,l};this.getElementCenterPosition=function(t,i){var s=t.parent(),e=n.getElementSize(t),o=n.getElementSize(s),u=o.width,f=o.height,r;return i&&i.padding_top!==undefined&&(f-=i.padding_top),i&&i.padding_bottom!==undefined&&(f-=i.padding_bottom),i&&i.padding_left!==undefined&&(u-=i.padding_left),i&&i.padding_right!==undefined&&(u-=i.padding_right),r={},r.left=Math.round((u-e.width)/2),r.top=Math.round((f-e.height)/2),i&&i.padding_top!==undefined&&(r.top+=i.padding_top),i&&i.padding_left!==undefined&&(r.left+=i.padding_left),r};this.getElementCenterPoint=function(t,i){var i,u,r;return i||(i=!1),u=n.getElementSize(t),r={},r.x=u.width/2,r.y=u.height/2,i==!0&&(r.x+=u.left,r.y+=u.top),r.x=Math.round(r.x),r.y=Math.round(r.y),r};this.getMousePosition=function(n,t){var i={pageX:n.pageX,pageY:n.pageY,clientX:n.clientX,clientY:n.clientY},r;return n.originalEvent&&n.originalEvent.touches&&n.originalEvent.touches.length>0&&(i.pageX=n.originalEvent.touches[0].pageX,i.pageY=n.originalEvent.touches[0].pageY,i.clientX=n.originalEvent.touches[0].clientX,i.clientY=n.originalEvent.touches[0].clientY),t&&(r=t.offset(),i.mouseX=i.pageX-r.left,i.mouseY=i.pageY-r.top),i};this.getMouseElementPoint=function(t,i){var r={x:t.pageX,y:t.pageY};return n.getElementLocalPoint(r,i)};this.getElementLocalPoint=function(n,t){var i={},r=t.offset();return i.x=Math.round(n.x-r.left),i.y=Math.round(n.y-r.top),i};this.getImageOriginalSize=function(n,t,i){var u,r,f;if(typeof t!="undefined"&&typeof i!="undefined")return{width:t,height:i};if(u=n[0],typeof u=="undefined")throw new Error("getImageOriginalSize error - Image not found");return r={},typeof u.naturalWidth=="undefined"?typeof n.data("naturalWidth")=="number"?(r={},r.width=n.data("naturalWidth"),r.height=n.data("naturalHeight"),r):(f=new Image,f.src=u.src,f.complete)?(r.width=f.width,r.height=f.height,n.data("naturalWidth",r.width),n.data("naturalHeight",r.height),r):{width:0,height:0}:(r.width=u.naturalWidth,r.height=u.naturalHeight,r)};this.getimageRatio=function(t){var i=n.getImageOriginalSize(t),r=n.getElementSize(t);return r.width/i.width};this.isImageFitParent=function(t){var u=t.parent(),i=n.getElementSize(t),r=n.getElementSize(u);return i.width<=r.width&&i.height<=r.height?!0:!1};this.getElementSize=function(n){if(n===undefined)throw new Error("Can't get size, empty element");var t=n.position();return t.height=n.outerHeight(),t.width=n.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t};this.isElementBiggerThenParent=function(t){var u=t.parent(),i=n.getElementSize(t),r=n.getElementSize(u);return i.width>r.width||i.height>r.height?!0:!1};this.isPointInsideElement=function(n,t){var r=n.x>=0&&n.x<t.width,i;return r==!1?!1:(i=n.y>=0&&n.y<t.height,i==!1)?!1:!0};this.getElementRelativePos=function(t,i,r,u){var u,f,e;u||(u=t.parent());f=typeof t=="number"?{width:t,height:t}:n.getElementSize(t);e=n.getElementSize(u);switch(i){case"top":case"left":i=0;r&&(i+=r);break;case"center":i=Math.round((e.width-f.width)/2);r&&(i+=r);break;case"right":i=e.width-f.width;r&&(i-=r);break;case"middle":i=Math.round((e.height-f.height)/2);r&&(i+=r);break;case"bottom":i=e.height-f.height;r&&(i-=r)}return i};this.z_________SET_ELEMENT_PROPS_______=function(){};this.zoomImageInsideParent=function(t,i,r,u,f,e,o){var r,f,p,nt,rt,tt,it;r||(r=1.2);f||(f="fit");var s=r,ut=t.parent(),l=n.getElementSize(t),a=n.getImageOriginalSize(t),v=!1,w,y,b=0,k=0,d,g,h=0,c=0;if(u?(p=n.getMouseElementPoint(u,t),v=n.isPointInsideElement(p,l),h=p.x,c=p.y):v=!1,v==!1&&(nt=n.getElementCenterPoint(t),h=nt.x,c=nt.y),i==!0)w=l.height*s,y=l.width*s,h!=0&&(b=-(h*s-h)),c!=0&&(k=-(c*s-c));else{if(w=l.height/s,y=l.width/s,rt=n.getImageInsideParentData(ut,a.width,a.height,f,o),y<rt.imageWidth)return n.scaleImageFitParent(t,a.width,a.height,f,o),!0;v==!0&&(h!=0&&(b=-(h/s-h)),c!=0&&(k=-(c/s-c)))}return e&&(tt=1,a.width!=0&&(tt=y/a.width),tt>e)?!1:(n.setElementSize(t,y,w),i==!1&&v==!1?(it=n.getElementCenterPosition(t),d=it.left,g=it.top):(d=l.left+b,g=l.top+k),n.placeElement(t,d,g),!0)};this.placeElement=function(t,i,r,u,f,e){var e,o,s,h;if((jQuery.isNumeric(i)==!1||jQuery.isNumeric(r)==!1)&&(e||(e=t.parent()),o=n.getElementSize(t),s=n.getElementSize(e)),jQuery.isNumeric(i)==!1)switch(i){case"left":i=0;u&&(i+=u);break;case"center":i=Math.round((s.width-o.width)/2);u&&(i+=u);break;case"right":i=s.width-o.width;u&&(i-=u)}if(jQuery.isNumeric(r)==!1)switch(r){case"top":r=0;f&&(r+=f);break;case"middle":case"center":r=Math.round((s.height-o.height)/2);f&&(r+=f);break;case"bottom":r=s.height-o.height;f&&(r-=f)}h={position:"absolute",margin:"0px"};i!==null&&(h.left=i);r!==null&&(h.top=r);t.css(h)};this.placeElementInParentCenter=function(t){n.placeElement(t,"center","middle")};this.setElementSizeAndPosition=function(n,t,i,r,u){var f={width:r+"px",height:u+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};n.css(f)};this.setElementSize=function(n,t,i){var r={width:t+"px"};i!==null&&typeof i!="undefined"&&(r.height=i+"px");n.css(r)};this.cloneElementSizeAndPos=function(t,i,r,u,f){var e=t.position();if(e==undefined)throw new Error("Can't get size, empty element");r===!0?(e.height=t.outerHeight(),e.width=t.outerWidth()):(e.height=t.height(),e.width=t.width());e.left=Math.round(e.left);e.top=Math.round(e.top);u&&(e.left+=u);f&&(e.top+=f);n.setElementSizeAndPosition(i,e.left,e.top,e.width,e.height)};this.placeImageInsideParent=function(t,i,r,u,f,e,o){var s=n.getImageInsideParentData(i,r,u,f,e),h="<img";return h+=" alt='"+o+"'",s.imageWidth!==null&&(h+=" width = '"+s.imageWidth+"'",s.style+="width:"+s.imageWidth+";"),s.imageHeight!=null&&(s.imageHeight=="100%"?(h+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+";"):(h+=" height = '"+s.imageHeight+"'",s.style+="height:"+s.imageHeight+"px;")),s.imageTop!==null&&(s.style+="top:"+s.imageTop+"px;"),s.imageLeft!==null&&(s.style+="left:"+s.imageLeft+"px;"),t=n.escapeDoubleSlash(t),h+=" style='"+s.style+"'",h+=' src="'+t+'"',h+=">",i.html(h),i.children("img")};this.scaleImageCoverParent=function(t,i,r){var e,o;typeof i=="number"?(e=i,o=r):(e=i.outerWidth(),o=i.outerHeight());var c=n.getImageOriginalSize(t),a=c.width,v=c.height,l=a/v,f=o,u=f*l,s=0,h=0;u<e?(u=e,f=u/l,h=0,s=Math.round((f-o)/-2)):(s=0,h=Math.round((u-e)/-2));u=Math.round(u);f=Math.round(f);t.css({width:u+"px",height:f+"px",left:h+"px",top:s+"px"})};this.scaleImageFitParent=function(t,i,r,u,f){var h=t.parent(),e=n.getImageInsideParentData(h,i,r,u,f),s=!1,o={};return e.imageWidth!==null&&(s=!0,t.removeAttr("width"),o.width=e.imageWidth+"px"),e.imageHeight!=null&&(s=!0,t.removeAttr("height"),o.height=e.imageHeight+"px"),e.imageTop!==null&&(s=!0,o.top=e.imageTop+"px"),e.imageLeft!==null&&(s=!0,o.left=e.imageLeft+"px"),s==!0&&(o.position="absolute",o.margin="0px 0px",t.css(o)),e};this.scaleImageByHeight=function(t,i,r,u){var f=n.getImageOriginalSize(t,r,u),e=f.width/f.height,o=Math.round(i*e);i=Math.round(i);n.setElementSize(t,o,i)};this.scaleImageByWidth=function(t,i,r,u){var f=n.getImageOriginalSize(t,r,u),e=f.width/f.height,o=Math.round(i/e);i=Math.round(i);n.setElementSize(t,i,o)};this.scaleImageExactSizeInParent=function(t,i,r,u,f,e){var d=t.parent(),s=n.getElementSize(d),k,c,o,l;s.width<u&&(u=s.width);s.height<f&&(f=s.height);var h=n.getImageInsideParentData(null,i,r,e,null,u,f),y=u,p=f,w=h.imageLeft,a=h.imageLeft,b=h.imageTop,v=h.imageTop,g=Math.round((s.width-u)/2),nt=Math.round((s.height-f)/2),tt=h.imageWidth+w+a,c=u-tt;return c!=0&&(a+=c),k=h.imageHeight+b+v,c=f-k,c!=0&&(v+=c),t.removeAttr("width"),t.removeAttr("height"),o={position:"absolute",margin:"0px 0px"},o.width=y+"px",o.height=p+"px",o.left=g+"px",o.top=nt+"px",o["padding-left"]=w+"px",o["padding-top"]=b+"px",o["padding-right"]=a+"px",o["padding-bottom"]=v+"px",t.css(o),l={},l.imageWidth=y,l.imageHeight=p,l};this.showElement=function(n,t,i){n.show().fadeTo(0,1);t&&t.show().fadeTo(0,1);i&&i.show().fadeTo(0,1)};this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){};this.disableButton=function(t,i){if(!i)var i="ug-button-disabled";n.isButtonDisabled(t,i)==!1&&t.addClass(i)};this.convertCustomPrefixOptions=function(n,t,i){if(!t)return n;var r={};return jQuery.each(n,function(n,u){if(n.indexOf(t+"_"+i+"_")===0){var f=n.replace(t+"_"+i+"_",i+"_");r[f]=u}else r[n]=u}),r};this.enableButton=function(t,i){if(!i)var i="ug-button-disabled";n.isButtonDisabled(t,i)==!0&&t.removeClass(i)};this.isButtonDisabled=function(n,t){if(!t)var t="ug-button-disabled";return n.hasClass(t)?!0:!1};this.z_________MATH_FUNCTIONS_______=function(){};this.normalizeSetting=function(n,t,i,r,u,f){var f,e;return f||(f=!1),e=(u-i)/(r-i),u=n+(t-n)*e,f==!0&&(u<n&&(u=n),u>t&&(u=t)),u};this.getNormalizedValue=function(n,t,i,r,u){var f=(u-n)/(t-n);return n+(r-i)*f};this.getDistance=function(n,t,i,r){return Math.round(Math.sqrt(Math.abs((i-n)*(i-n)+(r-t)*(r-t))))};this.getMiddlePoint=function(n,t,i,r){var u={};return u.x=n+Math.round((i-n)/2),u.y=t+Math.round((r-t)/2),u};this.getNumItemsInSpace=function(n,t,i){return Math.floor((n+i)/(t+i))};this.getNumItemsInSpaceRound=function(n,t,i){return Math.round((n+i)/(t+i))};this.getSpaceByNumItems=function(n,t,i){return n*t+(n-1)*i};this.getItemSizeInSpace=function(n,t,i){return Math.floor((n-(t-1)*i)/t)};this.getColX=function(n,t,i){return n*(t+i)};this.getColByIndex=function(n,t){return t%n};this.getColRowByIndex=function(n,t){var i=Math.floor(n/t),r=Math.floor(n%t);return{col:r,row:i}};this.getIndexByRowCol=function(n,t,i){if(n<0||t<0)return-1;return n*i+t};this.getPrevRowSameColIndex=function(t,i){var r=n.getColRowByIndex(t,i);return n.getIndexByRowCol(r.row-1,r.col,i)};this.getNextRowSameColIndex=function(t,i){var r=n.getColRowByIndex(t,i);return n.getIndexByRowCol(r.row+1,r.col,i)};this.z_________DATA_FUNCTIONS_______=function(){};this.setGlobalData=function(n,t){jQuery.data(document.body,n,t)};this.getGlobalData=function(n){return jQuery.data(document.body,n)};this.z_________EVENT_DATA_FUNCTIONS_______=function(){};this.handleScrollTop=function(i){var f,u;if(n.isTouchDevice()==!1)return null;var r=n.getStoredEventData(i);return(r.scrollDir===null&&(Math.abs(r.diffMouseX)>15?r.scrollDir="hor":Math.abs(r.diffMouseY)>15&&Math.abs(r.diffMouseY)>Math.abs(r.diffMouseX)&&(r.scrollDir="vert",r.scrollStartY=r.lastMouseClientY,r.scrollOrigin=jQuery(document).scrollTop(),t.dataCache[i].scrollStartY=r.lastMouseClientY,t.dataCache[i].scrollOrigin=r.scrollOrigin),t.dataCache[i].scrollDir=r.scrollDir),r.scrollDir!=="vert")?r.scrollDir:(f=jQuery(document).scrollTop(),u=r.scrollOrigin-(r.lastMouseClientY-r.scrollStartY),u>=0&&jQuery(document).scrollTop(u),r.scrollDir)};this.wasVerticalScroll=function(t){var i=n.getStoredEventData(t);return i.scrollDir==="vert"?!0:!1};this.storeEventData=function(i,r,u){var f=n.getMousePosition(i),o=jQuery.now(),e={startTime:o,lastTime:o,startMouseX:f.pageX,startMouseY:f.pageY,lastMouseX:f.pageX,lastMouseY:f.pageY,startMouseClientY:f.clientY,lastMouseClientY:f.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};u&&(e=jQuery.extend(e,u));t.dataCache[r]=e};this.updateStoredEventData=function(i,r,u){if(!t.dataCache[r])throw new Error("updateEventData error: must have stored cache object");var f=t.dataCache[r],e=n.getMousePosition(i);f.lastTime=jQuery.now();e.pageX!==undefined&&(f.lastMouseX=e.pageX,f.lastMouseY=e.pageY,f.lastMouseClientY=e.clientY);u&&(f=jQuery.extend(f,u));t.dataCache[r]=f};this.getStoredEventData=function(n,i){if(!t.dataCache[n])throw new Error("updateEventData error: must have stored cache object");var r=t.dataCache[n];return r.diffMouseX=r.lastMouseX-r.startMouseX,r.diffMouseY=r.lastMouseY-r.startMouseY,r.diffMouseClientY=r.lastMouseClientY-r.startMouseClientY,r.diffTime=r.lastTime-r.startTime,i===!0?(r.startMousePos=r.lastMouseY,r.lastMousePos=r.lastMouseY,r.diffMousePos=r.diffMouseY):(r.startMousePos=r.lastMouseX,r.lastMousePos=r.lastMouseX,r.diffMousePos=r.diffMouseX),r};this.isApproveStoredEventClick=function(i,r){if(!t.dataCache[i])return!0;var u=n.getStoredEventData(i,r),f=Math.abs(u.diffMousePos);return u.diffTime>400?!1:f>30?!1:!0};this.clearStoredEventData=function(n){t.dataCache[n]=null};this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){};this.isCanvasExists=function(){var n=jQuery('<canvas width="500" height="500" > <\/canvas>')[0];return typeof n.getContext=="function"?!0:!1};this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth};this.isTouchDevice=function(){if(t.isTouchDevice!==-1)return t.isTouchDevice;try{document.createEvent("TouchEvent");t.isTouchDevice=!0}catch(n){t.isTouchDevice=!1}return t.isTouchDevice};this.isRgbaSupported=function(){var n,i,r;if(t.isRgbaSupported!==-1)return t.isRgbaSupported;n=document.getElementsByTagName("script")[0];i=n.style.color;try{n.style.color="rgba(1,5,13,0.44)"}catch(u){}return r=n.style.color!=i,n.style.color=i,t.isRgbaSupported=r,r};this.z_________GENERAL_FUNCTIONS_______=function(){};this.checkMinJqueryVersion=function(n){for(var i,r,u=jQuery.fn.jquery.split("."),f=n.split("."),t=0,e=u.length;t<e;t++){if(i=parseInt(u[t]),r=parseInt(f[t]),typeof f[t]=="undefined")return!0;if(r>i)return!1;if(i>r)return!0}return!0};this.getCssSizeParam=function(n){return jQuery.isNumeric(n)?n+"px":n};this.convertHexToRGB=function(n,t){var i=n.replace("#","");return i===n?n:(r=parseInt(i.substring(0,2),16),g=parseInt(i.substring(2,4),16),b=parseInt(i.substring(4,6),16),result="rgba("+r+","+g+","+b+","+t+")")};this.timestampToString=function(n){var t=new Date(n),i=t.getDate()+"/"+t.getMonth();return i+(" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds())};this.getArrTouches=function(n){var t=[];return n.originalEvent&&n.originalEvent.touches&&n.originalEvent.touches.length>0&&(t=n.originalEvent.touches),t};this.getArrTouchPositions=function(n){for(var r,i=[],t=0;t<n.length;t++)r={pageX:n[t].pageX,pageY:n[t].pageY},i.push(r);return i};this.startTimeDebug=function(){t.starTime=jQuery.now()};this.showTimeDebug=function(){var n=jQuery.now(),i=n-t.starTime;debugLine({"Time Passed":i},!0)};this.initProgressIndicator=function(t,i,r){var u;t!="bar"&&n.isCanvasExists()==!1&&(t="bar");switch(t){case"bar":u=new UGProgressBar;u.putHidden(r,i);break;default:case"pie":u=new UGProgressPie;u.putHidden(r,i);break;case"pie2":i.type_fill=!0;u=new UGProgressPie;u.putHidden(r,i)}return u};this.setButtonMobileReady=function(n){n.on("touchstart",function(){jQuery(this).addClass("ug-nohover")});n.on("mousedown touchend",function(n){return n.stopPropagation(),n.stopImmediatePropagation(),!1})};this.registerTheme=function(n){t.arrThemes.push(n)};this.getArrThemes=function(){return t.arrThemes};this.isThemeRegistered=function(n){return jQuery.inArray(n,t.arrThemes)!==-1?!0:!1};this.getFirstRegisteredTheme=function(){if(t.arrThemes.length==0)return"";return t.arrThemes[0]};this.isTimePassed=function(n,i){var i,r,u;return(i||(i=100),r=jQuery.now(),lastTime=t.timeCache.hasOwnProperty(n)==!1?0:t.timeCache[n],u=r-lastTime,t.timeCache[n]=r,u<=i)?!1:!0};this.whenContiniousEventOver=function(n,i,r){if(!r)var r=300;t.timeCache.hasOwnProperty(n)==!0&&t.timeCache[n]!=null&&(clearTimeout(t.timeCache[n]),t.timeCache[n]=null);t.timeCache[n]=setTimeout(i,r)};this.validateClickTouchstartEvent=function(n){var i=!0,r=jQuery.now()-t.lastEventTime;return n=="click"&&t.lastEventType=="touchstart"&&r<1e3&&(i=!1),t.lastEventTime=jQuery.now(),t.lastEventType=n,i};this.addClassOnHover=function(n,t){if(!t)var t="ug-button-hover";n.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})};this.destroyButton=function(n){n.off("mouseenter");n.off("mouseleave");n.off("click");n.off("touchstart");n.off("touchend");n.off("mousedown");n.off("tap")};this.setButtonOnClick=function(t,i){n.setButtonMobileReady(t);t.on("click touchstart",function(t){if(objThis=jQuery(this),t.stopPropagation(),t.stopImmediatePropagation(),n.validateClickTouchstartEvent(t.type)==!1)return!0;i(objThis,t)})};this.setButtonOnTap=function(i,r){i.on("tap",r);if(n.isTouchDevice()==!1)i.on("click",function(t){var i=jQuery(this);if(n.validateClickTouchstartEvent(t.type)==!1)return!0;i.trigger("tap")});else{i.on("touchstart",function(){var n=jQuery(this);n.addClass("ug-nohover");t.lastTouchStartElement=jQuery(this);t.lastEventTime=jQuery.now()});i.on("touchend",function(){var n=jQuery(this),i;if(n.is(t.lastTouchStartElement)==!1||!t.lastEventTime||(i=jQuery.now()-t.lastEventTime,i>t.touchThreshold))return!0;n.trigger("tap")})}};this.loadJs=function(n,t){var i,r;t===!0&&(n=location.protocol+"//"+n);i=document.createElement("script");i.src=n;r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(i,r)};this.loadCss=function(n,t){t===!0&&(n=location.protocol+"//"+n);var i=document.createElement("link");i.setAttribute("rel","stylesheet");i.setAttribute("type","text/css");i.setAttribute("href",n);document.getElementsByTagName("head")[0].appendChild(i)};this.addEvent=function(n,t,i){typeof n.addEventListener!="undefined"?n.addEventListener(t,i,!1):n.attachEvent&&n.attachEvent("on"+t,i)};this.checkImagesLoaded=function(n,t,i){function u(n,u){f++;typeof i=="function"&&setTimeout(function(){i(n,u)});f==r&&typeof t=="function"&&setTimeout(function(){t()})}var f=0,r=n.length;if(r==0&&t)return t(),!1;setTimeout(function(){for(var f,i,t=0;t<r;t++)if(f=n[t],f.naturalWidth!==undefined&&f.naturalWidth!==0)u(n[t],!1);else{i=jQuery("<img/>");i.data("index",t);i.on("load",function(){var t=jQuery(this).data("index");u(n[t],!1)});i.on("error",function(){var t=jQuery(this).data("index");u(n[t],!0)});i.attr("src",f.src)}})};this.waitForWidth=function(n,i){var r=n.width();if(r!=0)return i(),!1;t.handle=setInterval(function(){r=n.width();r!=0&&(clearInterval(t.handle),i())},300)};this.arrayShuffle=function(n){if(typeof n!="object")return n;for(var i,r,t=n.length;t;i=parseInt(Math.random()*t),r=n[--t],n[t]=n[i],n[i]=r);return n};this.getObjectLength=function(n){var t=0;for(var i in n)t++;return t};this.normalizePercent=function(n){return n<0&&(n=0),n>1&&(n=1),n};this.stripTags=function(n){return n.replace(/(<([^>]+)>)/ig,"")};this.escapeDoubleSlash=function(n){return n.replace('"','"')};this.htmlentitles=function(n){return jQuery("<div/>").text(n).html()};this.z_________END_GENERAL_FUNCTIONS_______=function(){}}function UGThumbsGeneral(){function b(i,u){var o=e[i],c="",l,a,y,f,s,v,h;t.customThumbs==!1&&(c=" ug-thumb-generated");var p=o.index+1,w="style='z-index:"+p+";'",y="<div class='ug-thumb-wrapper"+c+"' "+w+"><\/div>";return n.thumb_wrapper_as_link==!0&&(l=o.link,o.link==""&&(l="javascript:void(0)"),a="",n.thumb_link_newpage==!0&&o.link&&(a=" target='_blank'"),y="<a href='"+l+"'"+a+" class='ug-thumb-wrapper"+c+"'><\/a>"),f=jQuery(y),s=o.objThumbImage,t.customThumbs==!1&&(n.thumb_show_loader==!0&&s&&(v="ug-thumb-loader-dark",n.thumb_loader_type=="bright"&&(v="ug-thumb-loader-bright"),f.append("<div class='ug-thumb-loader "+v+"'><\/div>"),f.append("<div class='ug-thumb-error' style='display:none'><\/div>")),s&&(s.addClass("ug-thumb-image"),n.thumb_image_overlay_effect==!0&&(h=s.clone().appendTo(f),h.addClass("ug-thumb-image-overlay "+u).removeClass("ug-thumb-image"),h.fadeTo(0,0),o.objImageOverlay=h),f.append(s))),t.isEffectBorder&&f.append("<div class='ug-thumb-border-overlay'><\/div>"),t.isEffectOverlay&&f.append("<div class='ug-thumb-overlay'><\/div>"),r.append(f),t.customThumbs&&t.funcSetCustomThumbHtml(f,o),e[i].objThumbWrapper=f,f}function l(n,i,u,f){var e={width:n+"px",height:i+"px"},o={width:n-t.thumbInnerReduce+"px",height:i-t.thumbInnerReduce+"px"},s=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";u?(f!==!0&&u.css(e),u.find(s).css(o)):(r.children(".ug-thumb-wrapper").css(e),r.find(s).css(o))}function a(t,i,r,u){var u,f,e;u||(u=!1);o.isFakeFullscreen()&&(u=!0);f=t.children(".ug-thumb-border-overlay");e={};e["border-width"]=i+"px";i!=0&&(e["border-color"]=r);u&&u===!0?(f.css(e),i==0?f.hide():f.show()):(i==0?f.stop().fadeOut(n.thumb_transition_duration):f.show().stop().fadeIn(n.thumb_transition_duration),tt(f,e))}function v(i,r,u){var e=i.children(".ug-thumb-overlay"),f=n.thumb_transition_duration;u&&u===!0&&(f=0);r?e.stop(!0).fadeTo(f,t.colorOverlayOpacity):e.stop(!0).fadeTo(f,0)}function y(t,i,r){var e=t.children("img.ug-thumb-image"),f=t.children("img.ug-thumb-image-overlay"),u=n.thumb_transition_duration;r&&r===!0&&(u=0);i?f.stop(!0).fadeTo(u,1):(e.fadeTo(0,1),f.stop(!0).fadeTo(u,0))}function k(r,u){if(t.isEffectBorder&&a(r,n.thumb_selected_border_width,n.thumb_selected_border_color,u),t.isEffectOverlay){var e=n.thumb_overlay_reverse==!0?!0:!1;v(r,e,u)}t.isEffectImage&&y(r,!1,u);f.trigger(i.events.SETSELECTEDSTYLE,r)}function g(n){var r=i.getItemByThumb(n);if(r.isLoaded=!0,r.isThumbImageLoaded=!1,t.customThumbs==!0)return f.trigger(i.events.IMAGELOADERROR,n),!0;n.children(".ug-thumb-loader").hide();n.children(".ug-thumb-error").show()}function nt(t){if(n.thumb_round_corners_radius<=0)return!1;var i={"border-radius":n.thumb_round_corners_radius+"px"};t?(t.css(i),t.find(".ug-thumb-border-overlay").css(i)):r.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(i)}function tt(t,i){t.stop(!0).animate(i,{duration:n.thumb_transition_duration,easing:n.thumb_transition_easing,queue:!1})}function p(n){s(n)==!0?k(n,!0,"redraw"):i.setThumbNormalStyle(n,!0,"redraw")}function it(t,r){if(n.thumb_fixed_size==!0)u.scaleImageCoverParent(r,t);else{n.thumb_resize_by=="height"?u.scaleImageByHeight(r,n.thumb_height):u.scaleImageByWidth(r,n.thumb_width);var e=u.getElementSize(r);u.placeElement(r,0,0);l(e.width,e.height,t)}t.children(".ug-thumb-loader").hide();r.show();n.thumb_image_overlay_effect==!1?r.fadeTo(0,1):(n.thumb_image_overlay_effect==!0&&rt(r),r.fadeTo(0,0),p(t));f.trigger(i.events.AFTERPLACEIMAGE,t)}function rt(n){var r=n.siblings(".ug-thumb-image-overlay"),i,f;if(r.length==0)return!1;i=u.getElementSize(n);f={width:i.width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"};r.css(f);t.customThumbs==!1&&r.fadeTo(0,1)}function ut(){var t="",i=n.thumb_image_overlay_type.split(","),r,u;for(r in i){u=i[r];switch(u){case"bw":t+=" ug-bw-effect";break;case"blur":t+=" ug-blur-effect";break;case"sepia":t+=" ug-sepia-effect"}}return t}function s(n){return n.hasClass("ug-thumb-selected")?!0:!1}function ft(n,t){t=jQuery(t);var f=i.getItemByThumb(t),r=u.getElementSize(t);l(r.width,r.height,t,!0);p(t)}function et(n){if(t.touchEnabled==!0)return objThumbs.off("mouseenter").off("mouseleave"),!0;s(n)==!1&&i.setThumbOverStyle(n)}function ot(n){if(t.touchEnabled==!0)return!0;s(n)==!1&&i.setThumbNormalStyle(n,!1)}function st(n,r){var r,e,u;if((r||(r=!1),e=jQuery(n),u=e.parents(".ug-thumb-wrapper"),u.parent().length==0)||(objItem=i.getItemByThumb(u),objItem.isLoaded==!0&&r===!1))return!1;i.triggerImageLoadedEvent(u,e);t.customThumbs==!0?f.trigger(i.events.PLACEIMAGE,[u,e]):it(u,e,objItem)}function ht(n,t,r){objItem=i.getItemByThumb(t);objItem.isLoaded=!0;objItem.isThumbImageLoaded=!0;var f=u.getImageOriginalSize(r);objItem.thumbWidth=f.width;objItem.thumbHeight=f.height;objItem.thumbRatioByWidth=f.width/f.height;objItem.thumbRatioByHeight=f.height/f.width;t.addClass("ug-thumb-ratio-set")}var i=this,f=jQuery(i),o=new UniteGalleryMain,d,h,c,e,r,u=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"};this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"};var n={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!1,thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},t={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},w={timeout_thumb_check:100,thumb_max_check_times:600,eventSizeChange:"thumb_size_change"};this.init=function(i,r){h=i.getObjects();o=i;d=jQuery(i);c=h.g_objWrapper;e=h.g_arrItems;n=jQuery.extend(n,r);t.isEffectBorder=n.thumb_border_effect;t.isEffectOverlay=n.thumb_color_overlay_effect;t.isEffectImage=n.thumb_image_overlay_effect};this._____________EXTERNAL_SETTERS__________=function(){};this.setHtmlThumbs=function(n,u){var e,s,f,h,c;if(r=n,t.isEffectImage==!0&&(e=ut()),u!==!0)for(s=o.getNumItems(),f=0;f<s;f++)b(f,e);else h=i.getThumbs(),h.removeClass(t.classNewThumb),c=o.getNewAddedItemsIndexes(),jQuery.each(c,function(n,i){var r=b(i,e);r.addClass(t.classNewThumb)})};this.setThumbNormalStyle=function(r,u){if(t.customThumbs==!0&&r.removeClass("ug-thumb-over"),t.isEffectBorder&&a(r,n.thumb_border_width,n.thumb_border_color,u),t.isEffectOverlay){var e=n.thumb_overlay_reverse==!0?!1:!0;v(r,e,u)}t.isEffectImage&&y(r,!0,u);f.trigger(i.events.SETNORMALSTYLE,r)};this.setThumbOverStyle=function(r){if(t.customThumbs==!0&&r.addClass("ug-thumb-over"),t.isEffectBorder&&a(r,n.thumb_over_border_width,n.thumb_over_border_color),t.isEffectOverlay){var u=n.thumb_overlay_reverse==!0?!0:!1;v(r,u)}t.isEffectImage==!0&&y(r,!1);f.trigger(i.events.SETOVERSTYLE,r)};this.setHtmlProperties=function(r){var r,o,f,e;r||(r=i.getThumbs());t.customThumbs==!1&&(o={},n.thumb_fixed_size==!0&&l(n.thumb_width,n.thumb_height,r),nt(r));r.each(function(){var n=jQuery(this);p(n)});t.isEffectOverlay&&n.thumb_overlay_color&&(f={},u.isRgbaSupported()?(e=u.convertHexToRGB(n.thumb_overlay_color,n.thumb_overlay_opacity),f["background-color"]=e):(f["background-color"]=n.thumb_overlay_color,t.colorOverlayOpacity=n.thumb_overlay_opacity),r.find(".ug-thumb-overlay").css(f))};this.setThumbSelected=function(n){if(t.customThumbs==!0&&n.removeClass("ug-thumb-over"),s(n)==!0)return!0;n.addClass("ug-thumb-selected");k(n)};this.setThumbUnselected=function(n){n.removeClass("ug-thumb-selected");i.setThumbNormalStyle(n,!1,"set unselected")};this.setOptions=function(t){n=jQuery.extend(n,t)};this.setThumbInnerReduce=function(n){t.thumbInnerReduce=n};this.setCustomThumbs=function(n,i,r){if(t.customThumbs=!0,typeof n!="function")throw new Error("The argument should be function");t.funcSetCustomThumbHtml=n;jQuery.inArray("overlay",i)==-1&&(t.isEffectOverlay=!1);jQuery.inArray("border",i)==-1&&(t.isEffectBorder=!1);t.isEffectImage=!1;r&&r.allow_onresize===!1&&(t.allowOnResize=!1)};this._____________EXTERNAL_GETTERS__________=function(){};this.getOptions=function(){return n};this.getNumThumbs=function(){return e.length};this.getThumbImage=function(n){return n.find(".ug-thumb-image")};this.getThumbByIndex=function(n){var t=i.getThumbs();if(n>=t.length||n<0)throw new Error("Wrong thumb index");return jQuery(t[n])};this.getThumbs=function(n){var f=".ug-thumb-wrapper",e=".ug-thumb-ratio-set",u;switch(n){default:case i.type.GET_THUMBS_ALL:u=r.children(f);break;case i.type.GET_THUMBS_NO_RATIO:u=r.children(f).not(e);break;case i.type.GET_THUMBS_RATIO:u=r.children(f+e);break;case i.type.GET_THUMBS_NEW:u=r.children("."+t.classNewThumb)}return u};this.getItemByThumb=function(n){var t=n.data("index");return t===undefined&&(t=n.index()),e[t]};this.isThumbLoaded=function(n){var t=i.getItemByThumb(n);return t.isLoaded};this.getGlobalThumbSize=function(){return{width:n.thumb_width,height:n.thumb_height}};this._____________EXTERNAL_OTHERS__________=function(){};this.initEvents=function(){var n=".ug-thumb-wrapper";if(t.allowOnResize==!0)c.on(w.eventSizeChange,ft);f.on(i.events.THUMB_IMAGE_LOADED,ht);r.on("touchstart",n,function(){t.touchEnabled=!0;r.off("mouseenter").off("mouseleave")});r.on("mouseenter",n,function(){var n=jQuery(this);et(n)});r.on("mouseleave",n,function(){var n=jQuery(this);ot(n)})};this.destroy=function(){var n=".ug-thumb-wrapper";r.off("touchstart",n);c.off(w.eventSizeChange);r.off("mouseenter",n);r.off("mouseleave",n);f.off(i.events.THUMB_IMAGE_LOADED)};this.loadThumbsImages=function(){var n=r.find(".ug-thumb-image");u.checkImagesLoaded(n,null,function(n,t){if(t==!1)st(n,!0);else{var i=jQuery(n).parent();g(i)}})};this.triggerImageLoadedEvent=function(n,t){f.trigger(i.events.THUMB_IMAGE_LOADED,[n,t])};this.hideThumbs=function(){r.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){function ot(t,i){b=t.getObjects();c=t;c.attachThumbsPanel("strip",r);w=jQuery(t);k=b.g_objWrapper;g=b.g_arrItems;n=jQuery.extend(n,i);f=n.strip_vertical_type;f==!0&&(n=jQuery.extend(n,nt),n=jQuery.extend(n,i),i.thumb_resize_by="width");u.init(t,i);tt()}function tt(){var t=u.getOptions();h.isNotFixedThumbs=t.thumb_fixed_size===!1;f=n.strip_vertical_type}function st(){u.setHtmlProperties();ht();lt();it();h.isRunOnce==!1&&(n.strip_control_touch==!0&&(s=new UGTouchThumbsControl,s.init(r)),n.strip_control_avia==!0&&(l=new UGAviaControl,l.init(r)),y(),u.loadThumbsImages(),kt());h.isRunOnce=!0}function v(i){t.stripSize=i;t.stripActiveSize=f==!1?t.stripSize-n.strip_padding_left-n.strip_padding_right:t.stripSize-n.strip_padding_top-n.strip_padding_bottom;t.stripActiveSize<0&&(t.stripActiveSize=0)}function ht(){var h=e.children(".ug-thumb-wrapper"),i=jQuery(h[0]),r=i.outerWidth(),s=i.outerHeight(),n=u.getOptions();f==!1?(t.thumbSize=r,t.thumbSecondSize=n.thumb_fixed_size==!0?s:n.thumb_height,v(o.width()),t.stripInnerSize=e.width()):(t.thumbSize=s,t.thumbSecondSize=n.thumb_fixed_size==!0?r:n.thumb_width,v(o.height()),t.stripInnerSize=e.height())}function ct(n){f==!1?e.width(n):e.height(n);t.stripInnerSize=n;y();jQuery(r).trigger(r.events.INNER_SIZE_CHANGE)}function it(){var s=e.children(".ug-thumb-wrapper"),o=0,r=0,t,c;for(f==!1&&(r=n.strip_padding_top),i=0;i<s.length;i++){if(t=jQuery(s[i]),h.isNotFixedThumbs==!0){if(objItem=u.getItemByThumb(t),objItem.isLoaded==!1)continue;t.show()}a.placeElement(t,o,r);f==!1?o+=t.outerWidth()+n.strip_space_between_thumbs:r+=t.outerHeight()+n.strip_space_between_thumbs}c=f==!1?o-n.strip_space_between_thumbs:r-n.strip_space_between_thumbs;ct(c)}function lt(){var r,u,n,i;f==!1?(r=t.thumbSecondSize,n={},n.height=r+"px",i={},i.height=r+"px"):(u=t.thumbSecondSize,n={},n.width=u+"px",i={},i.width=u+"px");o.css(n);e.css(i)}function rt(n){var i=r.getInnerStripPos(),t=i+n;t=r.fixInnerStripLimits(t);r.positionInnerStrip(t,!0)}function ut(n){var i=d(n),t=i.min*-1;t=r.fixInnerStripLimits(t);r.positionInnerStrip(t,!0)}function ft(n){var u=d(n),i=u.max*-1+t.stripSize;i=r.fixInnerStripLimits(i);r.positionInnerStrip(i,!0)}function et(n){var t,i,r,u;if(p()==!1)return!1;t=dt();i=d(n);i.min<t.minPosThumbs?(r=n.prev(),r.length?ut(r):ut(n)):i.max>t.maxPosThumbs&&(u=n.next(),u.length?ft(u):ft(n))}function at(){var t=c.getSelectedItem(),n;if(t==null)return!0;n=t.objThumbWrapper;n&&et(n)}function vt(){if(p()==!1)return!1;var n=r.getInnerStripPos(),t=r.fixInnerStripLimits(n);n!=t&&r.positionInnerStrip(t,!0)}function y(){var n=p();n==!0?(l&&l.enable(),s&&s.enable()):(l&&l.disable(),s&&s.disable())}function yt(){if(p())return!1;f==!1?a.placeElement(e,n.strip_thumbs_align,0):a.placeElement(e,0,n.strip_thumbs_align)}function pt(n){var t,i;if(r.isTouchMotionActive()&&(t=s.isSignificantPassed(),t==!0))return!0;i=u.getItemByThumb(n);c.selectItem(i)}function wt(){clearTimeout(h.handle);h.handle=setTimeout(function(){it()},50)}function bt(){var n=c.getSelectedItem();u.setThumbSelected(n.objThumbWrapper);et(n.objThumbWrapper)}function kt(){u.initEvents();var n=o.find(".ug-thumb-wrapper");n.on("click touchend",function(){var n=jQuery(this);pt(n)});w.on(c.events.ITEM_CHANGE,bt);if(h.isNotFixedThumbs)jQuery(u).on(u.events.AFTERPLACEIMAGE,wt)}function p(){return t.stripInnerSize>t.stripActiveSize?!0:!1}function dt(){var n={},i=r.getInnerStripPos();return n.minPosThumbs=i*-1+1,n.maxPosThumbs=i*-1+t.stripSize-1,n}function d(n){var i={},r=n.position();return f==!1?(i.min=r.left,i.max=r.left+t.thumbSize):(i.min=r.top,i.max=r.top+t.thumbSize),i}var r=this,c=new UniteGalleryMain,w,b,k,g,o,e,l,s,a=new UGFunctions,f=!1,u=new UGThumbsGeneral,a=new UGFunctions,n={strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0},h={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},t={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0},nt;this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};nt={strip_thumbs_align:"top",thumb_resize_by:"width"};this.setHtml=function(t){if(!t){var t=k;n.parent_container!=null&&(t=n.parent_container)}t.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'><\/div><\/div>");o=t.children(".ug-thumbs-strip");e=o.children(".ug-thumbs-strip-inner");u.setHtmlThumbs(e);h.isNotFixedThumbs==!0&&u.hideThumbs()};this.destroy=function(){var n=o.find(".ug-thumb-wrapper");n.off("click");n.off("touchend");w.off(c.events.ITEM_CHANGE);jQuery(u).off(u.events.AFTERPLACEIMAGE);s&&s.destroy();l&&l.destroy();u.destroy()};this.________EXTERNAL_GENERAL___________=function(){};this.init=function(n,t){ot(n,t)};this.run=function(){st()};this.positionInnerStrip=function(t,i){var i,u;i===undefined&&(i=!1);u=f==!1?{left:t+"px"}:{top:t+"px"};i==!1?(e.css(u),r.triggerStripMoveEvent()):(r.triggerStripMoveEvent(),e.stop(!0).animate(u,{duration:n.strip_scroll_to_thumb_duration,easing:n.strip_scroll_to_thumb_easing,queue:!1,progress:function(){r.triggerStripMoveEvent()},always:function(){r.triggerStripMoveEvent()}}))};this.triggerStripMoveEvent=function(){jQuery(r).trigger(r.events.STRIP_MOVE)};this.isTouchMotionActive=function(){if(!s)return!1;return s.isTouchActive()};this.isItemThumbVisible=function(n){var u=n.objThumbWrapper,i=u.position(),e=r.getInnerStripPos()*-1,o;if(f==!1)var s=e+t.stripSize,h=i.left,c=i.left+u.width();else var s=e+t.stripSize,h=i.top,c=i.top+u.height();return o=!1,c>=e&&h<=s&&(o=!0),o};this.getInnerStripPos=function(){return f==!1?e.position().left:e.position().top};this.getInnerStripLimits=function(){var i={};return i.maxPos=f==!1?n.strip_padding_left:n.strip_padding_top,i.minPos=-(t.stripInnerSize-t.stripActiveSize),i};this.fixInnerStripLimits=function(n){var t=r.getInnerStripLimits();return n>t.maxPos&&(n=t.maxPos),n<t.minPos&&(n=t.minPos),n};this.scrollForeward=function(){rt(-t.stripSize)};this.scrollBack=function(){rt(t.stripSize)};this.________EXTERNAL_SETTERS___________=function(){};this.setOptions=function(t){n=jQuery.extend(n,t);u.setOptions(t);tt()};this.setSizeVertical=function(n){var u,r,i;if(f==!1)throw new Error("setSizeVertical error, the strip size is not vertical");u=t.thumbSecondSize;r={};r.width=u+"px";r.height=n+"px";o.css(r);v(n);i={};i.width=u+"px";i.left="0px";i.top="0px";e.css(i);h.is_placed=!0;y()};this.setSizeHorizontal=function(i){var s,u,c,r;if(f==!0)throw new Error("setSizeHorizontal error, the strip size is not horizontal");s=t.thumbSecondSize+n.strip_padding_top+n.strip_padding_bottom;u={};u.width=i+"px";u.height=s+"px";o.css(u);v(i);c=n.strip_padding_left;r={};r.height=s+"px";r.left=c+"px";r.top="0px";e.css(r);h.is_placed=!0;y()};this.setPosition=function(n,t,i,r){a.placeElement(o,n,t,i,r)};this.resize=function(i){f==!1?(o.width(i),t.stripActiveSize=i-n.strip_padding_left-n.strip_padding_right):(o.height(i),t.stripActiveSize=i-n.strip_padding_top-n.strip_padding_bottom);v(i);y();vt();yt();at()};this.setThumbUnselected=function(n){u.setThumbUnselected(n)};this.setCustomThumbs=function(n){u.setCustomThumbs(n)};this.________EXTERNAL_GETTERS___________=function(){};this.getObjects=function(){var t=u.getOptions(),i=jQuery.extend(n,t);return{g_gallery:c,g_objGallery:w,g_objWrapper:k,g_arrItems:g,g_objStrip:o,g_objStripInner:e,g_aviaControl:l,g_touchThumbsControl:s,isVertical:f,g_options:i,g_thumbs:u}};this.getObjThumbs=function(){return u};this.getSelectedThumb=function(){var n=c.getSelectedItemIndex();return n==-1?null:u.getThumbByIndex(n)};this.getSizeAndPosition=function(){return a.getElementSize(o)};this.getHeight=function(){return o.outerHeight()};this.getWidth=function(){return o.outerWidth()};this.getSizes=function(){return t};this.isVertical=function(){return f};this.isPlaced=function(){return h.is_placed};this.isMoveEnabled=function(){return p()}}function UGTouchThumbsControl(){function l(){var i=jQuery.now(),t={};return t.passedTime=n.lastTime-n.startTime,t.lastActiveTime=i-n.buttonReleaseTime,t.passedDistance=n.lastPos-n.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function w(){i.thumb_touch_slowFactor=o.normalizeSetting(5e-5,.01,1,100,c.strip_thumb_touch_sensetivity,!0)}function s(n){return e==!1?o.getMousePosition(n).pageX:o.getMousePosition(n).pageY}function b(i){var e=n.mousePos-i,r=n.innerPos-e,u=t.getInnerStripLimits(),f;r>u.maxPos&&(f=r-u.maxPos,r=u.maxPos+f/3);r<u.minPos&&(f=u.minPos-r,r=u.minPos-f/3);t.positionInnerStrip(r)}function k(i){var r=t.getInnerStripPos();n.mousePos=i;n.innerPos=r;n.lastPortionPos=r;n.lastDeltaTime=0;n.lastDeltaPos=0;n.startTime=jQuery.now();n.startPos=n.innerPos;n.lastTime=n.startTime;n.lastPos=n.startPos;n.speed=0}function a(){var t=jQuery.now(),r=t-n.lastTime;r>=i.touch_portion_time&&(n.lastDeltaTime=t-n.lastTime,n.lastDeltaTime>i.touch_portion_time&&(n.lastDeltaTime=i.touch_portion_time),n.lastDeltaPos=n.lastPos-n.lastPortionPos,n.lastPortionPos=n.lastPos,n.lastTime=t)}function d(){var nt=i.thumb_touch_slowFactor,a=i.minDeltaTime,ft=i.minPath,et=t.getInnerStripPos(),ot=jQuery.now(),o=ot-n.lastTime,c=et-n.lastPortionPos,tt,h,s,k,rt,l,d,ut,g;o<a&&n.lastDeltaTime>0&&(o=n.lastDeltaTime,c=n.lastDeltaPos+c);o<a&&(o=a);tt=c>0?1:-1;h=0;o>0&&(h=c/o);s=h*h/(nt*2)*tt;Math.abs(s)<=ft&&(s=0);var y=t.getInnerStripPos(),u=y+s,r=t.fixInnerStripLimits(u),p=t.getInnerStripLimits(),w=i.limitsBreakAddition,b=!1,it=r;u>p.maxPos&&(b=!0,r=w,u<w&&(r=u));u<p.minPos&&(b=!0,k=p.minPos-w,r=k,u>k&&(r=u));rt=r-y;l=Math.abs(Math.round(h/nt));s!=0&&(l=l*rt/s);y!=r&&(d={left:r+"px"},e==!0&&(d={top:r+"px"}),f.animate(d,{duration:l,easing:i.animationEasing,queue:!0,progress:v}));b==!0&&(ut=i.returnAnimateSpeed,g={left:it+"px"},e==!0&&(g={top:it+"px"}),f.animate(g,{duration:ut,easing:i.returnAnimationEasing,queue:!0,progress:v}))}function v(){n.lastPos=t.getInnerStripPos();t.triggerStripMoveEvent()}function g(){if(n.loop_active==!0)return!0;n.loop_active=!0;n.handle=setInterval(a,10)}function h(t){if(n.loop_active==!1)return!0;if(t){var i=s(t);d(i)}n.loop_active=!1;n.handle=clearInterval(n.handle)}function nt(t){if(n.isControlEnabled==!1)return!0;if(n.buttonReleaseTime=jQuery.now(),n.touch_active==!1)return h(t),!0;t.preventDefault();n.touch_active=!1;h(t);u.removeClass("ug-dragging")}function tt(t){if(n.isControlEnabled==!1)return!0;t.preventDefault();n.touch_active=!0;var i=s(t);f.stop(!0);k(i);g();u.addClass("ug-dragging")}function it(i){if(n.isControlEnabled==!1||n.touch_active==!1)return!0;if(i.preventDefault(),i.buttons==0)return n.touch_active=!1,h(i),!0;var r=s(i);n.lastPos=t.getInnerStripPos();b(r);a()}function rt(){u.bind("mousedown touchstart",tt);jQuery(window).add("body").bind("mouseup touchend",nt);jQuery("body").bind("mousemove touchmove",it)}var t,y,p,r,u,f,c,e,o=new UGFunctions,i={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},n={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};this.enable=function(){n.isControlEnabled=!0};this.disable=function(){n.isControlEnabled=!1};this.init=function(n){t=n;r=n.getObjects();y=r.g_gallery;p=r.g_objGallery;u=r.g_objStrip;f=r.g_objStripInner;c=r.g_options;e=r.isVertical;w();rt()};this.isSignificantPassed=function(){var n=l();return n.passedTime>300?!0:n.passedDistanceAbs>30?!0:!1};this.isTouchActive=function(){if(n.touch_active==!0||f.is(":animated")==!0)return!0;var t=l();return t.lastActiveTime<50?!0:!1};this.destroy=function(){u.unbind("mousedown");u.unbind("touchstart");jQuery(window).add("body").unbind("mouseup").unbind("touchend");jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){function c(t,r){var u;switch(n.orientation){case"right":case"left":u={left:t+"px"};break;case"top":case"bottom":u={top:t+"px"}}i.stop(!0).animate(u,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){r&&r()}})}function l(t){switch(n.orientation){case"right":case"left":h.placeElement(i,t,null);break;case"top":case"bottom":h.placeElement(i,null,t)}}function s(){f.trigger(u.events.FINISH_MOVE)}var n,u,i,o,f,r=new UniteGalleryMain,a=this,t,e,h=new UGFunctions;this.init=function(t,i,s,h,c){n=i;u=s;r=t;o=h;f=c;e=jQuery(r)};this.setHtml=function(f){var e,s;i=f;e=n.panelType=="strip"?o.strippanel_enable_handle:o.gridpanel_enable_handle;e==!0&&(t=new UGPanelHandle,t.init(u,i,o,n.panelType,r),t.setHtml());n.isDisabledAtStart===!0&&(s="<div class='ug-overlay-disabled'><\/div>",i.append(s),setTimeout(function(){i.children(".ug-overlay-disabled").hide()},n.disabledAtStartTimeout))};this.placeElements=function(){t&&t.placeHandle()};this.initEvents=function(){if(t){t.initEvents();e.on(r.events.SLIDER_ACTION_START,function(){t.hideHandle()});e.on(r.events.SLIDER_ACTION_END,function(){t.showHandle()})}};this.destroy=function(){t&&(t.destroy(),e.off(r.events.SLIDER_ACTION_START),e.off(r.events.SLIDER_ACTION_END))};this.openPanel=function(t){if(!t)var t=!1;if(i.is(":animated")||n.isClosed==!1)return!1;n.isClosed=!1;f.trigger(u.events.OPEN_PANEL);t===!1?c(n.originalPos,s):(l(n.originalPos),s())};this.closePanel=function(t){var t,r;if((t||(t=!1),i.is(":animated"))||n.isClosed==!0)return!1;r=a.getClosedPanelDest();n.isClosed=!0;f.trigger(u.events.CLOSE_PANEL);t===!1?c(r,s):(l(r),s())};this.setClosedState=function(t){n.originalPos=t;f.trigger(u.events.CLOSE_PANEL);n.isClosed=!0};this.setOpenedState=function(){f.trigger(u.events.OPEN_PANEL);n.isClosed=!1};this.getClosedPanelDest=function(){var u=h.getElementSize(i),t,f;switch(n.orientation){case"left":n.originalPos=u.left;t=-n.panelWidth;break;case"right":n.originalPos=u.left;f=r.getSize();t=f.width;break;case"top":n.originalPos=u.top;t=-n.panelHeight;break;case"bottom":n.originalPos=u.top;f=r.getSize();t=f.height}return t};this.isPanelClosed=function(){return n.isClosed};this.setDisabledAtStart=function(t){if(t<=0)return!1;n.isDisabledAtStart=!0;n.disabledAtStartTimeout=t}}function UGPanelHandle(){function f(){t.removeClass("ug-button-hover")}function e(){t.addClass("ug-button-closed")}function o(){t.removeClass("ug-button-closed")}function s(n){if(n.stopPropagation(),n.stopImmediatePropagation(),r.validateClickTouchstartEvent(n.type)==!1)return!0;i.isPanelClosed()?i.openPanel():i.closePanel()}function h(){var t=i.getOrientation();switch(t){case"right":case"left":n.panel_handle_align!="top"&&n.panel_handle_align!="bottom"&&(n.panel_handle_align="top");break;case"bottom":n.panel_handle_align!="left"&&n.panel_handle_align!="right"&&(n.panel_handle_align="left");break;case"top":n.panel_handle_align!="left"&&n.panel_handle_align!="right"&&(n.panel_handle_align="right")}}var c=this,u,i,t,r=new UGFunctions,n={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0};this.init=function(t,r,f,e,o){i=t;u=r;switch(e){case"grid":n.panel_handle_align=f.gridpanel_handle_align;n.panel_handle_offset=f.gridpanel_handle_offset;n.panel_handle_skin=f.gridpanel_handle_skin;break;case"strip":n.panel_handle_align=f.strippanel_handle_align;n.panel_handle_offset=f.strippanel_handle_offset;n.panel_handle_skin=f.strippanel_handle_skin;break;default:throw new Error("Panel handle error: wrong panel type: "+e);}var s=o.getOptions(),h=s.gallery_skin;n.panel_handle_skin==""&&(n.panel_handle_skin=h)};this.setHtml=function(){var f=i.getOrientation(),r="ug-panel-handle-tip";switch(f){case"right":r+=" ug-handle-tip-left";break;case"left":r+=" ug-handle-tip-right";break;case"bottom":r+=" ug-handle-tip-top";break;case"top":r+=" ug-handle-tip-bottom"}u.append("<div class='"+r+" ug-skin-"+n.panel_handle_skin+"'><\/div>");t=u.children(".ug-panel-handle-tip")};this.initEvents=function(){r.addClassOnHover(t);t.bind("click touchstart",s);jQuery(i).on(i.events.OPEN_PANEL,function(){f();o()});jQuery(i).on(i.events.CLOSE_PANEL,function(){f();e()})};this.destroy=function(){r.destroyButton(t);jQuery(i).off(i.events.OPEN_PANEL);jQuery(i).off(i.events.CLOSE_PANEL)};this.placeHandle=function(){var u=r.getElementSize(t),f;h();f=i.getOrientation();switch(f){case"left":r.placeElement(t,"right",n.panel_handle_align,-u.width);break;case"right":r.placeElement(t,-u.width,n.panel_handle_align,0,n.panel_handle_offset);break;case"top":r.placeElement(t,n.panel_handle_align,"bottom",n.panel_handle_offset,-u.height);break;case"bottom":r.placeElement(t,n.panel_handle_align,"top",n.panel_handle_offset,-u.height);break;default:throw new Error("Wrong panel orientation: "+f);}};this.hideHandle=function(){t.is(":visible")==!0&&t.hide()};this.showHandle=function(){t.is(":visible")==!1&&t.show()}}function UGStripPanel(){function k(t,i){var e,o,h;u=t;l=jQuery(u);n=jQuery.extend(n,i);e=!1;n.strippanel_vertical_type==!0&&(n=jQuery.extend(n,w),e=!0);n.strippanel_enable_buttons==!1&&(n=jQuery.extend(n,b),e=!0);e==!0&&(n=jQuery.extend(n,i));o=u.getOptions();h=o.gallery_skin;n.strippanel_buttons_skin==""&&(n.strippanel_buttons_skin=h);a=u.getElement();s.init(u,f,c,n,p);r=new UGThumbsStrip;r.init(u,n)}function d(){if(n.strippanel_vertical_type==!1){if(f.panelWidth==0)throw new Error("Strip panel error: The width not set, please set width");}else if(f.panelHeight==0)throw new Error("Strip panel error: The height not set, please set height");if(f.orientation==null)throw new Error("Wrong orientation, please set panel orientation before run");return!0}function g(){if(f.isFirstRun==!0&&d()==!1)return!1;r.run();v();y();ct();f.isFirstRun=!1;h()}function nt(i){var i,u,f;i||(i=a);i.append("<div class='ug-strip-panel'><\/div>");o=i.children(".ug-strip-panel");n.strippanel_enable_buttons==!0&&(u="ug-strip-arrow-left",f="ug-strip-arrow-right",n.strippanel_vertical_type==!0&&(u="ug-strip-arrow-up",f="ug-strip-arrow-down"),o.append("<div class='ug-strip-arrow "+u+" ug-skin-"+n.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'><\/div><\/div>"),o.append("<div class='ug-strip-arrow "+f+" ug-skin-"+n.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'><\/div><\/div>"));s.setHtml(o);r.setHtml(o);n.strippanel_enable_buttons==!0&&(e=o.children("."+u),t=o.children("."+f));tt()}function tt(){n.strippanel_background_color!=""&&o.css("background-color",n.strippanel_background_color)}function it(){var s=r.getHeight(),c=f.panelWidth,l,a,h,u,v;t&&(e.height(s),t.height(s),l=e.children(".ug-strip-arrow-tip"),i.placeElement(l,"center","middle"),a=t.children(".ug-strip-arrow-tip"),i.placeElement(a,"center","middle"));h=s+n.strippanel_padding_top+n.strippanel_padding_bottom;o.width(c);o.height(h);f.panelHeight=h;u=c-n.strippanel_padding_left-n.strippanel_padding_right;t&&(v=t.outerWidth(),u=u-v*2-n.strippanel_padding_buttons*2);r.resize(u)}function rt(){var s=r.getWidth(),c=f.panelHeight,l,a,h,u,v;t&&(e.width(s),t.width(s),l=e.children(".ug-strip-arrow-tip"),i.placeElement(l,"center","middle"),a=t.children(".ug-strip-arrow-tip"),i.placeElement(a,"center","middle"));h=s+n.strippanel_padding_left+n.strippanel_padding_right;o.width(h);o.height(c);f.panelWidth=h;u=c-n.strippanel_padding_top-n.strippanel_padding_bottom;t&&(v=t.outerHeight(),u=u-v*2-n.strippanel_padding_buttons*2);r.resize(u)}function v(){n.strippanel_vertical_type==!1?it():rt()}function ut(){t&&(i.placeElement(e,"left","top",n.strippanel_padding_left,n.strippanel_padding_top),i.placeElement(t,"right","top",n.strippanel_padding_right,n.strippanel_padding_top));var u=n.strippanel_padding_left;t&&(u+=t.outerWidth()+n.strippanel_padding_buttons);r.setPosition(u,n.strippanel_padding_top)}function ft(){t&&(i.placeElement(e,"left","top",n.strippanel_padding_left,n.strippanel_padding_top),i.placeElement(t,"left","bottom",n.strippanel_padding_left,n.strippanel_padding_bottom));var u=n.strippanel_padding_top;t&&(u+=t.outerHeight()+n.strippanel_padding_buttons);r.setPosition(n.strippanel_padding_left,u)}function y(){n.strippanel_vertical_type==!1?ut():ft();s.placeElements()}function et(t){if(i.isButtonDisabled(t))return!0;n.strippanel_buttons_role=="advance_item"?u.nextItem():r.scrollForeward()}function ot(t){if(i.isButtonDisabled(t))return!0;n.strippanel_buttons_role=="advance_item"?u.prevItem():r.scrollBack()}function h(){if(!t)return!0;if(r.isMoveEnabled()==!1)return i.disableButton(e),i.disableButton(t),!0;var n=r.getInnerStripLimits(),u=r.getInnerStripPos();u>=n.maxPos?i.disableButton(e):i.enableButton(e);u<=n.minPos?i.disableButton(t):i.enableButton(t)}function st(){h()}function ht(){u.isLastItem()?i.disableButton(t):i.enableButton(t);u.isFirstItem()?i.disableButton(e):i.enableButton(e)}function ct(){if(f.isEventsInited==!0)return!1;if(f.isEventsInited=!0,t)if(i.addClassOnHover(t,"ug-button-hover"),i.addClassOnHover(e,"ug-button-hover"),i.setButtonOnClick(e,ot),i.setButtonOnClick(t,et),n.strippanel_buttons_role!="advance_item"){jQuery(r).on(r.events.STRIP_MOVE,st);jQuery(r).on(r.events.INNER_SIZE_CHANGE,h);l.on(u.events.SIZE_CHANGE,h)}else{var o=u.getOptions();if(o.gallery_carousel==!1)jQuery(u).on(u.events.ITEM_CHANGE,ht)}s.initEvents()}var c=this,p=jQuery(this),u=new UniteGalleryMain,l,a,o,i=new UGFunctions,r=new UGThumbsStrip,s=new UGPanelsBase,t,e;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var n={strippanel_vertical_type:!1,strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},w={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},b={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},f={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0};this.destroy=function(){t&&(i.destroyButton(t),i.destroyButton(e),jQuery(r).off(r.events.STRIP_MOVE),jQuery(u).off(u.events.ITEM_CHANGE),jQuery(u).off(u.events.SIZE_CHANGE));s.destroy();r.destroy()};this.getOrientation=function(){return f.orientation};this.setOrientation=function(n){f.orientation=n};this.init=function(n,t){k(n,t)};this.run=function(){g()};this.setHtml=function(n){nt(n)};this.getElement=function(){return o};this.getSize=function(){return i.getElementSize(o)};this.setWidth=function(n){f.panelWidth=n};this.setHeight=function(n){f.panelHeight=n};this.resize=function(n){c.setWidth(n);v();y()};this.__________Functions_From_Base_____=function(){};this.isPanelClosed=function(){return s.isPanelClosed()};this.getClosedPanelDest=function(){return s.getClosedPanelDest()};this.openPanel=function(n){s.openPanel(n)};this.closePanel=function(n){s.closePanel(n)};this.setOpenedState=function(n){s.setOpenedState(n)};this.setClosedState=function(n){s.setClosedState(n)};this.setCustomThumbs=function(n){r.setCustomThumbs(n)};this.setDisabledAtStart=function(n){s.setDisabledAtStart(n)}}function UGGridPanel(){function b(r,u){var f,e,c;s=r;v();u&&u.vertical_scroll&&(n.gridpanel_vertical_scroll=u.vertical_scroll);n=jQuery.extend(n,u);t.isHorType==!0?(n=jQuery.extend(n,w),n=jQuery.extend(n,u)):n.gridpanel_vertical_scroll==!0&&(n=jQuery.extend(n,p),n=jQuery.extend(n,u),n.grid_panes_direction="bottom");f=s.getOptions();e=f.gallery_skin;n.gridpanel_arrows_skin==""&&(n.gridpanel_arrows_skin=e);c=r.getObjects();h=c.g_objWrapper;o.init(s,t,l,n,a);i=new UGThumbsGrid;i.init(s,n)}function v(){if(t.orientation==null)throw new Error("Wrong orientation, please set panel orientation before run");}function k(){v();nt();i.run();rt();ut();vt();ft()}function d(){h.append("<div class='ug-grid-panel'><\/div>");u=h.children(".ug-grid-panel");t.isHorType?(u.append("<div class='grid-arrow grid-arrow-left-hortype ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),u.append("<div class='grid-arrow grid-arrow-right-hortype ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),f=u.children(".grid-arrow-left-hortype"),e=u.children(".grid-arrow-right-hortype")):n.gridpanel_vertical_scroll==!1?(u.append("<div class='grid-arrow grid-arrow-left ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),u.append("<div class='grid-arrow grid-arrow-right ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),f=u.children(".grid-arrow-left"),e=u.children(".grid-arrow-right")):(u.append("<div class='grid-arrow grid-arrow-up ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),u.append("<div class='grid-arrow grid-arrow-down ug-skin-"+n.gridpanel_arrows_skin+"'><\/div>"),f=u.children(".grid-arrow-up"),e=u.children(".grid-arrow-down"));o.setHtml(u);f.fadeTo(0,0);e.fadeTo(0,0);i.setHtml(u);g()}function g(){n.gridpanel_background_color!=""&&u.css("background-color",n.gridpanel_background_color)}function nt(){n.gridpanel_grid_align=="center"&&(n.gridpanel_grid_align="middle")}function tt(){var u=n.gridpanel_padding_border_top+n.gridpanel_padding_border_bottom,f=t.panelHeight-u,o;if(n.gridpanel_arrows_always_on==!1&&(o=i.getNumPanesEstimationByHeight(f),o==1))return f;var s=r.getElementSize(e),h=s.height,u=h+n.gridpanel_arrows_padding_vert;return n.gridpanel_vertical_scroll==!0&&(u*=2),u+=n.gridpanel_padding_border_top+n.gridpanel_padding_border_bottom,t.panelHeight-u}function it(){var u=n.gridpanel_padding_border_left+n.gridpanel_padding_border_right,f=t.panelWidth-u,o,s,h;return n.gridpanel_arrows_always_on==!1&&(o=i.getNumPanesEstimationByWidth(f),o==1)?f:(s=r.getElementSize(e),h=s.width,u+=(h+n.gridpanel_arrows_padding_hor)*2,t.panelWidth-u)}function rt(){var r=!1,u;n.gridpanel_arrows_always_on==!0?r=!0:(u=i.getNumPanes(),u>1&&(r=!0));r==!0?(e.show().fadeTo(0,1),f.show().fadeTo(0,1),t.arrowsVisible=!0):(e.hide(),f.hide(),t.arrowsVisible=!1)}function ut(){var f=i.getSize();t.isHorType==!0?t.panelHeight=f.height+n.gridpanel_padding_border_top+n.gridpanel_padding_border_bottom:t.panelWidth=f.width+n.gridpanel_padding_border_left+n.gridpanel_padding_border_right;r.setElementSize(u,t.panelWidth,t.panelHeight)}function ft(){if(t.isEventsInited==!0)return!1;t.isEventsInited=!0;f&&(r.addClassOnHover(f),i.attachPrevPaneButton(f));e&&(r.addClassOnHover(e),i.attachNextPaneButton(e));o.initEvents()}function c(){return n.gridpanel_padding_border_left}function y(){var u=n.gridpanel_grid_align,t=0,f,e;switch(u){case"top":t=n.gridpanel_padding_border_top;break;case"bottom":t=n.gridpanel_padding_border_bottom}f=c();e=i.getElement();r.placeElement(e,f,u,0,t)}function et(){var s,h,l,a,o=r.getElementSize(f),u=i.getSize(),v,y;switch(n.gridpanel_grid_align){default:case"top":s=n.gridpanel_padding_border_top+o.height+n.gridpanel_arrows_padding_vert;break;case"middle":s="middle";break;case"bottom":s=t.panelHeight-u.height-o.height-n.gridpanel_padding_border_bottom-n.gridpanel_arrows_padding_vert}v=c();y=i.getElement();r.placeElement(y,v,s);u=i.getSize();switch(n.gridpanel_arrows_align_vert){default:case"center":case"middle":h=(u.top-o.height)/2;l=u.bottom+(t.panelHeight-u.bottom-o.height)/2;a=0;break;case"grid":h=u.top-o.height-n.gridpanel_arrows_padding_vert_vert;l=u.bottom+n.gridpanel_arrows_padding_vert;a=0;break;case"border":case"borders":h=n.gridpanel_padding_border_top;l="bottom";a=n.gridpanel_padding_border_bottom}r.placeElement(f,"center",h);r.placeElement(e,"center",l,0,a)}function ot(){t.arrowsVisible==!0?et():y()}function st(){var o,v,s,h=r.getElementSize(f),u=i.getSize(),l=n.gridpanel_padding_border_top,p,a,w,b,y;switch(n.gridpanel_grid_align){case"middle":switch(n.gridpanel_arrows_align_vert){default:a=u.height+n.gridpanel_arrows_padding_vert+h.height;l=(t.panelHeight-a)/2;break;case"border":case"borders":p=t.panelHeight-h.height-n.gridpanel_padding_border_bottom;l=(p-u.height)/2}break;case"bottom":a=u.height+h.height+n.gridpanel_arrows_padding_vert;l=t.panelHeight-a-n.gridpanel_padding_border_bottom}w=i.getElement();b=c();r.placeElement(w,b,l);u=i.getSize();switch(n.gridpanel_arrows_align_vert){default:case"center":case"middle":o=u.bottom+(t.panelHeight-u.bottom-h.height)/2;s=0;break;case"grid":o=u.bottom+n.gridpanel_arrows_padding_vert;s=0;break;case"border":case"borders":o="bottom";s=n.gridpanel_padding_border_bottom}v=-h.width/2-n.gridpanel_space_between_arrows/2;r.placeElement(f,"center",o,v,s);y=Math.abs(v);r.placeElement(e,"center",o,y,s)}function ht(){t.arrowsVisible==!0?st():y()}function ct(){var h,c,l,s,o=r.getElementSize(f),u=i.getSize(),a;switch(n.gridpanel_grid_align){default:case"left":h=n.gridpanel_padding_border_left+n.gridpanel_arrows_padding_hor+o.width;break;case"middle":case"center":h="center";break;case"right":h=t.panelWidth-u.width-o.width-n.gridpanel_padding_border_right-n.gridpanel_arrows_padding_hor}a=i.getElement();r.placeElement(a,h,n.gridpanel_padding_border_top);u=i.getSize();switch(n.gridpanel_arrows_align_vert){default:case"center":case"middle":s=(u.height-o.height)/2+u.top;break;case"top":s=n.gridpanel_padding_border_top+n.gridpanel_arrows_padding_vert;break;case"bottom":s=t.panelHeight-n.gridpanel_padding_border_bottom-n.gridpanel_arrows_padding_vert-o.height}switch(n.gridpanel_arrows_align_hor){default:case"borders":c=n.gridpanel_padding_border_left;l=t.panelWidth-n.gridpanel_padding_border_right-o.width;break;case"grid":c=u.left-n.gridpanel_arrows_padding_hor-o.width;l=u.right+n.gridpanel_arrows_padding_hor;break;case"center":c=(u.left-o.width)/2;l=u.right+(t.panelWidth-u.right-o.width)/2}r.placeElement(f,c,s);r.placeElement(e,l,s)}function lt(){var u,e=i.getSize(),f;switch(n.gridpanel_grid_align){default:case"left":u=n.gridpanel_padding_border_left;break;case"middle":case"center":u="center";break;case"right":u=t.panelWidth-e.width-n.gridpanel_padding_border_right}f=i.getElement();r.placeElement(f,u,n.gridpanel_padding_border_top)}function at(){t.arrowsVisible==!0?ct():lt()}function vt(){t.isHorType==!1?n.gridpanel_vertical_scroll==!0?ot():ht():at();o.placeElements()}var l=this,a=jQuery(this),s=new UniteGalleryMain,h,u,r=new UGFunctions,i=new UGThumbsGrid,o=new UGPanelsBase,e,f;this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"};var n={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!1,gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},p={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},w={gridpanel_grid_align:"center"},t={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};this.destroy=function(){f&&r.destroyButton(f);e&&r.destroyButton(e);o.destroy();i.destroy()};this.getOrientation=function(){return t.orientation};this.setOrientation=function(n){t.orientation=n;switch(n){case"right":case"left":t.isHorType=!1;break;case"top":case"bottom":t.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+n);}};this.setHeight=function(n){if(t.isHorType==!0)throw new Error("setHeight is not appliable to this orientatio ("+t.orientation+"). Please use setWidth");t.panelHeight=n;var r=tt();i.setMaxHeight(r)};this.setWidth=function(n){if(t.isHorType==!1)throw new Error("setWidth is not appliable to this orientatio ("+t.orientation+"). Please use setHeight");t.panelWidth=n;var r=it();i.setMaxWidth(r)};this.init=function(n,t){b(n,t)};this.setHtml=function(){d()};this.run=function(){k()};this.getElement=function(){return u};this.getSize=function(){return r.getElementSize(u)};this.__________Functions_From_Base_____=function(){};this.isPanelClosed=function(){return o.isPanelClosed()};this.getClosedPanelDest=function(){return o.getClosedPanelDest()};this.openPanel=function(n){o.openPanel(n)};this.closePanel=function(n){o.closePanel(n)};this.setOpenedState=function(n){o.setOpenedState(n)};this.setClosedState=function(n){o.setClosedState(n)};this.setDisabledAtStart=function(n){o.setDisabledAtStart(n)}}function UGThumbsGrid(){function rt(i,r,f){if(v=i.getObjects(),h=i,h.attachThumbsPanel("grid",u),a=jQuery(i),y=v.g_objWrapper,k=v.g_arrItems,f===!0&&(n.isTilesMode=!0),n.numThumbs=k.length,ht(r),n.isTilesMode==!0){s.setFixedMode();s.setApproveClickFunction(gt);s.init(i,t);var o=s.getOptions();n.tileMaxHeight=o.tile_height;n.tileMaxWidth=o.tile_width;e=s.getObjThumbs()}else r.thumb_fixed_size=!0,e.init(i,r)}function ut(t){var i=y;t&&(i=t);i.append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'><\/div><\/div>");f=i.children(".ug-thumbs-grid");o=f.children(".ug-thumbs-grid-inner");n.isTilesMode==!0?s.setHtml(o):e.setHtmlThumbs(o)}function ft(){if(n.isHorizontal==!1){if(n.gridHeight==0)throw new Error("You must set height before run.");}else if(n.gridWidth==0)throw new Error("You must set width before run.");}function et(){var i=h.getSelectedItem(),r,t;ft();n.isFirstTimeRun==!0?(ei(),n.isTilesMode==!0?(d(),w(),s.run()):(e.setHtmlProperties(),w(),e.loadThumbsImages())):n.isTilesMode==!0&&(r=d(),r==!0&&(w(),s.run()));vt();n.isFirstTimeRun==!0&&n.isTilesMode&&(t=e.getThumbs(),t.each(function(t,i){y.trigger(n.eventSizeChange,jQuery(i))}),t.fadeTo(0,1));i!=null&&g(i.index);c.trigger(u.events.PANE_CHANGE,n.currentPane);n.isFirstTimeRun=!1}function p(){var t;return n.isTilesMode==!0?s.getGlobalTileSize():e.getGlobalThumbSize()}function d(){if(n.isTilesMode==!1)throw new Error("Dynamic size can be set only in tiles mode");var i=!1,f=h.isMobileMode(),e=n.spaceBetweenCols;f==!0?(n.spaceBetweenCols=t.grid_space_between_mobile,n.spaceBetweenRows=t.grid_space_between_mobile):(n.spaceBetweenCols=t.grid_space_between_cols,n.spaceBetweenRows=t.grid_space_between_rows);n.spaceBetweenCols!=e&&(i=!0);var o=p(),c=o.width,u=n.tileMaxWidth,l=r.getNumItemsInSpace(n.gridWidth,n.tileMaxWidth,n.spaceBetweenCols);return l<t.grid_min_cols&&(u=r.getItemSizeInSpace(n.gridWidth,t.grid_min_cols,n.spaceBetweenCols)),s.setTileSizeOptions(u),u!=c&&(i=!0),i}function ot(){var e=p(),s=e.height,u=n.gridWidth,i=t.grid_num_rows*s+(t.grid_num_rows-1)*n.spaceBetweenRows+t.grid_padding*2;n.gridHeight=i;r.setElementSize(f,u,i);r.setElementSize(o,u,i);n.innerWidth=u;n.innerHeight=i}function st(){var e=p(),s=e.width,i=t.grid_num_cols*s+(t.grid_num_cols-1)*n.spaceBetweenCols+t.grid_padding*2,u=n.gridHeight;n.gridWidth=i;r.setElementSize(f,i,u);r.setElementSize(o,i,u);n.innerWidth=i;n.innerHeight=u}function w(){n.isHorizontal==!1?st():ot()}function g(n){var t=it(n);if(t==-1)return!1;u.gotoPane(t,"scroll")}function ht(i){t=jQuery.extend(t,i);e.setOptions(i);n.isNavigationVertical=t.grid_panes_direction=="top"||t.grid_panes_direction=="bottom";n.spaceBetweenCols=t.grid_space_between_cols;n.spaceBetweenRows=t.grid_space_between_rows}function ct(){var k=o.children(".ug-thumb-wrapper"),u=0,e=0,c=0,s=0,v=0,h=0,y,l,p,a,w,b;for(n.innerWidth=0,n.numPanes=1,n.arrPanes=[],n.numThumbsInPane=0,n.arrPanes.push(s),y=k.length,i=0;i<y;i++)l=jQuery(k[i]),r.placeElement(l,u,e),p=l.outerWidth(),a=l.outerHeight(),u>v&&(v=u),w=e+a,w>h&&(h=w),b=v+p,b>n.innerWidth&&(n.innerWidth=b),u+=p+n.spaceBetweenCols,c++,c>=t.grid_num_cols&&(e+=a+n.spaceBetweenRows,u=s,c=0),n.numPanes==1&&n.numThumbsInPane++,e+a>n.gridHeight&&(e=0,s=n.innerWidth+n.spaceBetweenCols,u=s,c=0,n.isMaxHeight==!0&&n.numPanes==1&&(n.gridHeight=h,f.height(n.gridHeight)),i<y-1&&(n.numPanes++,n.arrPanes.push(s)));o.width(n.innerWidth);n.isMaxHeight==!0&&n.numPanes==1&&(n.gridHeight=h,f.height(h))}function lt(){var w=o.children(".ug-thumb-wrapper"),h=0,u=0,e=0,c=0,l=0,b=0,p,a,k,v,s,y;for(n.innerWidth=0,n.numPanes=1,n.arrPanes=[],n.numThumbsInPane=0,n.arrPanes.push(l),p=w.length,i=0;i<p;i++)a=jQuery(w[i]),r.placeElement(a,h,u),k=a.outerWidth(),v=a.outerHeight(),h+=k+n.spaceBetweenCols,s=u+v,s>e&&(e=s),c++,c>=t.grid_num_cols&&(u+=v+n.spaceBetweenRows,h=l,c=0),n.numPanes==1&&n.numThumbsInPane++,s=u+v,y=b+n.gridHeight,s>y&&(n.isMaxHeight==!0&&n.numPanes==1&&(n.gridHeight=e,f.height(n.gridHeight),y=n.gridHeight),u=y+n.spaceBetweenRows,b=u,l=0,h=l,c=0,i<p-1&&(n.numPanes++,n.arrPanes.push(u)));o.height(e);n.innerHeight=e;n.isMaxHeight==!0&&n.numPanes==1&&(n.gridHeight=e,f.height(e))}function at(){var b=o.children(".ug-thumb-wrapper"),e=t.grid_padding,k=t.grid_padding,l=k,s=e,h=0,d=0,v=0,a=0,p=0,g,u,c;for(n.innerWidth=0,n.numPanes=1,n.arrPanes=[],n.numThumbsInPane=0,n.arrPanes.push(e-t.grid_padding),g=b.length,i=0;i<g;i++){var w=jQuery(b[i]),y=w.outerWidth(),nt=w.outerHeight();s-e+y>n.gridWidth&&(p++,l=0,p>=t.grid_num_rows?(p=0,e=s,l=k,v=0,n.numPanes==1&&(n.gridWidth=h+t.grid_padding,f.width(n.gridWidth),n.gridHeight=a+t.grid_padding,f.height(n.gridHeight)),n.numPanes++,n.arrPanes.push(e-t.grid_padding)):(s=e,l=v+n.spaceBetweenRows));r.placeElement(w,s,l);c=s+y;c>h&&(h=c);u=l+nt;u>v&&(v=u);u>a&&(a=u);u>d&&(d=u);c=h+y;c>n.innerWidth&&(n.innerWidth=c);s+=y+n.spaceBetweenCols;n.numPanes==1&&n.numThumbsInPane++}n.innerWidth=h+t.grid_padding;n.innerHeight=a+t.grid_padding;o.width(n.innerWidth);o.height(n.innerHeight);n.numPanes==1&&(n.gridWidth=h+t.grid_padding,n.gridHeight=a+t.grid_padding,f.width(n.gridWidth),f.height(n.gridHeight))}function vt(){n.isHorizontal==!1?n.isNavigationVertical?lt():ct():at()}function yt(t){if(t<0||t>=n.numThumbs)throw new Error("Thumb not exists: "+t);return!0}function pt(t){if(t>=n.numPanes||t<0)throw new Error("Pane "+index+" doesn't exists.");return!0}function wt(n){var t=tt(n);if(t==!1)return!1;o.css(t)}function nt(n){var i=tt(n);if(i==!1)return!1;o.stop(!0).animate(i,{duration:t.grid_transition_duration,easing:t.grid_transition_easing,queue:!1})}function b(){var t=-n.arrPanes[n.currentPane];nt(t)}function bt(){return n.isNavigationVertical==!0?n.gridHeight:n.gridWidth}function tt(t){var i={};return n.isNavigationVertical==!0?i.top=t+"px":i.left=t+"px",i}function l(){var t=r.getElementSize(o);return n.isNavigationVertical==!0?t.top:t.left}function it(t){if(yt(t)==!1)return-1;return Math.floor(t/n.numThumbsInPane)}function kt(){if(n.numPanes==1)return!1;var t=r.getStoredEventData(n.storedEventID),u=t.diffTime,f=l(),i=Math.abs(f-t.startInnerPos);return i>30?!0:i>5&&u>300?!0:!1}function dt(){var t=r.getStoredEventData(n.storedEventID),f=l(),i,u;return(diffPos=Math.abs(t.startInnerPos-f),i=bt(),u=Math.round(i*3/8),diffPos>=u)?!0:t.diffTime<300&&diffPos>25?!0:!1}function gt(){if(n.numPanes==1)return!0;return r.isApproveStoredEventClick(n.storedEventID,n.isNavigationVertical)}function ni(){if(kt()==!0)return!0;var n=jQuery(this),t=e.getItemByThumb(n);h.selectItem(t)}function ti(t){if(n.numPanes==1||n.touchActive==!0)return!0;n.isTilesMode==!1&&t.preventDefault();n.touchActive=!0;var i={startInnerPos:l()};r.storeEventData(t,n.storedEventID,i)}function ii(){if(t.grid_vertical_scroll_ondrag==!1||n.isNavigationVertical==!0)return!1;var i=r.handleScrollTop(n.storedEventID);return i==="vert"?!0:!1}function ri(i){var f,o;if(n.touchActive==!1||(i.preventDefault(),r.updateStoredEventData(i,n.storedEventID),f=r.getStoredEventData(n.storedEventID,n.isNavigationVertical),o=ii(),o))return!0;var e=f.diffMousePos,u=f.startInnerPos+e,s=e>0?"prev":"next",h=n.arrPanes[n.numPanes-1];t.grid_carousel==!1&&u>0&&s=="prev"&&(u=u/3);t.grid_carousel==!1&&u<-h&&s=="next"&&(u=f.startInnerPos+e/3);wt(u)}function ui(i){var f;if(n.touchActive==!1)return!0;if(r.updateStoredEventData(i,n.storedEventID),f=r.getStoredEventData(n.storedEventID,n.isNavigationVertical),n.touchActive=!1,dt()==!1)return b(),!0;var e=l(),o=e-f.startInnerPos,s=o>0?"prev":"next";s=="next"?t.grid_carousel==!1&&u.isLastPane()?b():u.nextPane():t.grid_carousel==!1&&u.isFirstPane()?b():u.prevPane()}function fi(){var n=h.getSelectedItem();e.setThumbSelected(n.objThumbWrapper);g(n.index)}function ei(){if(n.isTilesMode==!1){e.initEvents();var t=f.find(".ug-thumb-wrapper");t.on("click touchend",ni);a.on(h.events.ITEM_CHANGE,fi)}else s.initEvents();f.bind("mousedown touchstart",ti);jQuery("body").bind("mousemove touchmove",ri);jQuery(window).add("body").bind("mouseup touchend",ui)}var u=this,c=jQuery(this),h=new UniteGalleryMain,a,v,y,r=new UGFunctions,k,f,o,e=new UGThumbsGeneral,s=new UGTileDesign,t={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1},n;this.events={PANE_CHANGE:"pane_change"};n={eventSizeChange:"thumb_size_change",isHorizontal:!1,isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};this.destroy=function(){if(n.isTilesMode==!1){var t=f.find(".ug-thumb-wrapper");t.off("click");t.off("touchend");a.on(h.events.ITEM_CHANGE);e.destroy()}else s.destroy();f.unbind("mousedown");f.unbind("touchstart");jQuery("body").unbind("mousemove");jQuery("body").unbind("touchmove");jQuery(window).add("body").unbind("touchend");jQuery(window).add("body").unbind("mouseup");c.off(u.events.PANE_CHANGE)};this.__________EXTERNAL_GENERAL_________=function(){};this.setThumbUnselected=function(n){e.setThumbUnselected(n)};this.isItemThumbVisible=function(t){var i=t.index,r=it(i);return r==n.currentPane?!0:!1};this.__________EXTERNAL_API_________=function(){};this.getNumPanesEstimationByHeight=function(i){var u,r;n.isTilesMode==!0?r=t.tile_height:(u=e.getOptions(),r=u.thumb_height);var o=e.getNumThumbs(),f=Math.ceil(o/t.grid_num_cols),s=f*r+(f-1)*n.spaceBetweenRows;return Math.ceil(s/i)};this.getNumPanesEstimationByWidth=function(i){var u,r;n.isTilesMode?r=t.tile_width:(u=e.getOptions(),r=u.thumb_width);var o=e.getNumThumbs(),f=Math.ceil(o/t.grid_num_rows),s=f*r+(f-1)*n.spaceBetweenCols;return Math.ceil(s/i)};this.getHeightEstimationByWidth=function(i){var f;if(n.isTilesMode==!1)throw new Error("This function works only with tiles mode");var o=e.getNumThumbs(),s=r.getNumItemsInSpace(i,t.tile_width,n.spaceBetweenCols),u=Math.ceil(o/s);return u>t.grid_num_rows&&(u=t.grid_num_rows),f=r.getSpaceByNumItems(u,t.tile_height,n.spaceBetweenRows),f+t.grid_padding*2};this.getElement=function(){return f};this.getSize=function(){return r.getElementSize(f)};this.getNumPanes=function(){return n.numPanes};this.isFirstPane=function(){return n.currentPane==0?!0:!1};this.isLastPane=function(){return n.currentPane==n.numPanes-1?!0:!1};this.getPaneInfo=function(){return{pane:n.currentPane,total:n.numPanes}};this.getPane=function(){return n.currentPane};this.setWidth=function(t){n.gridWidth=t;n.isHorizontal=!0};this.setMaxWidth=function(t){n.gridWidth=t;n.isMaxWidth=!0;n.isHorizontal=!0};this.setHeight=function(t){n.gridHeight=t;n.isHorizontal=!1};this.setMaxHeight=function(t){n.gridHeight=t;n.isMaxHeight=!0;n.isHorizontal=!1};this.gotoPane=function(t){if(pt(t)==!1||t==n.currentPane)return!1;var i=-n.arrPanes[t];n.currentPane=t;nt(i);c.trigger(u.events.PANE_CHANGE,t)};this.nextPane=function(){var i=n.currentPane+1;if(i>=n.numPanes){if(t.grid_carousel==!1)return!0;i=0}u.gotoPane(i,"next")};this.prevPane=function(){var i=n.currentPane-1;if(i<0&&(i=n.numPanes-1,t.grid_carousel==!1))return!1;u.gotoPane(i,"prev")};this.attachNextPaneButton=function(n){if(r.setButtonOnClick(n,u.nextPane),t.grid_carousel==!0)return!0;u.isLastPane()&&n.addClass("ug-button-disabled");c.on(u.events.PANE_CHANGE,function(){u.isLastPane()?n.addClass("ug-button-disabled"):n.removeClass("ug-button-disabled")})};this.attachPrevPaneButton=function(n){if(r.setButtonOnClick(n,u.prevPane),t.grid_carousel==!0)return!0;u.isFirstPane()&&n.addClass("ug-button-disabled");c.on(u.events.PANE_CHANGE,function(){u.isFirstPane()?n.addClass("ug-button-disabled"):n.removeClass("ug-button-disabled")})};this.attachBullets=function(t){t.setActive(n.currentPane);jQuery(t).on(t.events.BULLET_CLICK,function(n,i){u.gotoPane(i,"theme");t.setActive(i)});jQuery(u).on(u.events.PANE_CHANGE,function(n,i){t.setActive(i)})};this.getObjTileDesign=function(){return s};this.init=function(n,t,i){rt(n,t,i)};this.run=function(){et()};this.setHtml=function(n){ut(n)}}function UGTiles(){function ti(n,t){g_objects=n.getObjects();c=n;p=jQuery(n);w=g_objects.g_objWrapper;ni=g_objects.g_arrItems;i=jQuery.extend(i,t);ii();u.init(n,i);s=u.getObjThumbs()}function ii(){i.tiles_min_columns<1&&(i.tiles_min_columns=1);i.tiles_max_columns!=0&&i.tiles_max_columns<i.tiles_min_columns&&(i.tiles_max_columns=i.tiles_min_columns)}function ri(n){var n,t;n||(n=e?e:w);e=n;t=i.tiles_type;n.addClass("ug-tiletype-"+t);u.setHtml(n);n.children(".ug-thumb-wrapper").hide()}function nt(){if(e.addClass("ug-tiles-rest-mode"),f.isTransInited=!0,i.tiles_enable_transition==!0){e.addClass("ug-tiles-transit");var n=u.getOptions();n.tile_enable_image_effect==!0&&n.tile_image_effect_reverse==!1&&e.addClass("ug-tiles-transit-overlays");f.isTransActive=!0}}function a(){return o.getElementSize(e).width}function tt(){if(f.isTransInited==!1||(e.addClass("ug-tiles-transition-active"),e.removeClass("ug-tiles-rest-mode"),f.isTransActive==!1))return!1;u.disableEvents()}function it(){if(f.isTransInited==!1)return!1;e.removeClass("ug-tiles-transition-active");e.addClass("ug-tiles-rest-mode")}function rt(){f.isTransActive==!0?(setTimeout(function(){u.enableEvents();u.triggerSizeChangeEventAllTiles();it()},800),f.handle&&clearTimeout(f.handle),f.handle=setTimeout(function(){it();u.triggerSizeChangeEventAllTiles();f.handle=null},2e3)):(u.triggerSizeChangeEventAllTiles(),it())}function et(){t.colWidth=(t.availWidth-t.colGap*(t.numCols-1))/t.numCols;t.colWidth=Math.floor(t.colWidth);t.totalWidth=o.getSpaceByNumItems(t.numCols,t.colWidth,t.colGap)}function d(){var n,r;t.colWidth=i.tiles_col_width;t.minCols=i.tiles_min_columns;t.maxCols=i.tiles_max_columns;t.colGap=c.isMobileMode()==!1?i.tiles_space_between_cols:i.tiles_space_between_cols_mobile;t.galleryWidth=a();t.availWidth=t.galleryWidth;i.tiles_include_padding==!0&&(t.availWidth=t.galleryWidth-t.colGap*2);i.tiles_exact_width==!0?(t.numCols=o.getNumItemsInSpace(t.availWidth,t.colWidth,t.colGap),t.maxCols>0&&t.numCols>t.maxCols&&(t.numCols=t.maxCols),t.numCols<t.minCols?(t.numCols=t.minCols,et()):t.totalWidth=t.numCols*(t.colWidth+t.colGap)-t.colGap):(n=o.getNumItemsInSpaceRound(t.availWidth,t.colWidth,t.colGap),n<t.minCols?n=t.minCols:t.maxCols!=0&&n>t.maxCols&&(n=t.maxCols),t.numCols=n,et());switch(i.tiles_align){case"center":default:t.addX=Math.round((t.galleryWidth-t.totalWidth)/2);break;case"left":t.addX=0;break;case"right":t.addX=t.galleryWidth-t.totalWidth}for(t.arrPosx=[],col=0;col<t.numCols;col++)r=o.getColX(col,t.colWidth,t.colGap),t.arrPosx[col]=r+t.addX}function ot(){t.maxColHeight=0;t.colHeights=[0]}function ui(){var n=0,i=999999999;for(col=0;col<t.numCols;col++){if(t.colHeights[col]==undefined||t.colHeights[col]==0)return col;t.colHeights[col]<i&&(n=col,i=t.colHeights[col])}return n}function ut(n,r,f,s){var s,h,c,a,v,l;if((s===null||typeof s=="undefined")&&(s=ui()),h=0,t.colHeights[s]!==undefined&&(h=t.colHeights[s]),c=u.getTileHeightByWidth(t.colWidth,n),c===null){if(i.tiles_enable_transition==!0)throw new Error("Can't know tile height, please turn off transition");a=o.getElementSize(n);c=a.height}v=t.arrPosx[s];o.placeElement(n,v,h);l=h+c;t.colHeights[s]=l+t.colGap;t.maxColHeight<l&&(t.maxColHeight=l);r==!0&&n.show().fadeTo(0,1);f==!0&&e.height(t.maxColHeight)}function g(n){var h,r,l,c,a;for(n||(n=!1),d(),ot(),h=s.getThumbs(s.type.GET_THUMBS_RATIO),tt(),u.resizeAllTiles(t.colWidth,u.resizemode.VISIBLE_ELEMENTS,h),r=0;r<h.length;r++)l=jQuery(h[r]),c=undefined,i.tiles_keep_order==!0&&(c=o.getColByIndex(t.numCols,r)),ut(l,n,!1,c);rt();a=e.height();f.isTransActive==!0&&a>t.maxColHeight?setTimeout(function(){e.height(t.maxColHeight)},700):e.height(t.maxColHeight)}function fi(n){var r=n.index(),f=c.getItem(r),i,u;return f.ordered_placed===!0?!1:(i=o.getPrevRowSameColIndex(r,t.numCols),i<0)?!0:(u=c.getItem(i),u.ordered_placed===!0)?!0:!1}function st(n,i){var h,l,r;if(i!==!0&&(h=fi(n),h==!1))return!1;var f=n.index(),a=o.getColByIndex(t.numCols,f),v=c.getItem(f);if(u.resizeTile(n,t.colWidth),ut(n,!0,!0,a),v.ordered_placed=!0,l=c.getNumItems(),r=o.getNextRowSameColIndex(f,t.numCols),r>=l)return!1;var e=s.getThumbByIndex(r),y=c.getItem(r),p=s.isThumbLoaded(e);s.isThumbLoaded(e)&&!y.ordered_placed&&st(e,!0)}function ei(n,r){if(r==!0)return!1;n=jQuery(n);var f=jQuery(n).parent();s.triggerImageLoadedEvent(f,n);i.tiles_keep_order==!0?st(f):(u.resizeTile(f,t.colWidth),ut(f,!0,!0))}function ht(){var n=s.getThumbs(s.type.GET_THUMBS_NO_RATIO),r;if(!n||n.length==0)return!1;if(f.isAllLoaded=!1,f.isFirstPlaced==!0&&(d(),ot(),r=Math.abs(t.galleryWidth-t.totalWidth),i.tiles_set_initial_height==!0&&o.isScrollbarExists()==!1&&r<25)){var p=n.length,u=Math.ceil(n.length/t.numCols),h=u*i.tiles_col_width*.75;e.height(h);d()}n.fadeTo(0,0);var a=n.find("img.ug-thumb-image"),v=t.numCols,y=t.galleryWidth;o.checkImagesLoaded(a,function(){d();(v!=t.numCols||y!=t.galleryWidth)&&g(!1);nt();k.trigger(l.events.ALL_TILES_LOADED)},function(n,t){f.isFirstPlaced==!0&&c.triggerEvent(l.events.TILES_FIRST_PLACED);ei(n,t)})}function ct(){var e=a(),o=s.getThumbs(!0),t=i.tiles_justified_row_height,h=[],c=0,l=i.tiles_justified_space_between,p=o.length,r;jQuery.each(o,function(n,i){i=jQuery(i);var r=s.getItemByThumb(i),u=r.thumbWidth,f=r.thumbHeight;f!==t&&(u=Math.floor(r.thumbRatioByWidth*t));h[n]=u;c+=u});r=Math.ceil(c/e);r>p&&(r=p);var g=c/r,n=[],u=0,v=[],f=[],w=0,b=0;jQuery.each(o,function(t,i){var r=h[t];w+r/2>(b+1)*g&&(v[n.length]=u,n.push(f),f=[],u=0,b++);w+=r;u+=r;f.push(i)});v[n.length]=u;n.push(f);var k=[],d=[],y=0;return jQuery.each(n,function(n,i){var b=i.length,c=v[n],o=(i.length-1)*l,a=(e-o)/c,f=Math.round(t*a),u,w;y+=f;n>0&&(y+=l);d.push(f);var p=f/t,r=[],s=o;jQuery.each(i,function(n,t){var u=jQuery(t),f=u.index(),e=h[f],i=Math.round(e*p);r[n]=i;s+=i});u=s-e;w=0;jQuery.each(r,function(n,t){if(u==0)return!1;u<0?(r[n]=t+1,u++):(r[n]=t-1,u--);n==r.length-1&&u!=0&&(r[n]-=u)});k[n]=r}),{arrRows:n,arrRowWidths:k,arrRowHeights:d,gap:l,totalHeight:y}}function lt(n){var n,f,t,s,i,r;n||(n=!1);f=a();t=ct();e.height(t.totalHeight);s=a();s!=f&&(t=ct());tt();i=0;r=0;jQuery.each(t.arrRows,function(f,e){var c=t.arrRowWidths[f],h=t.arrRowHeights[f],s=0;jQuery.each(e,function(f,e){var l=jQuery(e),v=h,a=c[f];u.resizeTile(l,a,v,u.resizemode.VISIBLE_ELEMENTS);o.placeElement(l,s,i);s+=a;s>r&&(r=s);s+=t.gap;n==!0&&jQuery(e).show()});i+=h+t.gap});rt()}function oi(){var t=jQuery(w).find("img.ug-thumb-image"),n=s.getThumbs();f.isAllLoaded=!1;n.fadeTo(0,0);o.checkImagesLoaded(t,function(){setTimeout(function(){lt(!0);n.fadeTo(0,1);c.triggerEvent(l.events.TILES_FIRST_PLACED);nt();k.trigger(l.events.ALL_TILES_LOADED)})},function(n){n=jQuery(n);var t=jQuery(n).parent();s.triggerImageLoadedEvent(t,n)})}function si(){var n=jQuery(w).find("img.ug-thumb-image"),t=s.getThumbs();f.isAllLoaded=!1;t.fadeTo(0,0);o.checkImagesLoaded(n,function(){c.isMobileMode()==!0?g(!0):vt(!0);c.triggerEvent(l.events.TILES_FIRST_PLACED);nt();k.trigger(l.events.ALL_TILES_LOADED)},function(n){n=jQuery(n);var t=jQuery(n).parent();s.triggerImageLoadedEvent(t,n)})}function at(){var t=a(),u;n.galleryWidth=t;r={};n.colWidth=i.tiles_nested_col_width;n.optimalTileWidth=i.tiles_nested_optimal_tile_width;n.currentGap=i.tiles_space_between_cols;c.isMobileMode()==!0&&(n.currentGap=i.tiles_space_between_cols_mobile);n.colWidth==null?n.colWidth=Math.floor(n.optimalTileWidth/n.nestedOptimalCols):n.nestedOptimalCols=n.optimalTileWidth>n.colWidth?Math.ceil(n.optimalTileWidth/n.colWidth):1;n.maxColumns=o.getNumItemsInSpace(t,n.colWidth,n.currentGap);n.colWidth=o.getItemSizeInSpace(t,n.maxColumns,n.currentGap);n.gridY=0;h=[];u=s.getThumbs(!0);u.each(function(){var n=jQuery(this),t=hi(n);h.push(t)});n.nestedOptimalCols=n.optimalTileWidth>n.colWidth?Math.ceil(n.optimalTileWidth/n.colWidth):1;n.totalWidth=n.maxColumns*(n.colWidth+n.currentGap)-n.currentGap;switch(i.tiles_align){case"center":default:n.addX=Math.round((n.galleryWidth-n.totalWidth)/2);break;case"left":n.addX=0;break;case"right":n.addX=n.galleryWidth-n.totalWidth}n.maxGridY=0}function vt(t){var f=a(),r,u;at();yt();r=n.maxGridY*(n.colWidth+n.currentGap)-n.currentGap;e.height(r);u=a();u!=f&&(at(),yt());i.tiles_nested_debug==!1&&nr(t)}function hi(t){var r,f,i={},s=n.colWidth,h=n.currentGap,c=u.getTileImageSize(t),v=t.index(),l=Math.ceil(ci(v)*(n.nestedOptimalCols/3)+n.nestedOptimalCols*2/3),e=c.width,o=c.height,a=e/o;return e>o?(r=l,f=Math.round(r/a),f==0&&(f=1)):(f=l,r=Math.round(f*a),r==0&&(r=1)),i.dimWidth=r,i.dimHeight=f,i.width=r*s+h*(r-1),i.height=f*s+h*(f-1),i.imgWidth=e,i.imgHeight=o,i.left=0,i.top=0,i}function ci(n){return Math.abs(Math.sin(Math.abs(Math.sin(n)*1e3)))}function li(t,i){var r;if(i==!1){for(r=n.currentItem;r<h.length;r++)ft(r,!0);n.currentItem=h.length-1}else ft(n.currentItem,!0);for(r=0;r<=n.currentItem;r++)gt(r,!0);n.currentItem++}function yt(n){if(i.tiles_nested_debug==!0)return typeof n=="undefined"&&(n=!0),li(!0,n),!1;for(var t=0;t<h.length;t++)ft(t,!0)}function ft(t,i){var i,e,f,u,s;for(i||(i=!1),n.maxColHeight=0,e=o.getObjectLength(r),f=n.gridY;f<=e+1;f++){for(u=0;u<n.maxColumns;u++)if(y(n.gridY)==!1||dt(n.gridY,u)==!1){s=ki(u);ai(t,s,u);return}n.gridY++}}function ai(t,i,r){var u=jQuery.extend(!0,{},h[t]),o=u.dimWidth,y=i-u.dimWidth,e=n.nestedOptimalCols,d=i<=u.dimWidth||y<=.33*e||i<=e,c,f,l,s,w,k;if(d)v(t,i);else if(y<=e)e>=4?bt(Math.floor(i/2),r)==!0?v(t,Math.floor(i/2)+1):v(t,Math.floor(i/2)):v(objImage,i);else if(bt(o,r)==!0)switch(o>=e){case!0:v(t,o-1);break;case!1:v(t,o+1)}if(u=jQuery.extend(!0,{},h[t]),c=wi(t,u.dimWidth,r),n.columnsValueToEnableHeightResize<=c[0]&&n.maxColumns>=2*n.nestedOptimalCols){f=bi(r,u);l=b(t,f.newHeight,!0);h[t].dimHeight=l.dimHeight;var a=pi(c,l.dimWidth,r),g=vi(a),p=!1;if(g>=2&&(p=!0),f.newHeight>=u.dimHeight&&(u=b(t,f.newHeight,!0)),s=yi(f.idToResize,f.newHeight,u.dimHeight),u.top=n.gridY,u.left=r,s.push({tileID:t,sizes:u}),w=wt(s),k=wt(a),w<k||p==!0){pt(s);return}pt(a);return}u.left=r;u.top=n.gridY;h[t]=u;kt(t,u,r,n.gridY);n.maxGridY=u.top+u.dimHeight}function vi(t){for(var o=0,s=0,u=0;u<t.length-1;u++){var i=t[u].sizes,f=-1,e=-1;y(i.top+i.dimHeight)&&n.maxColumns>i.left+i.dimWidth&&(f=r[i.top+i.dimHeight-1][i.left+i.dimWidth],e=r[i.top+i.dimHeight][i.left+i.dimWidth]);f!=e&&o++}for(u=0;u<t.length-1;u++){var i=t[u].sizes,f=-1,e=-1;y(i.top+i.dimHeight)&&i.left-1>=0&&(f=r[i.top+i.dimHeight-1][i.left-1],e=r[i.top+i.dimHeight][i.left-1]);f!=e&&s++}return Math.max(s,o)}function yi(t,i,r){var u=h[t],e=u.dimHeight,a=u.dimWidth,o=u.left,s=u.top,v=parseInt(s/(n.colWidth+n.currentGap)),y=parseInt(o/(n.colWidth+n.currentGap)),c=e-i+r,l=b(t,c,!0),f=[];return f.push({tileID:t,sizes:l}),f}function pt(n){for(var i,r,t=0;t<n.length;t++)i=n[t].sizes,r=n[t].tileID,h[r]=jQuery.extend(!0,{},i),kt(r,i,i.left,i.top)}function pi(n,t){for(var f,r,l,a,u,o,y=0,s=0,e=[],p=0,c=0,i=0;i<n[1].length;i++){if(u=n[1][i],f=h[n[1][i]],s+=f.dimHeight,i==0){r=v(u,t,!0);y+=r.dimHeight;e.push([n[1][i],r.dimHeight]);continue}y+=f.dimHeight;e.push([u,f.dimHeight])}for(p=f.left,c=f.top,l=s,a=[],i=e.length-1;i>=0;i--)u=e[i][0],i!=0?(o=Math.max(Math.round(s/3),Math.floor(e[i][1]*(s/y))),l=l-o,r=b(u,o,!0),r.left=p,r.top=c,a.push({tileID:u,sizes:r}),c+=r.dimHeight):(o=l,r=b(u,o,!0),r.left=p,r.top=c,a.push({tileID:u,sizes:r}));return a}function wi(t,i,u){var f=n.gridY-1,o=0,h=0,c=1,s=[],e=[];if(s.push(t),f>=0){for(h=0;f>=0;){if(o=r[f][u],(typeof r[f][u-1]=="undefined"||r[f][u-1]!=r[f][u])&&(typeof r[f][u+i]=="undefined"||r[f][u+i-1]!=r[f][u+i])&&r[f][u]==r[f][u+i-1])h!=o&&(c++,s.push(o));else return e.push(c),e.push(s),e;f--;h=o}return e.push(c),e.push(s),e}return[0,[]]}function bi(t,i){var f=0,e=0,c=i.dimWidth,l=i.dimHeight,a=0,v=0,s=jQuery.map(r,function(n){return[n]}),u,o,h;if(typeof s[n.gridY]=="undefined"||typeof s[n.gridY][t-1]=="undefined")e=0;else for(u=0;;)if(typeof r[n.gridY+u]!="undefined"&&r[n.gridY+u][t-1]!=-1)a=r[n.gridY+u][t-2],u++,e++;else break;if(typeof s[n.gridY]=="undefined"||typeof s[n.gridY][t+c]=="undefined")f=0;else for(u=0;;)if(typeof r[n.gridY+u]!="undefined"&&r[n.gridY+u][t+c]!=-1)v=r[n.gridY+u][t+c+1],u++,f++;else break;return o=0,h=0,Math.abs(l-e)<Math.abs(l-f)&&e!=0?(o=e,h=a):f!=0?(o=f,h=v):o=l,{newHeight:o,idToResize:h}}function v(t,i,r){var f;r||(r=!1);var e=n.colWidth,o=n.currentGap,u=h[t],s=u.imgWidth,c=u.imgHeight,l=s/c;if(dimWidth=i,dimHeight=Math.round(dimWidth/l),r==!0)return f=jQuery.extend(!0,{},u),f.dimWidth=dimWidth,f.dimHeight=dimHeight,f.width=dimWidth*e+o*(dimWidth-1),f.height=dimHeight*e+o*(dimHeight-1),f;u.dimWidth=dimWidth;u.dimHeight=dimHeight;u.width=dimWidth*e+o*(dimWidth-1);u.height=dimHeight*e+o*(dimHeight-1)}function b(t,i,r){var f;r||(r=!1);var u=h[t],e=u.dimWidth,o=n.colWidth,s=n.currentGap;if(r==!0)return f=jQuery.extend(!0,{},u),f.dimHeight=i,f.width=e*o+s*(e-1),f.height=i*o+s*(i-1),f;u.dimHeight=i;u.width=e*o+s*(e-1);u.height=i*o+s*(i-1)}function wt(n){for(var t,r=0,u=0,i=0;i<n.length;i++){if(t=h[n[i].tileID],t.dimHeight!=0&&t.height!=0)resizeVal=t.dimWidth/t.dimHeight/(t.imgWidth/t.imgHeight);else return;resizeVal<1&&(resizeVal=1/resizeVal);r+=resizeVal;u++}return r/u}function bt(t,i){var u=n.gridY-1;return u<=0||y(u)==!1?!1:r[u][i+t-1]!=r[u][i+t]?!0:!1}function ki(t){var r=t,i=0;if(y(n.gridY)==!0)while(dt(n.gridY,r)==!1)i++,r++;else i=n.maxColumns;return i}function y(n){return typeof r[n]=="undefined"?!1:!0}function kt(n,t,i,r){for(var f,u=0;u<t.dimHeight;u++)for(f=0;f<t.dimWidth;f++)y(r+u)==0&&di(r+u),gi(r+u,i+f,n)}function di(t){r[t]={};for(var i=0;i<n.maxColumns;i++)r[t][i]=-1}function dt(n,t){return r[n][t]!=-1}function gi(n,t,i){r[n][t]=i}function nr(t){var t,i;for(t||(t=!1),tt(),i=0;i<h.length;i++)gt(i,t);e.height(n.maxColHeight);rt()}function gt(t,i){var f=s.getThumbByIndex(t),r=h[t],e=r.top*(n.colWidth+n.currentGap),c=n.addX+r.left*(n.colWidth+n.currentGap);u.resizeTile(f,r.width,r.height,u.resizemode.VISIBLE_ELEMENTS);o.placeElement(f,c,e);e+r.height>n.maxColHeight&&(n.maxColHeight=e+r.height);i==!0&&f.fadeTo(0,1)}function tr(){if(f.isFirstTimeRun==!0)return!0;if(f.isAllLoaded==!1)return!1;switch(i.tiles_type){case"columns":g(!1);break;case"justified":lt(!1);break;case"nested":var n=c.isMobileMode();n==!0?g(!1):vt(!1)}}function ir(){k.on(l.events.ALL_TILES_LOADED,function(){f.isAllLoaded=!0});p.on(c.events.SIZE_CHANGE,tr);p.on(l.events.TILES_FIRST_PLACED,function(){f.isFirstPlaced=!1});u.initEvents()}function rr(){w.children(".ug-tile").show();f.isFirstTimeRun==!0&&ir();u.run();switch(i.tiles_type){default:case"columns":ht();break;case"justified":oi();break;case"nested":si()}f.isFirstTimeRun=!1}var l=this,k=jQuery(this),c=new UniteGalleryMain,p,w,e,o=new UGFunctions,ni,u=new UGTileDesign,s=new UGThumbsGeneral,t={},r,h,i={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0},f,n;this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"};f={isFirstTimeRun:!0,handle:null,isTransActive:!1,isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1};n={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};this.destroy=function(){p.off(c.events.SIZE_CHANGE);u.destroy();p.off(l.events.TILES_FIRST_PLACED)};this.init=function(n,t){ti(n,t)};this.setHtml=function(n){ri(n)};this.getObjTileDesign=function(){return u};this.run=function(){rr()};this.runNewItems=function(){if(!e)throw new Error("Can't run new items - parent not set");u.setHtml(e,!0);u.run(!0);switch(i.tiles_type){case"columns":ht();break;default:case"justified":case"nested":throw new Error("Tiles type: "+i.tiles_type+" not support load more yet");}}}function UGTileDesign(){function ht(u,f){var h,c,s,l;e=u;et=jQuery(u);h=e.getObjects();o=h.g_objWrapper;ot=e.getArrItems();n=jQuery.extend(n,st);n=jQuery.extend(n,f);ct();i.init(u,n);c={allow_onresize:!1};s=["overlay"];t.funcCustomTileHtml&&(s=[]);i.setCustomThumbs(lt,s,c);l=i.getOptions();n=jQuery.extend(n,l);t.ratioByWidth=n.tile_width/n.tile_height;t.ratioByHeight=n.tile_height/n.tile_width;n.tile_size_by==r.sizeby.GLOBAL_RATIO&&t.isTextpanelOutside&&(t.hasImageContainer=!0)}function ct(){if(n.tile_enable_overlay==!0?(n.thumb_overlay_opacity=n.tile_overlay_opacity,n.thumb_overlay_color=n.tile_overlay_color):n.tile_enable_icons==!1?n.thumb_color_overlay_effect=!1:n.thumb_overlay_opacity=0,n.tile_as_link&&(n.thumb_wrapper_as_link=!0,n.thumb_link_newpage=n.tile_link_newpage),n.tile_enable_outline==!0&&n.tile_enable_border==!1&&(n.tile_enable_outline=!1),t.tileInnerReduce=0,n.tile_enable_border&&(t.tileInnerReduce=n.tile_border_width*2,i.setThumbInnerReduce(t.tileInnerReduce)),t.isSaparateIcons=!u.isRgbaSupported(),n.tile_enable_textpanel==!0){switch(n.tile_textpanel_position){case"top":n.tile_textpanel_align="top";case"bottom":t.isTextpanelOutside=!0;n.tile_textpanel_always_on=!0;n.tile_textpanel_offset=0;break;case"inside_top":n.tile_textpanel_align="top";break;case"middle":n.tile_textpanel_align="middle";n.tile_textpanel_appear_type="fade"}n.tile_textpanel_always_on==!1&&(t.isSaparateIcons=!0)}n.tile_textpanel_offset!=0&&(n.tile_textpanel_appear_type="fade",n.tile_textpanel_margin=n.tile_textpanel_offset);n.tile_textpanel_source=="title_and_desc"&&(n.tile_textpanel_enable_description=!0,n.tile_textpanel_desc_style_as_title=!0)}function p(){var i=e.isMobileMode();t.isTextPanelHidden=!1;i==!0&&n.tile_textpanel_always_on==!1&&(t.isTextPanelHidden=!0);t.isVideoplayIconAlwaysOn=n.tile_videoplay_icon_always_on;switch(n.tile_videoplay_icon_always_on){case"always":t.isVideoplayIconAlwaysOn=!0;break;case"never":t.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":t.isVideoplayIconAlwaysOn=i==!0?!0:!1;break;case"desktop_only":t.isVideoplayIconAlwaysOn=i==!1?!0:!1}}function lt(i,f){var a,rt,w,o,h,v,b,ut,k,d,g,y,nt,tt,et,c,ft,l,it,ot,st,ht,p;if(i.addClass("ug-tile"),t.funcCustomTileHtml)return t.funcCustomTileHtml(i,f),!1;if(a="",t.hasImageContainer==!0&&(a+="<div class='ug-image-container ug-trans-enabled'>"),rt="ug-thumb-image",(n.tile_enable_image_effect==!1||n.tile_image_effect_reverse==!0)&&(rt+=" ug-trans-enabled"),w=u.stripTags(f.title),w=u.htmlentitles(w),a+='<img src="'+u.escapeDoubleSlash(f.urlThumb)+"\" alt='"+w+"' class='"+rt+"'>",t.hasImageContainer==!0&&(a+="<\/div>"),i.append(a),n.tile_size_by==r.sizeby.GLOBAL_RATIO&&i.fadeTo(0,0),o={},n.tile_enable_background==!0&&(o["background-color"]=n.tile_background_color),n.tile_enable_border==!0&&(o["border-width"]=n.tile_border_width+"px",o["border-style"]="solid",o["border-color"]=n.tile_border_color,n.tile_border_radius&&(o["border-radius"]=n.tile_border_radius+"px")),n.tile_enable_outline==!0&&(o.outline="1px solid "+n.tile_outline_color),n.tile_enable_shadow==!0&&(h=n.tile_shadow_h+"px ",h+=n.tile_shadow_v+"px ",h+=n.tile_shadow_blur+"px ",h+=n.tile_shadow_spread+"px ",h+=n.tile_shadow_color,o["box-shadow"]=h),i.css(o),v="",n.tile_enable_icons?(n.tile_as_link==!1&&n.tile_enable_action==!0&&(b="ug-button-play ug-icon-zoom",f.type!="image"&&(b="ug-button-play ug-icon-play"),v+="<div class='ug-tile-icon "+b+"' style='display:none'><\/div>"),(f.link&&n.tile_show_link_icon==!0||n.tile_as_link==!0)&&(n.tile_as_link==!1?(ut="",n.tile_link_newpage==!0&&(ut=" target='_blank'"),v+="<a href='"+f.link+"'"+ut+" class='ug-tile-icon ug-icon-link'><\/a>"):v+="<div class='ug-tile-icon ug-icon-link' style='display:none'><\/div>"),k=t.isSaparateIcons,k==!1&&f.type!="image"&&t.isVideoplayIconAlwaysOn==!0&&(k=!0),d=k?i:i.children(".ug-thumb-overlay"),d.append(v),g=d.children("."+b),g.length==0?g=null:g.hide(),y=d.children(".ug-icon-link"),y.length==0?y=null:y.hide(),y||n.tile_enable_action!=!0||i.addClass("ug-tile-clickable")):n.tile_enable_action==!0&&i.addClass("ug-tile-clickable"),n.tile_enable_image_effect==!0&&(nt="",n.tile_image_effect_reverse==!1&&(nt=" ug-trans-enabled"),tt="<div class='ug-tile-image-overlay"+nt+"' >",et=" ug-"+n.tile_image_effect_type+"-effect",tt+='<img src="'+u.escapeDoubleSlash(f.urlThumb)+"\" alt='"+f.title+"' class='"+et+nt+"'>",tt+="<\/div>",i.append(tt),n.tile_image_effect_reverse==!0&&i.children(".ug-tile-image-overlay").fadeTo(0,0)),n.tile_enable_textpanel==!0){c=new UGTextPanel;c.init(e,n,"tile");ft="";(n.tile_textpanel_always_on==!0||t.isTextpanelOutside==!0)&&(ft="ug-trans-enabled");c.appendHTML(i,ft);l=f.title;it="";switch(n.tile_textpanel_source){case"desc":case"description":l=f.description;break;case"desc_title":f.description!=""&&(l=f.description);break;case"title_and_desc":l=f.title;it=f.description}c.setTextPlain(l,it);n.tile_textpanel_always_on==!1&&c.getElement().fadeTo(0,0);i.data("objTextPanel",c);n.tile_textpanel_always_on==!0&&(ot=s(i),ot.css("z-index",2));t.isTextpanelOutside==!0&&(st="<div class='ug-tile-cloneswrapper'><\/div>",i.append(st),ht=i.children(".ug-tile-cloneswrapper"),p=new UGTextPanel,p.init(e,n,"tile"),p.appendHTML(ht),p.setTextPlain(l,it),i.data("objTextPanelClone",p))}f.addHtml!==null&&i.append(f.addHtml)}function w(n){return n.children(".ug-tile-image-overlay")}function at(n){return n.children(".ug-thumb-overlay")}function vt(n){if(t.hasImageContainer==!1)return null;return n.children(".ug-image-container")}function yt(n){return n.find(".ug-tile-image-overlay img")}function b(n){return n.data("objTextPanel")}function pt(n){return n.data("objTextPanelClone")}function s(n){return n.children(".ug-textpanel")}function wt(n){var t=n.find(".ug-tile-cloneswrapper .ug-textpanel");if(t.length==0)throw new Error("text panel cloned element not found");return t}function h(n){var i,r;return(i=t.isTextpanelOutside==!0?wt(n):s(n),!i)?0:(r=u.getElementSize(i),r.height)}function k(n){var t=n.find(".ug-icon-link");return t.length==0?null:t}function bt(i){var f=t.ratioByHeight,u;switch(n.tile_size_by){default:f=t.ratioByHeight;break;case r.sizeby.IMAGE_RATIO:if(!i)throw new Error("tile should be given for tile ratio");if(u=r.getItemByTile(i),typeof u.thumbRatioByHeight!="undefined"){if(u.thumbRatioByHeight==0){trace(u);throw new Error("the item ratio not inited yet");}f=u.thumbRatioByHeight}break;case r.sizeby.CUSTOM:return null}return f}function d(n){var t=n.find(".ug-button-play");return t.length==0?null:t}function c(n){return n.hasClass("ug-thumb-over")?!0:!1}function g(n){return n.hasClass("ug-tile-clickable")}function nt(i){return n.tile_enable_icons==!0&&t.isVideoplayIconAlwaysOn==!0&&i.type!="image"?!0:!1}function tt(i,f,e,o){var y=w(i),c=r.getTileImage(i),p=yt(i),s,a,v,l;f-=t.tileInnerReduce;e-=t.tileInnerReduce;s=null;t.isTextpanelOutside==!0&&(a=h(i),e-=a,n.tile_textpanel_position=="top"&&(s=a),t.hasImageContainer==!0&&(v=vt(i),u.setElementSize(v,f,e),s!==null&&u.placeElement(v,0,s)));n.tile_enable_image_effect==!1?(u.scaleImageCoverParent(c,f,e),t.hasImageContainer==!1&&s!==null&&u.placeElement(c,0,s)):(l="nothing",o===!0&&t.isTextpanelOutside==!1&&(l=n.tile_image_effect_reverse==!0?"effect":"image"),l!="effect"&&(u.setElementSize(y,f,e),s!==null&&u.placeElement(y,0,s),u.scaleImageCoverParent(p,f,e)),l!="image"&&(t.hasImageContainer==!0?u.scaleImageCoverParent(c,f,e):l=="effect"?(u.scaleImageCoverParent(c,f,e),s!==null&&u.placeElement(c,0,s)):u.cloneElementSizeAndPos(p,c,!1,null,s)))}function a(i,u,f,e){var c=null,l,a,o,s,v,y;if(f&&(c=f-t.tileInnerReduce),e&&(e-=t.tileInnerReduce),u=="clone")return l=pt(i),l.refresh(!0,!0,c),a=r.getItemByTile(i),a.textPanelCloneSizeSet=!0,!1;if(o=b(i),!o)return!1;s=null;t.isTextpanelOutside==!0&&(s=h(i));o.refresh(!1,!0,c,s);v=n.tile_textpanel_always_on==!0||n.tile_textpanel_appear_type=="fade";v&&(t.isTextpanelOutside==!0&&e&&n.tile_textpanel_position=="bottom"?(y=e-s,o.positionPanel(y)):o.positionPanel())}function it(i){var et=r.getItemByTile(i),e=d(i),o=k(i),f=u.getElementSize(i),p,rt,c,ut,w;tt(i,f.width,f.height);n.tile_enable_textpanel==!0&&a(i,"regular",f.width,f.height);var ft=f.width-t.tileInnerReduce,nt=f.height-t.tileInnerReduce,it=0;if(t.isTextpanelOutside==!0&&(p=h(i),nt-=p,n.tile_textpanel_position=="top"&&(it=p)),rt=at(i),u.setElementSizeAndPosition(rt,0,it,ft,nt),(e||o)&&(c=0,n.tile_enable_textpanel==!0&&t.isTextPanelHidden==!1&&t.isTextpanelOutside==!1&&(ut=s(i),w=u.getElementSize(ut),w.height>0&&(c=Math.floor(w.height/-2)))),e&&o){var v=u.getElementSize(e),b=u.getElementSize(o),l=n.tile_space_between_icons,g=v.width+l+b.width,y=Math.floor((f.width-g)/2);y<l&&(l=Math.floor((f.width-v.width-b.width)/3),g=v.width+l+b.width,y=Math.floor((f.width-g)/2));u.placeElement(e,y,"middle",0,c);u.placeElement(o,y+v.width+l,"middle",0,c)}else e&&u.placeElement(e,"center","middle",0,c),o&&u.placeElement(o,"center","middle",0,c);e&&e.show();o&&o.show()}function rt(t,i){var o=r.getItemByTile(t),u=w(t),f=n.thumb_transition_duration,e;n.tile_image_effect_reverse==!1?(e=r.getTileImage(t),i?(e.fadeTo(0,1),u.stop(!0).fadeTo(f,0)):u.stop(!0).fadeTo(f,1)):i?u.stop(!0).fadeTo(f,1):u.stop(!0).fadeTo(f,0)}function ut(t,i){var f=n.thumb_transition_duration,r=s(t),e;if(!r)return!0;if(n.tile_textpanel_appear_type=="slide"){if(e=u.getElementSize(r),e.width==0)return!1;var l=-e.height,o={},h={},c="bottom";n.tile_textpanel_position=="inside_top"&&(c="top");o[c]=l+"px";h[c]="0px";i==!0?(r.fadeTo(0,1),r.is(":animated")==!1&&r.css(o),h.opacity=1,r.stop(!0).animate(h,f)):r.stop(!0).animate(o,f)}else i==!0?r.stop(!0).fadeTo(f,1):r.stop(!0).fadeTo(f,0)}function v(t,i,r){var u=n.thumb_transition_duration;r&&r===!0&&(u=0);var f=d(t),e=k(t),o=i?1:0;f&&f.stop(!0).fadeTo(u,o);e&&e.stop(!0).fadeTo(u,o)}function kt(i,u){if(u=jQuery(u),n.tile_enable_image_effect&&rt(u,!0),n.tile_enable_textpanel==!0&&n.tile_textpanel_always_on==!1&&t.isTextPanelHidden==!1&&ut(u,!0),t.isSaparateIcons&&n.tile_enable_icons==!0){var f=n.thumb_overlay_reverse==!0,e=r.getItemByTile(u);nt(e)==!1&&v(u,f,!1)}}function dt(i,u){if(u=jQuery(u),n.tile_enable_image_effect&&rt(u,!1),n.tile_enable_textpanel==!0&&n.tile_textpanel_always_on==!1&&ut(u,!1),t.isSaparateIcons==!0&&n.tile_enable_icons==!0){var f=n.thumb_overlay_reverse==!0?!1:!0,e=r.getItemByTile(u);nt(e)==!1?v(u,f,!1):v(u,!0,!0)}}function gt(n){var t=i.getThumbs().not(n);t.each(function(n,t){i.setThumbNormalStyle(jQuery(t))})}function ni(t,r,u){if(r=jQuery(r),n.tile_visible_before_image==!0&&r.data("image_placed")!==!0&&u!==!0)return!0;it(r);i.setThumbNormalStyle(r)}function ft(n,t,i){it(t);i.fadeTo(0,1);t.data("image_placed",!0)}function y(n){if(g(n)==!0)return l.trigger(r.events.TILE_CLICK,n),!0;c(n)==!1&&(gt(n),i.setThumbOverStyle(n))}function ti(n){var i=jQuery(this),f=i.prop("tagName").toLowerCase(),u=!0;if(t.funcParentApproveClick&&t.funcParentApproveClick()==!1&&(u=!1),f=="a")u==!1&&n.preventDefault();else if(c(i)==!1)u==!0&&y(i);else{if(g(i)==!1)return!0;u==!0&&l.trigger(r.events.TILE_CLICK,i)}}function ii(n){n.stopPropagation();var i=jQuery(this).parents(".ug-tile"),u=!0;return(t.funcParentApproveClick&&t.funcParentApproveClick()==!1&&(u=!1),c(i)==!1)?(y(i),!0):u==!0?(l.trigger(r.events.TILE_CLICK,i),!1):void 0}function ri(i){var r=jQuery(this).parents(".ug-tile");t.funcParentApproveClick&&t.funcParentApproveClick()==!1&&i.preventDefault();c(r)==!1&&n.tile_as_link==!1&&(i.preventDefault(),y(r))}var r=this,l=jQuery(this),e=new UniteGalleryMain,et,u=new UGFunctions,f,o,i=new UGThumbsGeneral,ot;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"};this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"};this.events={TILE_CLICK:"tile_click"};var n={tile_width:250,tile_height:200,tile_size_by:r.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},st={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},t={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};this.loadTileImage=function(n){var t=r.getTileImage(n);u.checkImagesLoaded(t,null,function(t){ft(null,n,jQuery(t))})};this.setHtml=function(n,t){f=n;t!==!0&&p();i.setHtmlThumbs(n,t)};this.initEvents=function(){i.initEvents();jQuery(i).on(i.events.SETOVERSTYLE,kt);jQuery(i).on(i.events.SETNORMALSTYLE,dt);jQuery(i).on(i.events.PLACEIMAGE,ft);o.on(t.eventSizeChange,ni);f.on("click",".ug-tile",ti);f.on("click",".ug-tile .ug-button-play",ii);f.on("click",".ug-tile .ug-icon-link",ri)};this.destroy=function(){if(f.off("click",".ug-tile"),f.off("click",".ug-tile .ug-button-play"),f.off("click",".ug-tile .ug-icon-link"),jQuery(i).off(i.events.SETOVERSTYLE),jQuery(i).off(i.events.SETNORMALSTYLE),jQuery(i).off(i.events.PLACEIMAGE),o.off(t.eventSizeChange),n.tile_enable_textpanel==!0){var r=i.getThumbs();jQuery.each(r,function(n,t){var i=b(jQuery(t));i&&i.destroy()})}i.destroy()};this.init=function(n,t,i){ht(n,t,i)};this.setFixedMode=function(){n.tile_size_by=r.sizeby.GLOBAL_RATIO;n.tile_visible_before_image=!0};this.setApproveClickFunction=function(n){t.funcParentApproveClick=n};this.resizeTile=function(i,f,e,o){var f,e;t.isTextpanelOutside==!0&&a(i,"clone",f);f?e||(e=r.getTileHeightByWidth(f,i)):(f=n.tile_width,e=n.tile_height);u.setElementSize(i,f,e);switch(o){default:case r.resizemode.FULL:r.triggerSizeChangeEvent(i,!0);break;case r.resizemode.WRAPPER_ONLY:return!0;case r.resizemode.VISIBLE_ELEMENTS:if(t.funcCustomTileHtml)return r.triggerSizeChangeEvent(i,!0),!0;tt(i,f,e,!0);n.tile_enable_textpanel==!0&&n.tile_textpanel_always_on==!0&&f&&a(i,"regular",f,e)}};this.resizeAllTiles=function(t,u,f){var e,f;p();e=null;n.tile_size_by==r.sizeby.GLOBAL_RATIO&&(e=r.getTileHeightByWidth(t));f||(f=i.getThumbs());f.each(function(n,i){r.resizeTile(jQuery(i),t,e,u)})};this.triggerSizeChangeEvent=function(n,i){if(!n)return!1;if(!i)var i=!1;o.trigger(t.eventSizeChange,[n,i])};this.triggerSizeChangeEventAllTiles=function(n){var t=i.getThumbs();t.each(function(){var t=jQuery(this);r.triggerSizeChangeEvent(t,n)})};this.disableEvents=function(){var n=i.getThumbs();n.css("pointer-events","none")};this.enableEvents=function(){var n=i.getThumbs();n.css("pointer-events","auto")};this.setOptions=function(t){n=jQuery.extend(n,t);i.setOptions(t)};this.setTileSizeOptions=function(i){if(n.tile_size_by!==r.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");n.tile_width=i;n.tile_height=Math.floor(i*t.ratioByHeight)};this.setCustomFunctions=function(n,i){t.funcCustomTileHtml=n;t.funcCustomPositionElements=i};this.run=function(t){var f=i.type.GET_THUMBS_ALL,u;t===!0&&(f=i.type.GET_THUMBS_NEW);u=i.getThumbs(f);n.tile_size_by==r.sizeby.GLOBAL_RATIO&&r.resizeAllTiles(n.tile_width,r.resizemode.WRAPPER_ONLY,u);n.tile_enable_image_effect==!0&&n.tile_image_effect_reverse==!1&&u.children(".ug-thumb-image").fadeTo(0,0);i.setHtmlProperties(u);n.tile_visible_before_image==!0&&(u.children(".ug-thumb-image").fadeTo(0,0),i.loadThumbsImages())};this._____________EXTERNAL_GETTERS____________=function(){};this.getObjThumbs=function(){return i};this.getOptions=function(){return n};this.getTileImage=function(n){return n.find("img.ug-thumb-image")};this.getItemByTile=function(n){return i.getItemByThumb(n)};this.getTileHeightByWidth=function(i,u){var e=bt(u),f;return e===null?null:(f=Math.floor((i-t.tileInnerReduce)*e)+t.tileInnerReduce,u&&t.isTextpanelOutside==!0&&n.tile_size_by==r.sizeby.IMAGE_RATIO&&(f+=h(u)),f)};this.getTileImageSize=function(n){var t=r.getItemByTile(n);if(!t.thumbWidth||!t.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:t.thumbWidth,height:t.thumbHeight}};this.getGlobalTileSize=function(){if(n.tile_size_by!=r.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:n.tile_width,height:n.tile_height}}}function UGAviaControl(){function h(n){return e==!1?n.pageX:n.pageY}function c(){jQuery("body").on("touchstart",function(){if(n.isControlEnabled==!1)return!0;n.touchEnabled=!0});jQuery("body").mousemove(function(t){var i,f;if(n.isControlEnabled==!1)return!0;if(n.touchEnabled==!0)return jQuery("body").off("mousemove"),!0;n.isMouseInsideStrip=r.ismouseover();i=u.isTouchMotionActive();n.isMouseInsideStrip==!0&&i==!1?(f=h(t),w(f)):o()})}function l(n){var s=t.strip_padding_top,p=t.strip_padding_bottom,e=r.height(),h=f.height(),c,l;if(e>h)return null;var a=r.offset(),v=a.top,i=n-v-s;if(i<0)return null;var u=t.thumb_height,o=e-t.thumb_height,y=o-u;return i<u&&(i=u),i>o&&(i=o),c=(i-u)/y,l=(h-e)*c,Math.round(l)*-1+s}function a(n){var e=t.strip_padding_left,a=t.strip_padding_right,o=r.width()-e-a,h=f.width(),c,l;if(o>h)return null;var v=r.offset(),y=v.left,i=n-y-e,u=t.thumb_width,s=o-t.thumb_width,p=s-u;return i<u&&(i=u),i>s&&(i=s),c=(i-u)/p,l=(h-o)*c,Math.round(l)*-1+e}function v(){var i,r,t,f;if(n.is_strip_moving==!1)return!1;i=u.getInnerStripPos();Math.floor(i)==Math.floor(n.strip_finalPos)&&o();r=Math.abs(n.strip_finalPos-i);r<1?t=r:(t=r/4,t>0&&t<1&&(t=1));n.strip_finalPos<i&&(t=t*-1);f=i+t;u.positionInnerStrip(f)}function y(){if(n.isStripMoving==!0)return!1;n.isStripMoving=!0;n.handle_timeout=setInterval(v,10)}function o(){if(n.isStripMoving==!1)return!1;n.isStripMoving=!1;n.handle_timeout=clearInterval(n.handle_timeout)}function p(n){return e==!1?a(n):l(n)}function w(t){var i=p(t);if(i===null)return!1;n.is_strip_moving=!0;n.strip_finalPos=i;y()}var u,s,i,r,f,t,e,n={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",isStripMoving:!1,isControlEnabled:!0};this.enable=function(){n.isControlEnabled=!0};this.disable=function(){n.isControlEnabled=!1};this.init=function(n){u=n;i=n.getObjects();s=i.g_gallery;r=i.g_objStrip;f=i.g_objStripInner;t=i.g_options;e=i.isVertical;c()};this.destroy=function(){jQuery("body").off("touchstart");jQuery("body").off("mousemove")}}function UGSlider(){function li(r,f,o){var l,a,v;u=r;o&&(et=o,f=i.convertCustomPrefixOptions(f,et,"slider"));tt=jQuery(r);l=u.getObjects();rt=l.g_objWrapper;ci=l.g_objThumbs;f.hasOwnProperty("slider_progress_indicator_type")&&(n.slider_progress_indicator_type=f.slider_progress_indicator_type);n.slider_progress_indicator_type=="bar"&&(n=jQuery.extend(n,gt));f&&t.setOptions(f);vi();n.slider_enable_bullets==!0&&(c=new UGBullets,a={bullets_skin:n.slider_bullets_skin,bullets_space_between:n.slider_bullets_space_between},c.init(u,a));n.slider_enable_text_panel&&(s=new UGTextPanel,s.init(u,n,"slider"));n.slider_enable_zoom_panel&&(h=new UGZoomButtonsPanel,h.init(t,n));v=u.getGalleryID();e.init(n,!1,v)}function ai(){if(r.isRunOnce==!0)return!1;if(r.isRunOnce=!0,n.slider_background_color){var u=n.slider_background_color;n.slider_background_opacity!=1&&(u=i.convertHexToRGB(u,n.slider_background_opacity));f.css("background-color",u)}else n.slider_background_opacity!=1&&(u=i.convertHexToRGB("#000000",n.slider_background_opacity),f.css("background-color",u));n.slider_control_swipe==!0&&(k=new UGTouchSliderControl,k.init(t,n));n.slider_control_zoom==!0&&(l=new UGZoomSliderControl,l.init(t,n));s&&s.run();wr()}function vi(){var i=u.getOptions(),t=i.gallery_skin;n.slider_bullets_skin==""&&(n.slider_bullets_skin=t);n.slider_arrows_skin==""&&(n.slider_arrows_skin=t);n.slider_zoompanel_skin==""&&(n.slider_zoompanel_skin=t);n.slider_play_button_skin==""&&(n.slider_play_button_skin=t);n.slider_fullscreen_button_skin==""&&(n.slider_fullscreen_button_skin=t);n.video_enable_closebutton=n.slider_video_enable_closebutton;i.gallery_mousewheel_role!="zoom"&&(n.slider_zoom_mousewheel=!1)}function lt(t,i){var u="ug-type-square",r;return n.slider_videoplay_button_type=="round"&&(u="ug-type-round"),r="",r+="<div class='ug-slide-wrapper ug-slide"+i+"'>",r+="<div class='ug-item-wrapper'><\/div>",r+="<div class='ug-slider-preloader "+t+"'><\/div>",r+="<div class='ug-button-videoplay "+u+"' style='display:none'><\/div>",r+"<\/div>"}function yi(t){var k,d;t&&(rt=t);var l=br(),nt=u.getOptions(),o="<div class='ug-slider-wrapper'>";o+="<div class='ug-slider-inner'>";o+=lt(l,1);o+=lt(l,2);o+=lt(l,3);o+="<\/div>";n.slider_enable_arrows==!0&&(o+="<div class='ug-slider-control ug-arrow-left ug-skin-"+n.slider_arrows_skin+"'><\/div>",o+="<div class='ug-slider-control ug-arrow-right ug-skin-"+n.slider_arrows_skin+"'><\/div>");n.slider_enable_play_button==!0&&(o+="<div class='ug-slider-control ug-button-play ug-skin-"+n.slider_play_button_skin+"'><\/div>");n.slider_enable_fullscreen_button==!0&&(o+="<div class='ug-slider-control ug-button-fullscreen ug-skin-"+n.slider_fullscreen_button_skin+"'><\/div>");o+="<\/div>";rt.append(o);f=rt.children(".ug-slider-wrapper");a=f.children(".ug-slider-inner");v=a.children(".ug-slide1");y=a.children(".ug-slide2");p=a.children(".ug-slide3");v.data("slidenum",1);y.data("slidenum",2);p.data("slidenum",3);c&&c.appendHTML(f);n.slider_enable_arrows==!0&&(ut=f.children(".ug-arrow-left"),ft=f.children(".ug-arrow-right"));n.slider_enable_play_button==!0&&(w=f.children(".ug-button-play"));n.slider_enable_fullscreen_button==!0&&(b=f.children(".ug-button-fullscreen"));n.slider_enable_progress_indicator==!0&&(g=i.initProgressIndicator(n.slider_progress_indicator_type,n,f),k=g.getType(),k=="bar"&&n.slider_progress_indicator_type=="pie"&&(n.slider_progress_indicator_type="bar",n=jQuery.extend(n,gt)),u.setProgressIndicator(g));n.slider_enable_text_panel==!0&&(s.appendHTML(f),n.slider_textpanel_always_on==!1&&(d=s.getElement(),d.hide().data("isHidden",!0),r.isTextPanelSaparateHover=!0));n.slider_enable_zoom_panel==!0&&h.appendHTML(f);e.setHtml(a)}function at(n){var r=ht(n),t;i.placeElementInParentCenter(r);t=ct(n);i.placeElementInParentCenter(t)}function pi(){var t,r;c&&(objBullets=c.getElement(),i.placeElement(objBullets,n.slider_bullets_align_hor,n.slider_bullets_align_vert,n.slider_bullets_offset_hor,n.slider_bullets_offset_vert),i.placeElement(objBullets,n.slider_bullets_align_hor,n.slider_bullets_align_vert,n.slider_bullets_offset_hor,n.slider_bullets_offset_vert));n.slider_enable_arrows==!0&&(i.placeElement(ut,n.slider_arrow_left_align_hor,n.slider_arrow_left_align_vert,n.slider_arrow_left_offset_hor,n.slider_arrow_left_offset_vert),i.placeElement(ft,n.slider_arrow_right_align_hor,n.slider_arrow_left_align_vert,n.slider_arrow_right_offset_hor,n.slider_arrow_right_offset_vert));n.slider_controls_always_on==!1&&wt(!0);g&&(t=g.getElement(),n.slider_progress_indicator_type=="bar"?(r=f.width(),g.setSize(r),i.placeElement(t,"left",n.slider_progress_indicator_align_vert,0,n.slider_progress_indicator_offset_vert)):i.placeElement(t,n.slider_progress_indicator_align_hor,n.slider_progress_indicator_align_vert,n.slider_progress_indicator_offset_hor,n.slider_progress_indicator_offset_vert));s&&s.positionPanel();wi();at(v);at(y);at(p);ir()}function wi(){if(w&&i.placeElement(w,n.slider_play_button_align_hor,n.slider_play_button_align_vert,n.slider_play_button_offset_hor,n.slider_play_button_offset_vert),b&&i.placeElement(b,n.slider_fullscreen_button_align_hor,n.slider_fullscreen_button_align_vert,n.slider_fullscreen_button_offset_hor,n.slider_fullscreen_button_offset_vert),h){var t=h.getElement();i.placeElement(t,n.slider_zoompanel_align_hor,n.slider_zoompanel_align_vert,n.slider_zoompanel_offset_hor,n.slider_zoompanel_offset_vert)}}function it(){var n=t.getSlidesReference(),f=0,e,r=0,u,o,s;o=t.isSlideHasItem(n.objNextSlide);s=t.isSlideHasItem(n.objPrevSlide);s?(r=n.objPrevSlide.outerWidth(),n.objPrevSlide.css("z-index",1)):n.objPrevSlide.hide();u=r+n.objCurrentSlide.outerWidth();e=u;o?(e=u+n.objNextSlide.outerWidth(),n.objPrevSlide.css("z-index",2)):n.objNextSlide.hide();n.objCurrentSlide.css("z-index",3);i.placeElement(n.objCurrentSlide,r,f);a.css({left:-r+"px",width:e+"px"});s&&(i.placeElement(n.objPrevSlide,0,f),i.showElement(n.objPrevSlide));o&&(i.showElement(n.objNextSlide),i.placeElement(n.objNextSlide,u,f))}function nt(n){var t=n.data("index"),i;if(t===undefined||t==null||(i=u.getItem(t),!i))return!1;d(n,i)}function bi(n){n.stop(!0).show(100)}function ni(n){n.stop(!0).hide(100)}function ki(t,r){var u=n.slider_image_border_width;if(u<=10)return u;var o=i.getElementSize(t),f=o.width,e=o.height;if(r&&(r.hasOwnProperty("imageWidth")&&(f=r.imageWidth),r.hasOwnProperty("imageHeight")&&(e=r.imageHeight)),f<=0)return u;var s=f<e?f:e,h=u*2,c=h/s;return c<n.slider_image_border_maxratio?u:(u=s*n.slider_image_border_maxratio/2,Math.round(u))}function ot(t,i,r){var u={},f;n.slider_image_border==!0&&(u["border-style"]="solid",f=ki(t,r),u["border-width"]=f+"px",u["border-color"]=n.slider_image_border_color,u["border-radius"]=n.slider_image_border_radius);i!="image"&&n.slider_video_constantsize==!0&&(u["background-color"]="#000000");n.slider_image_shadow==!0&&(u["box-shadow"]="3px 3px 10px 0px #353535");t.css(u)}function vt(t,r){var u=n.slider_video_constantsize_width,f=n.slider_video_constantsize_height,e=n.slider_video_constantsize_scalemode;return i.scaleImageExactSizeInParent(t,r.imageWidth,r.imageHeight,u,f,e)}function st(r,f,e){var v=r.children(".ug-item-wrapper"),y=ht(r),l,p,a,c,s,h;if(typeof f.urlImage=="undefined"||f.urlImage=="")throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");if(l=f.urlImage,p=r.data("urlImage"),r.data("urlImage",l),a=t.getScaleMode(r),c=t.getSlideType(r),objPadding=t.getObjImagePadding(),p==l&&e!==!0)s=v.children("img"),(f.imageWidth==0||f.imageHeight==0)&&u.checkFillImageSize(s,f),h={},h=c!="image"&&n.slider_video_constantsize==!0?vt(s,f):i.scaleImageFitParent(s,f.imageWidth,f.imageHeight,a,objPadding),ot(s,c,h),o.trigger(t.events.AFTER_PUT_IMAGE,r);else if(s=i.placeImageInsideParent(l,v,f.imageWidth,f.imageHeight,a,objPadding,f.title),f.isBigImageLoaded==!0)s.fadeTo(0,1),ni(y),h=c!="image"&&n.slider_video_constantsize==!0?vt(s,f):i.getImageInsideParentData(v,f.imageWidth,f.imageHeight,a,objPadding),s.css("width",h.imageWidth+"px"),ot(s,c,h),o.trigger(t.events.AFTER_PUT_IMAGE,r);else{s.fadeTo(0,0);bi(y);r.data("isLoading",!0);t.isSlideCurrent(r)&&o.trigger(t.events.CURRENTSLIDE_LOAD_START);s.data("itemIndex",f.index);s.on("load",function(){var r=jQuery(this),c=r.data("itemIndex"),e,s;r.fadeTo(0,1);var f=r.parent().parent(),h=t.getSlideType(f),l=ht(f),a=t.getObjImagePadding(),v=t.getScaleMode(f);ni(l);f.data("isLoading",!1);t.isSlideCurrent(f)&&o.trigger(t.events.CURRENTSLIDE_LOAD_END);u.onItemBigImageLoaded(null,r);e=u.getItem(c);s={};h!="image"&&n.slider_video_constantsize==!0?vt(r,e):s=i.scaleImageFitParent(r,e.imageWidth,e.imageHeight,v,a);r.fadeTo(0,1);ot(r,h,s);o.trigger(t.events.AFTER_PUT_IMAGE,f)})}}function d(t,i){var f,o,e;try{if(f=t.children(".ug-item-wrapper"),i==null)return f.html(""),t.removeData("index"),t.removeData("type"),t.removeData("urlImage"),!1;o=t.data("index");t.data("index",i.index);t.data("type",i.type);n.slider_enable_links==!0&&i.type=="image"&&(i.link?t.addClass("ug-slide-clickable"):t.removeClass("ug-slide-clickable"));st(t,i);e=ct(t);switch(i.type){case"image":e.hide();break;default:e.show()}}catch(r){typeof r.fileName!="undefined"&&r.fileName=="showbig"&&u.showErrorMessageReplaceGallery(r.message);f.html("");throw new Error(r);}}function ti(){if(!s||ii()==!0)return!1;var t=s.getElement(),i=0;(r.isTextPanelSaparateHover==!0||n.slider_textpanel_always_on==!0)&&(i=n.slider_controls_appear_duration);t.stop().fadeTo(i,0);t.data("isHidden",!0)}function yt(){if(!s||ii()==!1)return!1;var t=s.getElement(),i=0;(r.isTextPanelSaparateHover==!0||n.slider_textpanel_always_on==!0)&&(t.show(),s.positionElements(),i=n.slider_controls_appear_duration);t.stop().show().fadeTo(i,1);t.data("isHidden",!1)}function ii(){var n=s.getElement(),t=n.data("isHidden");return t===!1?!1:!0}function di(n,i){var i,r;if(i==undefined&&(i=t.getCurrentSlide()),r=t.getSlideType(i),r!=n)throw new Error("Wrong slide type: "+r+", should be: "+n);return!0}function ri(){var o=t.getCurrentSlide(),h=t.getSlideImage(o),s=i.getElementSize(o),r=s.left,u=s.top,f;n.slider_video_constantsize==!0?(f=i.getElementSize(h),r+=f.left,u+=f.top):(r+=n.slider_video_padding_left,u+=n.slider_video_padding_top);e.setPosition(r,u)}function ui(){var i=n.slider_video_constantsize_width,r=n.slider_video_constantsize_height,t;e.setSize(i,r);t=e.getObject();ot(t,"video")}function gi(i,r,u){o.trigger(t.events.TRANSITION_START);var f=n.slider_transition;u&&(f=u);t.stopSlideAction(null,!0);switch(f){default:case"fade":ei(r);break;case"slide":fi(i,r);break;case"lightbox_open":ei(r,!1,!0)}}function fi(u,f){var v=t.isAnimating(),s,c,l,h;if(v==!0)return r.itemWaiting=f,!0;r.itemWaiting!=null&&(r.itemWaiting=null);s=t.getSlidesReference();switch(u){case"right":d(s.objPrevSlide,f);it();c=i.getElementSize(s.objPrevSlide);h=-c.left;t.switchSlideNums("right");break;case"left":d(s.objNextSlide,f);it();l=i.getElementSize(s.objNextSlide);h=-l.left;t.switchSlideNums("left");break;default:throw new Error("wrong direction: "+u);}var y=n.slider_transition_speed,p=n.slider_transition_easing,w={duration:y,easing:p,queue:!1,always:function(){if(t.stopSlideAction(),e.hide(),r.itemWaiting!=null){var n=kr(r.itemWaiting);fi(n,r.itemWaiting)}else t.placeNabourItems(),o.trigger(t.events.TRANSITION_END)}};a.animate({left:h+"px"},w)}function pt(t,i,r){r?t.fadeTo(n.slider_transition_speed,i,r):t.fadeTo(n.slider_transition_speed,i)}function ei(n,u,f){var u,s,h,c,l;u||(u=!1);s=t.getSlidesReference();d(s.objNextSlide,n);h=i.getElementSize(s.objCurrentSlide);i.placeElement(s.objNextSlide,h.left,h.top);c=r.numCurrent;r.numCurrent=r.numNext;r.numNext=c;o.trigger(t.events.ITEM_CHANGED);s.objNextSlide.stop(!0);s.objCurrentSlide.stop(!0);u==!0?(s.objCurrentSlide.fadeTo(0,0),s.objNextSlide.fadeTo(0,1),t.placeNabourItems(),o.trigger(t.events.TRANSITION_END),f!==!0&&e.hide()):(s.objNextSlide.fadeTo(0,0),pt(s.objCurrentSlide,0,function(){t.placeNabourItems();o.trigger(t.events.TRANSITION_END);f!==!0&&e.hide()}),e.isVisible()==!0&&(l=e.getObject(),pt(l,0)),pt(s.objNextSlide,1))}function nr(){n.slider_fullscreen_button_mobilehide==!0&&b&&b.hide();n.slider_play_button_mobilehide==!0&&w&&w.hide();n.slider_zoompanel_mobilehide==!0&&h&&h.getElement().hide()}function tr(){n.slider_fullscreen_button_mobilehide==!0&&b&&b.show();n.slider_play_button_mobilehide==!0&&w&&w.show();n.slider_zoompanel_mobilehide==!0&&h&&h.getElement().show()}function ir(){var n=u.isMobileMode();n?nr():tr()}function oi(){return f.children(".ug-slider-control")}function wt(t){var t,u;if(i.isTimePassed("sliderControlsToggle")==!1||r.isControlsVisible==!1)return!1;t||(t=!1);u=oi();t===!0?u.stop().fadeTo(0,0).hide():u.stop().fadeTo(n.slider_controls_appear_duration,0,function(){u.hide()});r.isControlsVisible=!1}function bt(t){var t,u;if(i.isTimePassed("sliderControlsToggle")==!1)return!1;if(r.isControlsVisible==!0)return!0;t||(t=!1);u=oi();t===!0?u.stop().show():(u.stop().show().fadeTo(0,0),u.fadeTo(n.slider_controls_appear_duration,1));r.isControlsVisible=!0}function rr(){r.isControlsVisible==!1?bt():wt()}function si(n){if(n==r.currentControlsMode)return!1;switch(n){case"image":h&&h.getElement().show();break;case"video":h&&h.getElement().hide();break;default:throw new Error("wrong controld mode: "+n);}r.currentControlsMode=n}function ur(n,i,f){var e=u.getSelectedItem(),o;t.setItem(e,!1,f);o=e.index;c&&c.setActive(o);s&&r.isTextPanelSaparateHover==!1&&yt();e.type=="image"?si("image"):si("video")}function fr(n,t){u.selectItem(t)}function er(n){if(k&&k.isTapEventOccured(n)==!1)return!0;o.trigger(t.events.CLICK,n)}function or(){var r=t.getCurrentSlide(),u=r.hasClass("ug-slide-clickable"),i=t.getCurrentItem();if(u)return n.slider_links_newpage==!1?location.href=i.link:window.open(i.link,"_blank"),!0;n.slider_controls_always_on==!1&&n.slider_controls_appear_ontap==!0&&t.isCurrentSlideType("image")==!0&&(rr(),s&&n.slider_textpanel_always_on==!0&&t.isCurrentSlideType("image")&&t.isCurrentSlideImageFit()&&yt())}function sr(){s&&t.isCurrentSlideType("image")&&t.isCurrentSlideImageFit()==!1&&ti()}function hr(){bt()}function cr(){wt()}function lr(n){var i=n.parent();t.startSlideAction(i)}function ar(){u.isPlayMode()&&u.pausePlaying();o.trigger(t.events.ACTION_START)}function vr(){u.isPlayMode()&&u.continuePlaying();o.trigger(t.events.ACTION_END)}function yr(n,t){v.data("index")==t&&(objItem=u.getItem(t),st(v,objItem,!0));y.data("index")==t&&(objItem=u.getItem(t),st(y,objItem,!0));p.data("index")==t&&(objItem=u.getItem(t),st(p,objItem,!0))}function pr(n,r){r=jQuery(r);var u=t.getSlideImage(r),e=ct(r),f=i.getElementSize(u);i.placeElement(e,"center","middle",f.left,f.top,u)}function kt(n){var t=ct(n);i.addClassOnHover(t);i.setButtonOnClick(t,lr)}function wr(){tt.on(u.events.ITEM_IMAGE_UPDATED,yr);tt.on(u.events.ITEM_CHANGE,ur);if(c)jQuery(c).on(c.events.BULLET_CLICK,fr);n.slider_enable_arrows==!0&&(i.addClassOnHover(ft,"ug-arrow-hover"),i.addClassOnHover(ut,"ug-arrow-hover"),u.setNextButton(ft),u.setPrevButton(ut));n.slider_controls_always_on==!1&&f.hover(hr,cr);f.on("touchend click",er);o.on(t.events.CLICK,or);if(s&&r.isTextPanelSaparateHover==!0&&f.hover(yt,ti),w&&(i.addClassOnHover(w,"ug-button-hover"),u.setPlayButton(w)),b&&(i.addClassOnHover(b,"ug-button-hover"),u.setFullScreenToggleButton(b)),l)o.on(t.events.ZOOM_CHANGE,sr);h&&h.initEvents();e.initEvents();jQuery(e).on(e.events.SHOW,ar);jQuery(e).on(e.events.HIDE,vr);kt(v);kt(y);kt(p);o.on(t.events.AFTER_PUT_IMAGE,pr);f.on("mouseenter",".ug-item-wrapper img",function(){o.trigger(t.events.IMAGE_MOUSEENTER)});f.on("mouseleave",".ug-item-wrapper img",function(n){var i=t.isMouseInsideSlideImage(n);i==!1&&o.trigger(t.events.IMAGE_MOUSELEAVE)})}function br(){var t;switch(n.slider_loader_type){default:case 1:t="ug-loader1";break;case 2:t="ug-loader2";break;case 3:t="ug-loader3";break;case 4:t="ug-loader4";break;case 5:t="ug-loader5";break;case 6:t="ug-loader6";break;case 7:t="ug-loader7";break;case 8:t="ug-loader8";break;case 9:t="ug-loader9"}return n.slider_loader_color=="black"&&(t+=" ug-loader-black"),t}function dt(n){switch(n){case 1:return v;case 2:return y;case 3:return p;default:throw new Error("wrong num: "+n);}}function kr(n){var r=t.getSlidesReference(),u=r.objCurrentSlide.data("index"),f=n.index,i="left";return u>f&&(i="right"),i}function ht(n){var n;return n||(n=t.getCurrentSlide()),n.children(".ug-slider-preloader")}function ct(n){return n.children(".ug-button-videoplay")}function hi(n){var n,i;return(n||(n=t.getCurrentSlide()),i=n.data("index"),i==undefined)?null:u.getItem(i)}var t=this,o=jQuery(t),u=new UniteGalleryMain,tt,rt,ci,f,a,v,y,p,ut,ft,k,l,h,w=null,b=null,c=null,e=new UGVideoPlayer,et,i=new UGFunctions,g=null,s=null;this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"};var n={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!1,slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_skin:"",slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:20,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:20,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square"},gt={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},r={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};this.switchSlideNums=function(n){var i;o.trigger(t.events.BEFORE_SWITCH_SLIDES);switch(n){case"left":i=r.numCurrent;r.numCurrent=r.numNext;r.numNext=r.numPrev;r.numPrev=i;break;case"right":i=r.numCurrent;r.numCurrent=r.numPrev;r.numPrev=r.numNext;r.numNext=i;break;default:throw new Error("wrong direction: "+n);}o.trigger(t.events.ITEM_CHANGED)};this.destroy=function(){if(o.off(t.events.AFTER_PUT_IMAGE),tt.off(u.events.ITEM_IMAGE_UPDATED),tt.off(u.events.ITEM_CHANGE),c)jQuery(c).on(c.events.BULLET_CLICK);f.off("mouseenter");f.off("mouseleave");f.off("touchend");f.off("click");o.off(t.events.CLICK);l&&o.off(t.events.ZOOM_CHANGE);o.off(t.events.BEFORE_SWITCH_SLIDES);jQuery(e).off(e.events.SHOW);jQuery(e).off(e.events.HIDE);e.destroy();f.off("mouseenter",".ug-item-wrapper img");f.off("mouseleave",".ug-item-wrapper img")};this.________EXTERNAL_GENERAL___________=function(){};this.init=function(n,t,i){li(n,t,i)};this.getSlideImage=function(n){var n;return n||(n=t.getCurrentSlide()),n.find(".ug-item-wrapper img")};this.setHtml=function(n){yi(n)};this.run=function(){ai()};this.isInnerInPlace=function(){var n=t.getSlidesReference(),r=i.getElementSize(n.objCurrentSlide),u=-r.left,f=i.getElementSize(a);return u==f.left?!0:!1};this.isAnimating=function(){return a.is(":animated")};this.isSlideCurrent=function(n){var t=n.data("slidenum");return r.numCurrent==t?!0:!1};this.isSlideHasItem=function(n){var t=n.data("index");return t===undefined||t===null?!1:!0};this.getObjImagePadding=function(){return{padding_top:n.slider_image_padding_top,padding_bottom:n.slider_image_padding_bottom,padding_left:n.slider_image_padding_left,padding_right:n.slider_image_padding_right}};this.getSlidesReference=function(){return{objPrevSlide:dt(r.numPrev),objNextSlide:dt(r.numNext),objCurrentSlide:dt(r.numCurrent)}};this.getCurrentSlide=function(){var n=t.getSlidesReference();return n.objCurrentSlide};this.getCurrentItemIndex=function(){var i=t.getSlidesReference(),n=i.objCurrentSlide.data("index");return(n===null||n===undefined)&&(n=-1),n};this.getCurrentItem=function(){var n=t.getCurrentItemIndex();return n==-1?null:u.getItem(n)};this.getSlideType=function(n){n==undefined&&(n=t.getCurrentSlide());return n.data("type")};this.isMouseInsideSlideImage=function(n){var u=t.getSlideImage(),r=i.getMousePosition(n),f,e;return r.pageX===undefined&&(r=k.getLastMousePos()),f=i.getMouseElementPoint(r,u),e=i.getElementSize(u),isMouseInside=i.isPointInsideElement(f,e)};this.isCurrentSlideType=function(n){var i=t.getSlideType();return i==n?!0:!1};this.isCurrentSlideLoadingImage=function(){var n=t.getCurrentSlide(),i=n.data("isLoading");return i===!0?!0:!1};this.setItem=function(n,i,r){var s=t.getSlidesReference(),e=s.objCurrentSlide.data("index"),o=n.index,h,f,c;if(o==e)return!0;h=e==undefined;h?(d(s.objCurrentSlide,n),t.placeNabourItems()):(f="left",c=u.getNumItems(),r=="next"?f="left":r=="prev"||e>o?f="right":e>o&&(f="right"),gi(f,n,i))};this.placeNabourItems=function(){var n=t.getSlidesReference(),i=n.objCurrentSlide.data("index"),r=u.getPrevItem(i),f=u.getNextItem(i);d(n.objNextSlide,f);d(n.objPrevSlide,r);it()};this.________EXTERNAL_API___________=function(){};this.stopSlideAction=function(n,i){n||(n=t.getCurrentSlide());i===!0?e.pause():e.hide()};this.startSlideAction=function(i){i||(i=t.getCurrentSlide());var r=hi(i);if(r.type=="image")return!0;n.slider_video_constantsize==!0&&ui();ri();e.show();switch(r.type){case"youtube":e.playYoutube(r.videoid);break;case"vimeo":e.playVimeo(r.videoid);break;case"html5video":e.playHtml5Video(r.videoogv,r.videowebm,r.videomp4,r.urlImage);break;case"soundcloud":e.playSoundCloud(r.trackid);break;case"wistia":e.playWistia(r.videoid)}};this.getScaleMode=function(i){var i,r;return(i||(i=t.getCurrentSlide()),r=t.getSlideType(i),r!="image")?n.slider_scale_mode_media:n.slider_scale_mode==n.slider_scale_mode_fullscreen?n.slider_scale_mode:u.isFullScreen()==!0?n.slider_scale_mode_fullscreen:n.slider_scale_mode};this.getObjects=function(){return{g_objSlider:f,g_objInner:a,g_options:n,g_objZoomSlider:l}};this.getObjZoom=function(){return l};this.getOptions=function(){return n};this.getElement=function(){return f};this.getVideoObject=function(){return e};this.isCurrentSlideImageFit=function(){var n=t.getCurrentSlide(),u=t.getSlideType(n),r;return(di("image",n),r=t.getSlideImage(n),r.length==0)?!1:i.isImageFitParent(r)};this.isCurrentImageInPlace=function(){var n=t.getSlideImage();if(n.length==0)return!1;var f=t.getScaleMode(),e=t.getObjImagePadding(),r=hi(),o=n.parent(),s=i.getImageInsideParentData(o,r.imageWidth,r.imageHeight,f,e),h=i.getElementSize(n),u=!1;return s.imageWidth==h.width&&(u=!0),u};this.isSlideActionActive=function(){return e.isVisible()};this.isSwiping=function(){if(!k)return!1;return k.isTouchActive()};this.isPreloading=function(){var n=ht();return n.is(":visible")?!0:!1};this.setOptions=function(t){et&&(t=i.convertCustomPrefixOptions(t,et,"slider"));n=jQuery.extend(n,t)};this.setSize=function(i,r){var c,o,u,l,w,b;if(i<0||r<0)return!0;c={};c.width=i+"px";c.height=r+"px";f.css(c);o={};o.height=r+"px";o.top="0px";o.left="0px";a.css(o);u={};u.height=r+"px";u.width=i+"px";v.css(u);y.css(u);p.css(u);var k=i-n.slider_item_padding_left-n.slider_item_padding_right,d=r-n.slider_item_padding_top-n.slider_item_padding_bottom,h={};h.width=k+"px";h.height=d+"px";h.top=n.slider_item_padding_top+"px";h.left=n.slider_item_padding_left+"px";f.find(".ug-item-wrapper").css(h);s&&s.setSizeByParent();pi();nt(v);nt(y);nt(p);it();l=t.getSlideType();l!="image"&&n.slider_video_constantsize==!0?ui():(w=i-n.slider_video_padding_left-n.slider_video_padding_right,b=r-n.slider_video_padding_top-n.slider_video_padding_bottom,e.setSize(w,b));ri()};this.refreshSlideItems=function(){if(t.isAnimating()==!0)return!0;nt(v);nt(y);nt(p);it()};this.isMouseOver=function(){return f.ismouseover()};this.setPosition=function(n,t){i.placeElement(f,n,t)};this.zoomIn=function(){if(!l)return!0;l.zoomIn()};this.zoomOut=function(){if(!l)return!0;l.zoomOut()};this.zoomBack=function(){if(!l)return!0;l.zoomBack()}}function UGTextPanel(){function l(r,u){var u,a,v,y,e,c,s,p,h,l,w;u||(u=n.textpanel_padding_top);e=u;i&&(a=e,o.placeElement(i,0,a),v=i.is(":visible"),v==!0?(y=o.getElementSize(i),e=y.bottom,e>0&&(f.lastTitleBottom=e)):(e=20,f.lastTitleBottom>0&&(e=f.lastTitleBottom)));c="";t&&(c=jQuery.trim(t.text()));c!=""&&(s=e,i&&(s+=n.textpanel_padding_title_description),o.placeElement(t,0,s),p=jQuery(t).is(":visible"),p==!0?(h=o.getElementSize(t),e=h.bottom,h.height>0&&(f.lastDescHeight=h.height)):(l=16,f.lastDescHeight>0&&(l=f.lastDescHeight),e=s+l));n.textpanel_height||f.setInternalHeight!=!0||(w=e+n.textpanel_padding_bottom,b(w,r))}function v(){var r=0,u;return i&&(r+=i.outerHeight()),t&&(u="",t&&(u=jQuery.trim(t.text())),u!=""&&(i&&(r+=n.textpanel_padding_title_description),r+=t.outerHeight())),r}function p(){var n=v(),t=(s.height()-n)/2;l(!1,t)}function w(){var t=v(),i=s.height()-t-n.textpanel_padding_bottom;l(!1,i)}function b(t,i){var i,r,f;i||(i=!1);i==!0?(e&&(r=e.height(),t>r&&e.height(t)),f={height:t+"px"},u.add(s).animate(f,n.textpanel_fade_duration)):(e&&e.height(t),u.add(s).height(t))}function y(){var o,r,f;n.textpanel_enable_bg==!0&&(e=u.children(".ug-textpanel-bg"),e.fadeTo(0,n.textpanel_bg_opacity),o={"background-color":n.textpanel_bg_color},o=jQuery.extend(o,n.textpanel_bg_css),e.css(o));n.textpanel_enable_title==!0&&(i=s.children(".ug-textpanel-title"),r={},n.textpanel_title_color!==null&&(r.color=n.textpanel_title_color),n.textpanel_title_font_family!==null&&(r["font-family"]=n.textpanel_title_font_family),n.textpanel_title_text_align!==null&&(r["text-align"]=n.textpanel_title_text_align),n.textpanel_title_font_size!==null&&(r["font-size"]=n.textpanel_title_font_size+"px"),n.textpanel_title_bold!==null&&(r["font-weight"]=n.textpanel_title_bold===!0?"bold":"normal"),n.textpanel_css_title&&(r=jQuery.extend(r,n.textpanel_css_title)),i.css(r));n.textpanel_enable_description==!0&&(t=s.children(".ug-textpanel-description"),f={},n.textpanel_desc_color!==null&&(f.color=n.textpanel_desc_color),n.textpanel_desc_font_family!==null&&(f["font-family"]=n.textpanel_desc_font_family),n.textpanel_desc_text_align!==null&&(f["text-align"]=n.textpanel_desc_text_align),n.textpanel_desc_font_size!==null&&(f["font-size"]=n.textpanel_desc_font_size+"px"),n.textpanel_desc_bold!==null&&(f["font-weight"]=n.textpanel_desc_bold===!0?"bold":"normal"),n.textpanel_css_title&&(f=jQuery.extend(f,n.textpanel_css_description)),t.css(f))}function k(){var n=h.getSelectedItem();r.setText(n.title,n.description)}function d(){jQuery(h).on(h.events.ITEM_CHANGE,k)}var r=this,u,a,i,t,e,s,h,o=new UGFunctions,c="",n={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},f={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};this.positionElements=function(t){if(!n.textpanel_height||n.textpanel_text_valign=="top")return l(t),!1;switch(n.textpanel_text_valign){default:case"top":l(!1);break;case"bottom":w();break;case"center":case"middle":p()}};this.init=function(t,i,r){if(h=t,r&&(c=r,i=o.convertCustomPrefixOptions(i,c,"textpanel")),i&&(n=jQuery.extend(n,i)),n.textpanel_enable_title==!1&&n.textpanel_enable_description==!1)throw new Error("Textpanel Error: The title or description must be enabled");n.textpanel_height&&n.textpanel_height<0&&(n.textpanel_height=null);n.textpanel_desc_style_as_title==!0&&(n.textpanel_desc_color||(n.textpanel_desc_color=n.textpanel_title_color),n.textpanel_desc_bold||(n.textpanel_desc_bold=n.textpanel_title_bold),n.textpanel_desc_font_family||(n.textpanel_desc_font_family=n.textpanel_title_font_family),n.textpanel_desc_font_size||(n.textpanel_desc_font_size=n.textpanel_title_font_size),n.textpanel_desc_text_align||(n.textpanel_desc_text_align=n.textpanel_title_text_align))};this.appendHTML=function(t,i){a=t;i=i?" "+i:"";var r="<div class='ug-textpanel"+i+"'>";n.textpanel_enable_bg==!0&&(r+="<div class='ug-textpanel-bg"+i+"'><\/div>");r+="<div class='ug-textpanel-textwrapper"+i+"'>";n.textpanel_enable_title==!0&&(r+="<div class='ug-textpanel-title"+i+"'><\/div>");n.textpanel_enable_description==!0&&(r+="<div class='ug-textpanel-description"+i+"'><\/div>");r+="<\/div><\/div>";t.append(r);u=t.children(".ug-textpanel");s=u.children(".ug-textpanel-textwrapper");y()};this.destroy=function(){jQuery(h).off(h.events.ITEM_CHANGE)};this.run=function(){r.setSizeByParent();d()};this.setPanelSize=function(h,c){var c,l,a;f.setInternalHeight=!0;c?f.setInternalHeight=!1:c=80;n.textpanel_height&&(c=n.textpanel_height);u.width(h);u.height(c);e&&(e.width(h),e.height(c));l=h-n.textpanel_padding_left-n.textpanel_padding_right;a=n.textpanel_padding_left;o.setElementSizeAndPosition(s,a,0,l,c);i&&i.width(l);t&&t.width(l);f.isFirstTime==!1&&r.positionElements(!1)};this.setSizeByParent=function(){var n=o.getElementSize(a);r.setPanelSize(n.width)};this.setTextPlain=function(n,r){i&&i.html(n);t&&t.html(r)};this.setText=function(t,i){f.isFirstTime==!0?(r.setTextPlain(t,i),f.isFirstTime=!1,r.positionElements(!1)):s.stop().fadeTo(n.textpanel_fade_duration,0,function(){r.setTextPlain(t,i);r.positionElements(!0);jQuery(this).fadeTo(n.textpanel_fade_duration,1)})};this.positionPanel=function(t,i){var r={};if(t!==undefined&&t!==null)r.top=t,r.bottom="auto";else switch(n.textpanel_align){case"top":r.top=n.textpanel_margin+"px";break;case"bottom":r.top="auto";r.bottom=n.textpanel_margin+"px";break;case"middle":r.top=o.getElementRelativePos(u,"middle",n.textpanel_margin)}i!==undefined&&i!==null&&(r.left=i);u.css(r)};this.setOptions=function(t){c&&(t=o.convertCustomPrefixOptions(t,c,"textpanel"));n=jQuery.extend(n,t)};this.getElement=function(){return u};this.getSize=function(){return o.getElementSize(u)};this.refresh=function(n,t,i,u){y();i?r.setPanelSize(i,u):r.setSizeByParent();r.positionElements(!1);t!==!0&&r.positionPanel();n===!0&&r.show()};this.hide=function(){u.hide()};this.show=function(){u.show()};this.getOptions=function(){return n};this.getOption=function(t){return n.hasOwnProperty(t)==!1?null:n[t]}}function UGZoomButtonsPanel(){function e(n){return n?n.hasClass("ug-zoompanel-button-disabled")?!0:!1:!0}function s(n){n&&n.addClass("ug-zoompanel-button-disabled")}function h(n){n&&n.removeClass("ug-zoompanel-button-disabled")}function c(){if(t.isCurrentSlideType("image")==!1)return!0;var r=t.isCurrentSlideImageFit();r==!0?e(n)==!1&&(s(n),s(i)):e(n)==!0&&(h(n),h(i))}var l=this,u,a,f,n,i,t=new UGSlider,r=new UGFunctions,o={slider_zoompanel_skin:""};this.init=function(n,i){t=n;i&&(o=jQuery.extend(o,i))};this.appendHTML=function(t){a=t;var r="<div class='ug-slider-control ug-zoompanel ug-skin-"+o.slider_zoompanel_skin+"'>";r+="<div class='ug-zoompanel-button ug-zoompanel-plus'><\/div>";r+="<div class='ug-zoompanel-button ug-zoompanel-minus ug-zoompanel-button-disabled'><\/div>";r+="<div class='ug-zoompanel-button ug-zoompanel-return ug-zoompanel-button-disabled'><\/div>";r+="<\/div>";t.append(r);u=t.children(".ug-zoompanel");f=u.children(".ug-zoompanel-plus");n=u.children(".ug-zoompanel-minus");i=u.children(".ug-zoompanel-return")};this.setObjects=function(t,r,u){f=t;n=r;i=u;n&&n.addClass("ug-zoompanel-button-disabled");i&&i.addClass("ug-zoompanel-button-disabled")};this.getElement=function(){return u};l.initEvents=function(){r.addClassOnHover(f,"ug-button-hover");r.addClassOnHover(n,"ug-button-hover");r.addClassOnHover(i,"ug-button-hover");r.setButtonOnClick(f,function(){if(e(f)==!0)return!0;t.zoomIn()});r.setButtonOnClick(n,function(){if(e(n)==!0)return!0;t.zoomOut()});r.setButtonOnClick(i,function(){if(e(i)==!0)return!0;t.zoomBack()});jQuery(t).on(t.events.ZOOM_CHANGE,c);jQuery(t).on(t.events.ITEM_CHANGED,c)}}function UGBullets(){function o(){var e="",o="",u,f;for(n.bullets_space_between!=-1&&(o=" style='margin-left:"+n.bullets_space_between+"px'"),u=0;u<t;u++)e+=u==0?"<div class='ug-bullet'><\/div>":"<div class='ug-bullet'"+o+"><\/div>";i.html(e);r||(f=i.find(".ug-bullet:first-child"),f.length&&(r=f.width()))}function y(n){if(u.isActive(n)==!0)return!0;var t=n.index();jQuery(u).trigger(u.events.BULLET_CLICK,t)}function s(){var n=i.children(".ug-bullet");v.setButtonOnClick(n,y);n.on("mousedown mouseup",function(){return!1})}function h(n){if(n<0||n>=t)throw new Error("wrong bullet index: "+n);}function c(){if(e.isInited==!0)return!0;throw new Error("The bullets are not inited!");}var u=this,t=0,f=new UniteGalleryMain,i,l,a=-1,r,v=new UGFunctions,e={isInited:!1},n={bullets_skin:"",bullets_addclass:"",bullets_space_between:-1};this.events={BULLET_CLICK:"bullet_click"};this.init=function(i,r,u){f=i;t=u?u:f.getNumItems();e.isInited=!0;n=jQuery.extend(n,r);n.bullets_skin==""&&(n.bullets_skin=n.gallery_skin)};this.getBulletsWidth=function(){if(t==0||!r)return 0;return t*r+(t-1)*n.bullets_space_between};this.appendHTML=function(t){var r,u;l=t;c();r="";n.bullets_addclass!=""&&(r=" "+n.bullets_addclass);u="<div class='ug-slider-control ug-bullets ug-skin-"+n.bullets_skin+r+"'>";u+="<\/div>";i=jQuery(u);t.append(i);o();s()};this.updateNumBullets=function(n){t=n;o();s()};this.getElement=function(){return i};this.setActive=function(n){var t,r;c();h(n);t=i.children(".ug-bullet");t.removeClass("ug-bullet-active");r=jQuery(t[n]);r.addClass("ug-bullet-active");a=n};this.isActive=function(n){var t;return(h(n),t=typeof n!="number"?n:i.children(".ug-bullet")[n],t.hasClass("ug-bullet-active"))?!0:!1};this.getNumBullets=function(){return t}}function UGProgressBar(){var r=this,u=0,n,t,f=new UGFunctions,i={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(r,u){u&&(i=jQuery.extend(i,u));r.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'><\/div><\/div>");n=r.children(".ug-progress-bar");t=n.children(".ug-progress-bar-inner");t.css("background-color",i.slider_progressbar_color);n.height(i.slider_progressbar_line_width);t.height(i.slider_progressbar_line_width);t.width("0%");var f=i.slider_progressbar_opacity,e=t[0];e.style.opacity=f;e.style.filter="alpha(opacity="+f*100+")"};this.putHidden=function(t,i){r.put(t,i);n.hide()};this.getElement=function(){return n};this.setSize=function(i){n.width(i);t.width(i);r.draw()};this.setPosition=function(t,i,r,u){f.placeElement(n,t,i,r,u)};this.draw=function(){var n=u*100;t.width(n+"%")};this.setProgress=function(n){u=f.normalizePercent(n);r.draw()};this.getType=function(){return"bar"}}function UGProgressPie(){function u(r){var r,o,u,c;r||(r=0);o=Math.min(n.slider_progresspie_width,n.slider_progresspie_height)/2;u=t[0].getContext("2d");i==!1&&(i=!0,u.rotate(Math.PI*(3/2)),u.translate(-2*o,0));u.clearRect(0,0,n.slider_progresspie_width,n.slider_progresspie_height);var f=n.slider_progresspie_width/2,e=n.slider_progresspie_height/2,h=0,s=r*Math.PI*2;n.slider_progresspie_type_fill==!0?(u.beginPath(),u.moveTo(f,e),u.arc(f,e,o,h,s),u.lineTo(f,e),u.fillStyle=n.slider_progresspie_color1,u.fill(),u.closePath()):(u.globalCompositeOperation="source-over",u.beginPath(),u.moveTo(f,e),u.arc(f,e,o,h,s),u.lineTo(f,e),u.fillStyle=n.slider_progresspie_color1,u.fill(),u.closePath(),u.globalCompositeOperation="destination-out",c=o-n.slider_progresspie_stroke_width,u.beginPath(),u.moveTo(f,e),u.arc(f,e,c,h,s),u.lineTo(f,e),u.fillStyle=n.slider_progresspie_color1,u.fill(),u.closePath());n.slider_progresspie_type_fill==!0&&(h=s,s=Math.PI*2,u.beginPath(),u.arc(f,e,o,h,s),u.lineTo(f,e),u.fillStyle=n.slider_progresspie_color2,u.fill(),u.closePath())}var f=this,i=!1,e,t,r=new UGFunctions,n={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};this.put=function(i,r){r&&(n=jQuery.extend(n,r));i.append("<canvas class='ug-canvas-pie' width='"+n.slider_progresspie_width+"' height='"+n.slider_progresspie_height+"'><\/canvas>");t=i.children(".ug-canvas-pie")};this.putHidden=function(n,i){f.put(n,i);u(.1);t.hide()};this.getElement=function(){return t};this.setPosition=function(n,i){r.placeElement(t,n,i)};this.getSize=function(){return{width:n.slider_progresspie_width,height:n.slider_progresspie_height}};this.setProgress=function(n){n=r.normalizePercent(n);e=n;u(n)};this.getType=function(){return"pie"}}function UGTouchSliderControl(){function o(n){var n;n||(n=t.getSlidesReference());var u=i.getElementSize(n.objCurrentSlide),f=-u.left,e=i.getElementSize(r);return f-e.left}function v(){var i=t.getSlidesReference(),e=o(i),s=Math.round(i.objCurrentSlide.width()*3/8),r,h,u,f;return Math.abs(e)>=s?!0:(r=Math.abs(n.lastMouseX-n.startMouseX),h=Math.abs(n.lastMouseY-n.startMouseY),r<20)?!1:(u=jQuery.now(),f=u-n.startTime,f<500)?!0:!1}function h(e){var e,s,o;if(t.isInnerInPlace()==!0)return!1;f.trigger(t.events.BEFORE_RETURN);e||(e=t.getSlidesReference());s=i.getElementSize(e.objCurrentSlide);o=-s.left;r.animate({left:o+"px"},{duration:u.slider_transition_return_speed,easing:u.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(n.isDragVideo==!0){var t=i.getElementSize(r),u=t.left,f=u-o,e=n.videoStartX+f;n.videoObject.css("left",e)}},complete:function(){f.trigger(t.events.AFTER_RETURN)}})}function y(n){t.getVideoObject().hide();t.switchSlideNums(n);t.placeNabourItems()}function c(){var e=t.getSlidesReference(),a=o(e),c,s,v,p,l;if(a==0)return!1;c=a>0?"left":"right";s=!1;switch(c){case"right":t.isSlideHasItem(e.objPrevSlide)?(v=i.getElementSize(e.objPrevSlide),l=-v.left):s=!0;break;case"left":t.isSlideHasItem(e.objNextSlide)?(p=i.getElementSize(e.objNextSlide),l=-p.left):s=!0}s==!0?h(e):r.stop().animate({left:l+"px"},{duration:u.slider_transition_continuedrag_speed,easing:u.slider_transition_continuedrag_easing,queue:!1,progress:function(){if(n.isDragVideo==!0){var t=i.getElementSize(r),u=t.left,f=u-n.startPosx,e=n.videoStartX+f;n.videoObject.css("left",e)}},always:function(){y(c);f.trigger(t.events.AFTER_DRAG_CHANGE)}})}function p(i){var o=n.lastMouseX-n.startMouseX,h,s,c,u,a,v,y,p;if(o==0)return!0;if(h=o<0?"left":"right",s=t.getObjZoom(),s){if(c=s.isPanEnabled(i,h),c==!0)return n.isInitDataValid=!1,!0;if(n.isInitDataValid==!1)return l(i),!0}u=n.startPosx+o;o>0&&u>0?u=u/3:o<0&&(a=u+r.width(),v=e.width(),a<v&&(u=n.startPosx+o/3));n.isDragging==!1&&(n.isDragging=!0,f.trigger(t.events.START_DRAG));r.css("left",u+"px");n.isDragVideo==!0&&(y=u-n.startPosx,p=n.videoStartX+y,n.videoObject.css("left",p))}function l(t){var u=i.getMousePosition(t),f,e;n.startMouseX=u.pageX;n.startMouseY=u.pageY;n.lastMouseX=n.startMouseX;n.lastMouseY=n.startMouseY;n.startTime=jQuery.now();f=i.getArrTouches(t);n.startArrTouches=i.getArrTouchPositions(f);e=i.getElementSize(r);n.startPosx=e.left;n.isInitDataValid=!0;n.isDragVideo=!1;i.storeEventData(t,n.storedEventID)}function s(){n.touch_active=!1}function a(t,i){n.touch_active=!0;l(i)}function w(u){u.preventDefault();n.isDragging=!1;t.isAnimating()==!0&&r.stop(!0,!0);var f=i.getArrTouches(u);if(f.length>1)return n.touch_active==!0&&s("1"),!0;if(n.touch_active==!0)return!0;a("1",u)}function b(t){var r,f;if(n.touch_active==!1)return!0;if(t.buttons==0)return s("2"),c(),!0;i.updateStoredEventData(t,n.storedEventID);t.preventDefault();r=i.getMousePosition(t);n.lastMouseX=r.pageX;n.lastMouseY=r.pageY;f=null;u.slider_vertical_scroll_ondrag==!0&&(f=i.handleScrollTop(n.storedEventID));f!=="vert"&&p(t)}function k(r){var o=i.getArrTouches(r),u=o.length,l=t.isInnerInPlace(),f,e;if(l==!0&&n.touch_active==!1&&u==0)return!0;u==0&&n.touch_active==!0?(s("3"),f=!1,e=i.wasVerticalScroll(n.storedEventID),e==!1&&(f=v()),f==!0?c():h()):u==1&&n.touch_active==!1&&a("2",r)}function d(){e.bind("mousedown touchstart",w);jQuery("body").bind("mousemove touchmove",b);jQuery(window).add("body").bind("mouseup touchend",k)}var e,r,t=new UGSlider,f,g=this,i=new UGFunctions,u={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},n={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};this.isTapEventOccured=function(r){var f=i.getArrTouches(r),u=f.length;if(u!=0||n.lastNumTouches!=0)return n.lastNumTouches=u,!1;n.lastNumTouches=u;var e=t.getSlidesReference(),a=o(e),s=Math.abs(n.lastMouseX-n.startMouseX),h=Math.abs(n.lastMouseY-n.startMouseY),c=jQuery.now(),l=c-n.startTime;return s<20&&h<50&&l<500?!0:!1};this.init=function(n,i){t=n;f=jQuery(t);g_objects=n.getObjects();e=g_objects.g_objSlider;r=g_objects.g_objInner;u=jQuery.extend(u,i);d()};this.getLastMousePos=function(){return{pageX:n.lastMouseX,pageY:n.lastMouseY}};this.isTouchActive=function(){return n.touch_active}}function UGZoomSliderControl(){function p(n,t){i=n;r=jQuery(i);g_objects=n.getObjects();e=g_objects.g_objSlider;y=g_objects.g_objInner;u=jQuery.extend(u,t);ft()}function h(){var n=i.getScaleMode();return n!="down"&&(n="fit"),n}function o(){var r=jQuery.now(),e=r-n.storeImageLastTime,u,f;return e<20?!1:(u=i.getSlidesReference(),n.objSlide=u.objCurrentSlide,n.objImage=u.objCurrentSlide.find("img"),n.objImage.length==0)?!1:(n.objImageSize=t.getElementSize(n.objImage),n.objParent=n.objImage.parent(),n.objParentSize=t.getElementSize(n.objParent),f=h(),objPadding=i.getObjImagePadding(),n.objFitImageSize=t.getImageInsideParentDataByImage(n.objImage,f,objPadding),r=jQuery.now(),n.storeImageLastTime=r,!0)}function f(n,f){var v=i.getSlidesReference(),e=v.objCurrentSlide.find("img"),l=h(),o,s,c,a;r.trigger(i.events.ZOOM_START);o=!0;s=i.getObjImagePadding();n=="back"?(c=t.getImageOriginalSize(e),t.scaleImageFitParent(e,c.width,c.height,l,s)):(a=n=="in"?!0:!1,o=t.zoomImageInsideParent(e,a,u.slider_zoom_step,f,l,u.slider_zoom_max_ratio,s));o==!0&&(r.trigger(i.events.ZOOMING),r.trigger(i.events.ZOOM_CHANGE),r.trigger(i.events.ZOOM_END))}function s(n,i,r){var u=t.getArrTouches(i);if(r===!0){if(u.length!=1)return!1}else if(u.length>1)return!1;return t.isElementBiggerThenParent(n)?!0:!1}function w(i){var r=t.getMousePosition(i);n.startMouseX=r.pageX;n.startMouseY=r.pageY;n.lastMouseX=n.startMouseX;n.lastMouseY=n.startMouseY;n.startImageX=n.objImageSize.left;n.startImageY=n.objImageSize.top;n.panXActive=n.objImageSize.width>n.objParentSize.width;n.panYActive=n.objImageSize.height>n.objParentSize.height}function c(t){n.isPanActive=!0;w(t)}function b(r){var e,c,l;if(n.objImage==undefined||n.objImage.length==0)return!0;var o=t.getMousePosition(r),a=o.pageX-n.startMouseX,v=o.pageY-n.startMouseY,u=o.pageX-n.lastMouseX,f=o.pageY-n.lastMouseY,s=u<0?"left":"right",h=f<0?"up":"down";n.lastMouseX=o.pageX;n.lastMouseY=o.pageY;e=t.getElementSize(n.objImage);n.panYActive==!1?f=0:h=="down"&&e.top>0?f=f/3:h=="up"&&e.bottom<n.objParentSize.height&&(f=f/3);n.panXActive==!1||i.isInnerInPlace()==!1?u=0:s=="right"&&e.left>0?u=u/3:s=="left"&&e.right<n.objParentSize.width&&(u=u/3);c=e.left+u;l=e.top+f;t.placeElement(n.objImage,c,l)}function k(){var f=!1,e=!1,o=0,s=0,r=t.getElementSize(n.objImage),l=i.getObjImagePadding(),h=t.getElementCenterPosition(n.objImage,l),c;n.panXActive=n.objImageSize.width>n.objParentSize.width;n.panYActive=n.objImageSize.height>n.objParentSize.height;n.panYActive==!0?r.top>0?(s=0,e=!0):r.bottom<n.objParentSize.height&&(s=n.objParentSize.height-r.height,e=!0):r.top!=h.top&&(e=!0,s=h.top);n.panXActive==!0?r.left>0?(o=0,f=!0):r.right<n.objParentSize.width&&(o=n.objParentSize.width-r.width,f=!0):r.left!=h.left&&(f=!0,o=h.left);c={};e==!0&&(c.top=s+"px");f==!0&&(c.left=o+"px");(e==!0||f==!0)&&n.objImage.animate(c,{duration:u.slider_zoom_return_pan_duration,easing:u.slider_zoom_return_pan_easing,queue:!1})}function d(){return n.objImage&&n.objImage.is(":animated")?!0:!1}function g(u){n.isZoomActive=!0;n.startDistance=t.getDistance(u[0].pageX,u[0].pageY,u[1].pageX,u[1].pageY);n.startDistance==0&&(n.startDistance=1);n.startMiddlePoint=t.getMiddlePoint(u[0].pageX,u[0].pageY,u[1].pageX,u[1].pageY);n.objImageSize=t.getElementSize(n.objImage);n.startImageX=n.objImageSize.left;n.startImageY=n.objImageSize.top;n.imageOrientPoint=t.getElementLocalPoint(n.startMiddlePoint,n.objImage);var f=t.isPointInsideElement(n.imageOrientPoint,n.objImageSize);f==!1&&(n.imageOrientPoint=t.getElementCenterPoint(n.objImage));r.trigger(i.events.ZOOM_START)}function l(u){if(n.isZoomActive==!1)return!1;var f=t.getArrTouches(u);f.length!=2&&(n.isZoomActive=!1,r.trigger(i.events.ZOOM_END))}function a(i){if(n.isZoomActive==!0)return!0;var r=t.getArrTouches(i);if(r.length!=2)return!0;g(r)}function nt(f){var e=t.getArrTouches(f),a=t.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),o=a/n.startDistance,s=t.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),h=n.objImageSize.width*o,v=n.objImageSize.height*o,c=t.getImageOriginalSize(n.objImage),l=1;if(c.width>0&&(l=h/c.width),l>u.slider_zoom_max_ratio)return!0;panX=-(n.imageOrientPoint.x*o-n.imageOrientPoint.x);panY=-(n.imageOrientPoint.y*o-n.imageOrientPoint.y);var y=s.x-n.startMiddlePoint.x,p=s.y-n.startMiddlePoint.y,w=n.startImageX+panX+y,b=n.startImageY+panY+p;t.setElementSizeAndPosition(n.objImage,w,b,h,v);r.trigger(i.events.ZOOMING);r.trigger(i.events.ZOOM_CHANGE)}function v(){var i,r;if(n.objImage==undefined||n.objImage.length==0)return!0;i=t.getElementSize(n.objImage);i.width<n.objFitImageSize.imageWidth?(n.objImage.css({position:"absolute",margin:"none"}),r={top:n.objFitImageSize.imageTop+"px",left:n.objFitImageSize.imageLeft+"px",width:n.objFitImageSize.imageWidth+"px",height:n.objFitImageSize.imageHeight+"px"},n.objImage.animate(r,{duration:u.slider_zoom_return_pan_duration,easing:u.slider_zoom_return_pan_easing,queue:!1})):k()}function tt(t){if(i.isCurrentSlideType("image")==!1)return!0;var r=o();if(n.objImage==undefined||n.objImage.length==0)return!0;t.preventDefault();d()==!0&&n.objImage.stop(!0);n.isZoomActive==!0?l(t):a(t);n.isZoomActive==!0?n.isPanActive=!1:s(n.objImage,t)==!0&&n.isZoomedOnce==!0&&c(t)}function it(t){var r,h,u,f,e;if(i.isCurrentSlideType("image")==!1)return!0;if(r=jQuery(t.target),r.data("ug-button")==!0)return!1;if(h=o(),n.objImage==undefined||n.objImage.length==0)return!0;if(u=n.isPanActive,f=n.isZoomActive,i.isInnerInPlace()==!1)return n.isZoomActive=!1,n.isPanActive=!1,!0;n.isZoomActive==!0?l(t):a(t);n.isZoomActive==!0?n.isPanActive=!1:(e=s(n.objImage,t,!0),n.isPanActive==!0?n.isPanActive=!1:e==!0&&c(t));(u||f)&&n.isZoomActive==!1&&n.isPanActive==!1&&v()}function rt(t){if(i.isCurrentSlideType("image")==!1)return!0;n.isZoomActive==!0?nt(t):n.isPanActive==!0&&b(t)}function ut(n,r){if(u.slider_zoom_mousewheel==!1||i.isCurrentSlideType("image")==!1)return!0;n.preventDefault();var e=r>0,o=t.getMousePosition(n),s=e==!0?"in":"out";f(s,o)}function ft(){e.on("mousewheel",ut);e.bind("mousedown touchstart",tt);jQuery("body").bind("mousemove touchmove",rt);jQuery(window).add("body").bind("mouseup touchend",it);r.bind(i.events.BEFORE_RETURN,function(){v()});r.bind(i.events.ITEM_CHANGED,function(){n.isZoomedOnce=!1});r.bind(i.events.ZOOM_CHANGE,function(){n.isZoomedOnce=!0})}var e,y,i=new UGSlider,r,t=new UGFunctions,et=this,u={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},n={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};this.________EXTERNAL_____________=function(){};this.isPanEnabled=function(t,r){if((o(),n.objImage==undefined||n.objImage.length==0)||n.isZoomedOnce==!1||s(n.objImage,t)==!1||i.isInnerInPlace()==!1)return!1;if(r=="left"){if(n.objImageSize.right<=n.objParentSize.width)return!1}else if(n.objImageSize.left>=0)return!1;return!0};this.init=function(n,t){p(n,t)};this.zoomIn=function(){f("in")};this.zoomOut=function(){f("out")};this.zoomBack=function(){f("back")}}function UGWistiaAPI(){function u(){return typeof Wistia!="undefined"}function e(t,i,u,f,e){n=null;r=!1;var s=t+"_video",h="<div id='"+s+"' class='wistia_embed' style='width:"+u+";height:"+f+";' data-video-width='"+u+"' data-video-height='"+f+"'>&nbsp;<\/div>";jQuery("#"+t).html(h);n=Wistia.embed(i,{version:"v1",videoWidth:u,videoHeight:f,container:s,autoPlay:e});r=!0;o()}function o(){n.bind("play",function(){i.trigger(t.events.START_PLAYING)});n.bind("pause",function(){i.trigger(t.events.STOP_PLAYING)});n.bind("end",function(){i.trigger(t.events.STOP_PLAYING);i.trigger(t.events.VIDEO_ENDED)})}this.isAPILoaded=!1;var t=this,i=jQuery(this),f,n,r=!1;this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"};this.loadAPI=function(){if(g_ugWistiaAPI.isAPILoaded==!0)return!0;if(u())return g_ugWistiaAPI.isAPILoaded=!0,!0;g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0);g_ugWistiaAPI.isAPILoaded=!0};this.doCommand=function(t){if(n==null||r==!1)return!1;switch(t){case"play":n.play();break;case"pause":n.pause()}};this.pause=function(){t.doCommand("pause")};this.play=function(){t.doCommand("play")};this.putVideo=function(n,t,i,r,o){if(u())return e(n,t,i,r,o),!0;this.loadAPI();f=setInterval(function(){u()&&(e(n,t,i,r,o),clearInterval(f))},500)};this.isPlayerReady=function(){return r&&n?!0:!1}}function UGSoundCloudAPI(){function u(){return typeof SC!="undefined"}function e(t,i,u,f,e){var h,s,c;n=null;g_isPlayerReady=!1;h=t+"_iframe";s=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+i;s+="&amp;buying=false&amp;liking=false&amp;download=false&amp;sharing=false&amp;show_artwork=true&show_comments=false&amp;show_playcount=true&amp;show_user=false&amp;hide_related=true&amp;visual=true&amp;start_track=0&amp;callback=true";s+=e===!0?"&amp;auto_play=true":"&amp;auto_play=false";c="<iframe id='"+h+"' src="+s+" width='"+u+"' height='"+f+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe>";jQuery("#"+t).html(c);n=SC.Widget(h);n.bind(SC.Widget.Events.READY,function(){n&&(g_isPlayerReady=!0,o())});r=t}function o(){n.bind(SC.Widget.Events.PLAY,function(){i.trigger(t.events.START_PLAYING)});n.bind(SC.Widget.Events.PAUSE,function(){i.trigger(t.events.STOP_PLAYING)});n.bind(SC.Widget.Events.FINISH,function(){i.trigger(t.events.STOP_PLAYING);i.trigger(t.events.VIDEO_ENDED)})}this.isAPILoaded=!1;var t=this,i=jQuery(this),f,n,r;this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"};this.loadAPI=function(){if(g_ugSoundCloudAPI.isAPILoaded==!0)return!0;if(u())return g_ugSoundCloudAPI.isAPILoaded=!0,!0;g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0);g_ugSoundCloudAPI.isAPILoaded=!0};this.putSound=function(n,t,i,r,o){if(u())return e(n,t,i,r,o),!0;this.loadAPI();f=setInterval(function(){u()&&(e(n,t,i,r,o),clearInterval(f))},500)};this.doCommand=function(t){if(n==null||g_isPlayerReady==!1)return!1;switch(t){case"play":n.play();break;case"pause":n.pause()}};this.pause=function(){t.doCommand("pause")};this.play=function(){t.doCommand("play")};this.destroy=function(){g_isPlayerReady=!1;n=null;r&&(jQuery("#"+r).html(""),r=null)}}function UGHtml5MediaAPI(){function r(){return typeof mejs!="undefined"}function f(t,i,r,u,f){var h,o;n=null;g_isPlayerReady=!1;var s=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",a=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",c=t+"_video",l="";f&&f===!0&&(l="autoplay='autoplay'");h="";i.posterImage&&(h="poster='"+i.posterImage+"'");o="<video id='"+c+"' width='"+r+"' height='"+u+"'  controls='controls' preload='none' "+l+" "+h+">";i.mp4!=""&&(o+="<source type='video/mp4' src='"+i.mp4+"' />");i.webm!=""&&(o+="<source type='video/webm' src='"+i.webm+"' />");i.ogv!=""&&(o+="<source type='video/ogg' src='"+i.ogv+"' />");o+="<object width='"+r+"' height='"+u+"' type='application/x-shockwave-flash' data='"+s+"'>";o+="<param name='movie' value='"+s+"' />";o+="<param name='flashvars' value='controls=true&file="+i.mp4+"' />";o+="<\/object>";o+="<\/video>";jQuery("#"+t).html(o);new MediaElement(c,{enablePluginDebug:!1,flashName:s,silverlightName:a,success:function(t){g_isPlayerReady=!0;n=t;f==!1&&n.pause();e()},error:function(n){trace(n)}})}function e(){g_ugFunctions.addEvent(n,"play",function(){i.trigger(t.events.START_PLAYING)});g_ugFunctions.addEvent(n,"pause",function(){i.trigger(t.events.STOP_PLAYING)});g_ugFunctions.addEvent(n,"ended",function(){i.trigger(t.events.STOP_PLAYING);i.trigger(t.events.VIDEO_ENDED)})}this.isAPILoaded=!1;var t=this,i=jQuery(this),u,n;this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"};this.loadAPI=function(){if(g_ugHtml5MediaAPI.isAPILoaded==!0)return!0;if(r())return g_ugHtml5MediaAPI.isAPILoaded=!0,!0;g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0);g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0);g_ugHtml5MediaAPI.isAPILoaded=!0};this.putVideo=function(n,t,i,e,o){if(r())return f(n,t,i,e,o),!0;this.loadAPI();u=setInterval(function(){r()&&(f(n,t,i,e,o),clearInterval(u))},500)};this.doCommand=function(t){if(n==null||g_isPlayerReady==!1)return!1;switch(t){case"play":n.play();break;case"pause":n.pause()}};this.pause=function(){t.doCommand("pause")};this.play=function(){t.doCommand("play")}}function UGVimeoAPI(){function f(){return typeof Froogaloop!="undefined"}function s(t,r,f,e,o){var s,c,l;n=null;i=!1;s=location.protocol+"//player.vimeo.com/video/"+r+"?api=1";o===!0&&(s+="&amp;byline=0&amp;autoplay=1&amp;title=0&amp;portrait=0");c="<iframe src="+s+" width='"+f+"' height='"+e+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen><\/iframe>";jQuery("#"+t).html(c);l=jQuery("#"+t+" iframe")[0];n=Froogaloop(l);n.addEvent("ready",function(){n&&(i=!0,h())});u=t}function h(){if(!n)return!1;n.addEvent("cuechange",function(){o==!0&&t.play()});n.addEvent("play",function(){r.trigger(t.events.START_PLAYING)});n.addEvent("pause",function(){r.trigger(t.events.STOP_PLAYING)});n.addEvent("finish",function(){r.trigger(t.events.STOP_PLAYING);r.trigger(t.events.VIDEO_ENDED)})}this.isAPILoaded=!1;var t=this,r=jQuery(this),e,n=null,i=!1,u,o=!1;this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"};this.loadAPI=function(){if(g_ugVimeoAPI.isAPILoaded==!0)return!0;if(f())return g_ugVimeoAPI.isAPILoaded=!0,!0;g_ugFunctions.loadJs("f.vimeocdn.com/js/froogaloop2.min.js",!0);g_ugVimeoAPI.isAPILoaded=!0};this.doCommand=function(t){if(n==null||i==!1)return!1;switch(t){default:n.api(t)}};this.pause=function(){t.doCommand("pause")};this.play=function(){t.doCommand("play")};this.destroy=function(){n&&(n.api("unload"),n=null,i=!1);u&&jQuery("#"+u).html("")};this.putVideo=function(n,t,i,r,u){if(f())return s(n,t,i,r,u),!0;this.loadAPI();e=setInterval(function(){f()&&(s(n,t,i,r,u),clearInterval(e))},500)};this.isPlayerReady=function(){return i&&n?!0:!1};this.changeVideo=function(i,r){if(t.isPlayerReady()==!1)return!1;o=r;n.api("loadVideo",i)};this.getVideoImages=function(n,t,i){var r=location.protocol+"//vimeo.com/api/v2/video/"+n+".json";jQuery.get(r,{},function(n){var r={};r.preview=n[0].thumbnail_large;r.thumb=n[0].thumbnail_medium;i(t,r)})}}function UGYoutubeAPI(){function s(t,r,f,e,s){n&&i&&n.destroy();var h={controls:2,showinfo:u.video_youtube_showinfo,rel:0};s===!0&&(h.autoplay=1);i=!1;n=new YT.Player(t,{height:e,width:f,videoId:r,playerVars:h,events:{onReady:c,onStateChange:l}});o=t}function h(){return typeof YT!="undefined"&&typeof YT.Player!="undefined"?!0:!1}function c(){i=!0}function l(){if(typeof n.getPlayerState!="function")return trace("Youtube API error: can't get player state"),!1;var i=n.getPlayerState();switch(i){case YT.PlayerState.PLAYING:r.trigger(t.events.START_PLAYING);break;case YT.PlayerState.ENDED:r.trigger(t.events.STOP_PLAYING);r.trigger(t.events.VIDEO_ENDED);break;default:e==YT.PlayerState.PLAYING&&r.trigger(t.events.STOP_PLAYING)}e=i}this.isAPILoaded=!1;var t=this,n=null,f,i=!1,r=jQuery(this),e=-1,o,u={video_youtube_showinfo:!0};this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"};this.setOptions=function(n){u=jQuery.extend(u,n)};this.putVideo=function(n,t,i,r,u){if(h())return s(n,t,i,r,u),!0;this.loadAPI();f=setInterval(function(){h()&&(s(n,t,i,r,u),clearInterval(f))},500)};this.loadAPI=function(){if(g_ugYoutubeAPI.isAPILoaded==!0)return!0;if(typeof YT!="undefined")return g_ugYoutubeAPI.isAPILoaded=!0,!0;g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1);g_ugYoutubeAPI.isAPILoaded=!0};this.doCommand=function(t,r){if(!n)return!0;if(i==!1)return!1;switch(t){case"play":if(typeof n.playVideo!="function")return!1;n.playVideo();break;case"pause":if(typeof n.pauseVideo!="function")return!1;n.pauseVideo();break;case"seek":if(typeof n.seekTo!="function")return!1;n.seekTo(r);break;case"stopToBeginning":var u=n.getPlayerState();n.pauseVideo();switch(u){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:n.seekTo(0)}}};this.play=function(){t.doCommand("play")};this.pause=function(){t.doCommand("pause")};this.destroy=function(){try{n&&(i=!1,n.clearVideo(),n.destroy())}catch(t){jQuery("#"+o).html("")}};this.stopToBeginning=function(){t.doCommand("stopToBeginning")};this.changeVideo=function(i,r){if(t.isPlayerReady()==!1)return!1;r&&r==!0?n.loadVideoById(i,0,"large"):n.cueVideoById(i,0,"large")};this.isPlayerReady=function(){return i&&n?!0:!1};this.getVideoImages=function(n){var t={};return t.preview="https://i.ytimg.com/vi/"+n+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+n+"/default.jpg",t}}function UGVideoPlayer(){function it(){s.hide()}function l(){y.trigger(s.events.PLAY_START);i&&i.hide()}function a(){y.trigger(s.events.PLAY_STOP);i&&i.show()}function k(){y.trigger(s.events.VIDEO_ENDED)}function rt(){i&&(p.setButtonMobileReady(i),p.setButtonOnClick(i,it));jQuery(t).on(t.events.START_PLAYING,l);jQuery(t).on(t.events.STOP_PLAYING,a);jQuery(t).on(t.events.VIDEO_ENDED,k);jQuery(r).on(r.events.START_PLAYING,l);jQuery(r).on(r.events.STOP_PLAYING,a);jQuery(r).on(r.events.VIDEO_ENDED,k);jQuery(e).on(e.events.START_PLAYING,l);jQuery(e).on(e.events.STOP_PLAYING,a);jQuery(e).on(e.events.VIDEO_ENDED,k);jQuery(u).on(u.events.START_PLAYING,l);jQuery(u).on(u.events.STOP_PLAYING,a);jQuery(u).on(u.events.VIDEO_ENDED,k);jQuery(o).on(o.events.START_PLAYING,l);jQuery(o).on(o.events.STOP_PLAYING,a);jQuery(o).on(o.events.VIDEO_ENDED,k)}function v(n){var f=["youtube","vimeo","html5","soundcloud","wistia"],s,i;for(s in f)if(i=f[s],i!=n)switch(i){case"youtube":t.pause();t.destroy();w.hide();break;case"vimeo":r.pause();r.destroy();d.hide();break;case"html5":e.pause();g.hide();break;case"soundcloud":u.pause();u.destroy();nt.hide();break;case"wistia":o.pause();tt.hide()}}var s=this,c,y=jQuery(this),p=new UGFunctions,t=new UGYoutubeAPI,r=new UGVimeoAPI,e=new UGHtml5MediaAPI,u=new UGSoundCloudAPI,o=new UGWistiaAPI,f,w,d,g,i,nt,tt,h=null,b={video_enable_closebutton:!0},n;this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"};n={standAloneMode:!1,youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",soundCloudPlayerID:""};this.init=function(i,r,u){if(c=u,!c)throw new Error("missing gallery ID for video player, it's a must!");b=jQuery.extend(b,i);t.setOptions(b);r&&r==!0&&(n.standAloneMode=!0)};this.setHtml=function(t){n.youtubeInnerID=c+"_youtube_inner";n.vimeoPlayerID=c+"_videoplayer_vimeo";n.html5PlayerID=c+"_videoplayer_html5";n.wistiaPlayerID=c+"_videoplayer_wistia";n.soundCloudPlayerID=c+"_videoplayer_soundcloud";var r="<div class='ug-videoplayer' style='display:none'>";r+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+n.youtubeInnerID+"'><\/div><\/div>";r+="<div id='"+n.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'><\/div>";r+="<div id='"+n.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'><\/div>";r+="<div id='"+n.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'><\/div>";r+="<div id='"+n.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'><\/div>";n.standAloneMode==!1&&b.video_enable_closebutton==!0&&(r+="<div class='ug-videoplayer-button-close'><\/div>");r+="<\/div>";t.append(r);f=t.children(".ug-videoplayer");w=f.children(".ug-videoplayer-youtube");d=f.children(".ug-videoplayer-vimeo");g=f.children(".ug-videoplayer-html5");nt=f.children(".ug-videoplayer-soundcloud");tt=f.children(".ug-videoplayer-wistia");n.standAloneMode==!1&&b.video_enable_closebutton==!0&&(i=f.children(".ug-videoplayer-button-close"))};this.destroy=function(){i&&(i.off("click"),i.off("touchend"));jQuery(t).off(t.events.START_PLAYING);jQuery(t).off(t.events.STOP_PLAYING);jQuery(r).off(r.events.START_PLAYING);jQuery(r).off(r.events.STOP_PLAYING);jQuery(e).off(e.events.START_PLAYING);jQuery(e).off(e.events.STOP_PLAYING);jQuery(u).off(u.events.START_PLAYING,l);jQuery(u).off(u.events.STOP_PLAYING,a);jQuery(o).off(o.events.START_PLAYING,l);jQuery(o).off(o.events.STOP_PLAYING,a);h=null};this.initEvents=function(){rt()};this.setSize=function(n,t){p.setElementSize(f,n,t);i&&p.placeElement(i,"right","top")};this.setPosition=function(n,t){p.placeElement(f,n,t)};this.getObject=function(){return f};this.show=function(){if(s.isVisible()==!0)return!0;f.show();f.fadeTo(0,1);i&&i.show();y.trigger(s.events.SHOW)};this.hide=function(){if(s.isVisible()==!1)return!0;v();h=null;f.hide();y.trigger(s.events.HIDE)};this.getActiveAPI=function(){switch(h){case"youtube":return t;case"vimeo":return r;case"wistia":return o;case"soundcloud":return u;case"html5":return e;default:return null}};this.pause=function(){var n=s.getActiveAPI();if(n==null)return!1;typeof n.pause=="function"&&n.pause()};this.isVisible=function(){return f.is(":visible")};this.playYoutube=function(i,r){var r,u;typeof r=="undefined"&&(r=!0);v("youtube");w.show();u=w.children("#"+n.youtubeInnerID);u.length==0&&w.append("<div id='"+n.youtubeInnerID+"'><\/div>");t.isPlayerReady()==!0&&n.standAloneMode==!0?t.changeVideo(i,r):t.putVideo(n.youtubeInnerID,i,"100%","100%",r);h="youtube"};this.playVimeo=function(t,i){if(typeof i=="undefined")var i=!0;v("vimeo");d.show();r.putVideo(n.vimeoPlayerID,t,"100%","100%",i);h="vimeo"};this.playHtml5Video=function(t,i,r,u,f){var f,o;typeof f=="undefined"&&(f=!0);v("html5");g.show();o={ogv:t,webm:i,mp4:r,posterImage:u};e.putVideo(n.html5PlayerID,o,"100%","100%",f);h="html5"};this.playSoundCloud=function(t,i){if(typeof i=="undefined")var i=!0;v("soundcloud");nt.show();u.putSound(n.soundCloudPlayerID,t,"100%","100%",i);h="soundcloud"};this.playWistia=function(t,i){if(typeof i=="undefined")var i=!0;v("wistia");tt.show();o.putVideo(n.wistiaPlayerID,t,"100%","100%",i);h="wistia"}}function ugCheckForMinJQueryVersion(){var n=g_ugFunctions.checkMinJqueryVersion("1.8.0");if(n==!1)throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.");}function ugCheckForErrors(n,t){function u(){if(typeof jQuery=="undefined")throw new Error("jQuery library not included");}function f(){if(typeof jQuery.fn.unitegallery=="function")return!0;var n="You have some jquery.js library include that comes after the gallery files js include.";n+="<br> This include eliminates the gallery libraries, and make it not work.";t=="cms"?(n+="<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Gallery Settings -> Troubleshooting set option:  <strong><b>Put JS Includes To Body<\/b><\/strong> option to true.",n+="<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it."):n+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.";throw new Error(n);}var i,r;try{t=="jquery"?(u(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),f())}catch(e){return i=e.message,i="Unite Gallery Error: "+i,i="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+i+"<\/div>",t=="jquery"?(r=document.getElementById(n),r.innerHTML=i,r.style.display="block"):jQuery(n).show().html(i),!1}return!0}function UniteGalleryMain(){function yt(n){var t=n;return t.indexOf("UGTheme_")==-1&&(t="UGTheme_"+t),t}function pt(objCustomOptions){var defaultTheme,themeFunction;objCustomOptions.hasOwnProperty("gallery_theme")?i.gallery_theme=objCustomOptions.gallery_theme:(defaultTheme=i.gallery_theme,g_ugFunctions.isThemeRegistered(defaultTheme)==!1&&(i.gallery_theme=g_ugFunctions.getFirstRegisteredTheme()));themeFunction=yt(i.gallery_theme);try{i.gallery_theme=eval(themeFunction)}catch(e){}i.gallery_theme=eval(themeFunction);a=new i.gallery_theme;a.init(t,objCustomOptions)}function wt(){i=jQuery.extend({},n.originalOptions);l=-1;v=null;u=undefined;s=undefined;u=undefined}function bt(){try{ugCheckForMinJQueryVersion()}catch(n){rt(n.message)}typeof r.outerWidth()=="object"&&rt("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version.");setTimeout(function(){ugCheckForErrors(c,"cms")},5e3)}function d(u,f,e,s){var l=typeof f=="object",h,a;if(l&&(n.objCustomOptions=f),n.isRunFirstTime==!0){if(c=u,r=jQuery(c),r.length==0)return trace("div with id: "+c+" not found"),!1;vt=r.parent();bt();n.originalOptions=jQuery.extend({},i);l&&(i=jQuery.extend(i,f));i.gallery_enable_cache==!0&&i.gallery_initial_catid&&ct(i.gallery_initial_catid);t.setSizeClass();h=r.children();g(h);nt();r.find("img").fadeTo(0,0).hide();r.show();ut()}else if(t.destroy(),wt(),i=jQuery.extend(i,n.objCustomOptions),e){if(s&&i.gallery_enable_cache==!0&&ct(s,e),e=="noitems")return p("No items in this category",""),!1;r.html(e);h=r.children();g(h);nt();r.children().fadeTo(0,0).hide();r.show();ut()}n.isRunFirstTime==!0&&i.gallery_enable_tabs==!0&&(w=new UGTabs,w.init(t,i));n.isRunFirstTime==!0&&i.gallery_enable_loadmore==!0&&(tt=new UGLoadMore,tt.init(t,i));l&&kt(n.objCustomOptions);dt();i.gallery_shuffle==!0&&t.shuffleItems();pt(n.objCustomOptions);gt();ni();a=r.width();a==0?o.waitForWidth(r,it):it()}function it(){t.setSizeClass();n.isFreestyleMode==!1&&i.gallery_preserve_ratio==!0&&et();a.run();w&&n.isRunFirstTime&&w.run();ot();hi();h>0&&t.selectItem(0);i.gallery_autoplay==!0&&t.startPlayMode();n.isRunFirstTime=!1}function p(n,t){var t,i;t=typeof t=="undefined"?"<b>Unite Gallery Error: <\/b>":"<b>"+t+": <\/b>";n=t+n;i="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+n+"<\/div><\/div>";r.children().remove();r.html(i);r.show()}function rt(n){p(n);throw new Error(n);}function kt(){i.gallery_images_preload_type||(i.gallery_images_preload_type="minimal");(i.gallery_min_height==undefined||i.gallery_height<i.gallery_min_height)&&(i.gallery_min_height=0);(i.gallery_min_width==undefined||i.gallery_width<i.gallery_min_width)&&(i.gallery_min_width=0)}function dt(){if(!i.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(i.gallery_height)&&i.gallery_height<i.gallery_min_height)throw new Error("The <b>gallery_height<\/b> option must be bigger then <b>gallery_min_height option<\/b>");if(i.gallery_width<i.gallery_min_width)throw new Error("The <b>gallery_width<\/b> option must be bigger then <b>gallery_min_width option<\/b>");}function gt(){r.addClass("ug-gallery-wrapper");r.append("<div class='ug-overlay-disabled' style='display:none'><\/div>");t.setSizeClass()}function ut(){var n=r.children().remove()}function ft(){var i=t.getSize();n.lastWidth=i.width;n.lastHeight=i.height}function et(){var u=t.getSize(),f=u.width/u.height,n;f!=u.orig_ratio&&(n=u.width/u.orig_ratio,n=Math.round(n),n<i.gallery_min_height&&(n=i.gallery_min_height),r.height(n))}function ni(){var f=o.getCssSizeParam(i.gallery_width),t={"max-width":f,"min-width":o.getCssSizeParam(i.gallery_min_width)},u;n.isFreestyleMode==!1?(u=o.getCssSizeParam(i.gallery_height),t.height=u):t.overflow="visible";i.gallery_background_color&&(t["background-color"]=i.gallery_background_color);r.css(t)}function ti(i){var g=t.isMobileMode(),h=i.prop("tagName").toLowerCase(),d="",c,r,l,u,f,y,a,v,o,s,p,w,b,e,k;if(h=="a"&&(d=i.attr("href"),i=i.children(),h=i.prop("tagName").toLowerCase()),c=i.data("type"),c==undefined&&(c="image"),r={},r.type=c,h=="img")l=i.data("lazyload-src"),l&&l!=""&&(i.attr("src",l),jQuery.removeData(i,"lazyload-src")),u=i.data("image"),f=i.data("thumb"),typeof u=="undefined"&&(u=null),typeof f=="undefined"&&(f=null),y=i.attr("src"),u||(u=y),f||(f=y),f||(f=u),u||(u=f),r.urlThumb=f,r.urlImage=u,r.title=i.attr("title"),r.objThumbImage=i,r.objThumbImage.attr("src",r.urlThumb);else{if(c=="image"){trace("Problematic gallery item found:");trace(i);trace("Please look for some third party js script that could add this item to the gallery");throw new Error("The item should not be image type");}r.urlThumb=i.data("thumb");r.title=i.data("title");r.objThumbImage=null;r.urlImage=i.data("image")}g==!0&&(a=i.data("thumb-mobile"),typeof a!="undefined"&&a!=""&&(r.urlThumb=a,h=="img"&&i.attr("src",r.urlThumb)),v=i.data("image-mobile"),typeof v!="undefined"&&v!=""&&(r.urlImage=v));r.link=d;r.description=i.attr("title");r.description||(r.description=i.data("description"));r.description||(r.description="");r.isNewAdded=!1;r.isLoaded=!1;r.isThumbImageLoaded=!1;r.objPreloadImage=null;r.isBigImageLoadStarted=!1;r.isBigImageLoaded=!1;r.isBigImageLoadError=!1;r.imageWidth=0;r.imageHeight=0;r.thumbWidth=0;r.thumbHeight=0;r.thumbRatioByWidth=0;r.thumbRatioByHeight=0;o=i.data("width");s=i.data("height");o&&typeof o=="number"&&s&&typeof s=="number"&&(r.thumbWidth=o,r.thumbHeight=s,r.thumbRatioByWidth=o/s,r.thumbRatioByHeight=s/o);r.addHtml=null;p=r.urlImage==undefined||r.urlImage=="";w=r.urlThumb==undefined||r.urlThumb=="";switch(r.type){case"youtube":r.videoid=i.data("videoid");(p||w)&&(b=g_ugYoutubeAPI.getVideoImages(r.videoid),p&&(r.urlImage=b.preview),w&&(r.urlThumb=b.thumb,h=="img"&&i.attr("src",r.urlThumb)));n.isYoutubePresent=!0;break;case"vimeo":r.videoid=i.data("videoid");n.isVimeoPresent=!0;break;case"html5video":r.videoogv=i.data("videoogv");r.videowebm=i.data("videowebm");r.videomp4=i.data("videomp4");n.isHtml5VideoPresent=!0;break;case"soundcloud":r.trackid=i.data("trackid");n.isSoundCloudPresent=!0;break;case"wistia":r.videoid=i.data("videoid");n.isWistiaPresent=!0;break;case"custom":e=i.children("img");e.length&&(e=jQuery(e[0]),r.urlThumb=e.attr("src"),r.title=e.attr("alt"),r.objThumbImage=e);k=i.children().not("img:first-child");k.length&&(r.addHtml=k.clone())}return r.objThumbImage&&(r.objThumbImage.removeAttr("data-description",""),r.objThumbImage.removeAttr("data-image",""),r.objThumbImage.removeAttr("data-thumb",""),r.objThumbImage.removeAttr("title","")),r}function g(n,t){var i,u,r;if(t!==!0)e=[];else for(i=0;i<h;i++)e[i].isNewAdded=!1;for(i=0;i<n.length;i++)u=jQuery(n[i]),r=ti(u),numIndex=e.length,r.index=numIndex,t===!0&&(r.isNewAdded=!0),e.push(r);h=e.length}function nt(){n.isYoutubePresent&&g_ugYoutubeAPI.loadAPI();n.isVimeoPresent&&g_ugVimeoAPI.loadAPI();n.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI();n.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI();n.isWistiaPresent&&g_ugWistiaAPI.loadAPI()}function ot(){if(i.gallery_images_preload_type!="visible"||s||(i.gallery_images_preload_type="minimal"),n.isAllItemsPreloaded==!0)return!0;switch(i.gallery_images_preload_type){case"all":jQuery(e).each(function(){y(this)});break;case"visible":jQuery(e).each(function(){var n=this,t=s.isItemThumbVisible(n);t==!0&&y(n)})}}function ii(n){if(n.isBigImageLoadStarted==!0||n.isBigImageLoaded==!0||n.isBigImageLoadError==!0)return!1;switch(i.gallery_images_preload_type){case"all":y(n);break;case"visible":var t=s.isItemThumbVisible(n);t==!0&&y(n)}}function y(n){if(n.isBigImageLoadStarted==!0||n.isBigImageLoaded==!0||n.isBigImageLoadError==!0)return!0;var i=n.urlImage;if(i==""||i==undefined)return n.isBigImageLoadError=!0,!1;n.isBigImageLoadStarted=!0;n.objPreloadImage=jQuery("<img/>").attr("src",i);n.objPreloadImage.data("itemIndex",n.index);n.objPreloadImage.on("load",t.onItemBigImageLoaded);n.objPreloadImage.on("error",function(){var u=jQuery(this),i=u.data("itemIndex"),n=e[i],r;n.isBigImageLoadError=!0;n.isBigImageLoaded=!1;r=jQuery(this).attr("src");console.log("Can't load image: "+r);f.trigger(t.events.ITEM_IMAGE_UPDATED,[i,n.urlImage]);n.objThumbImage.attr("src",n.urlThumb)});ri()}function ri(){if(n.isAllItemsPreloaded==!0)return!1;for(var t in e)if(e[t].isBigImageLoadStarted==!1)return!1;n.isAllItemsPreloaded=!0}function ui(){i.gallery_pause_on_mouseover==!0&&t.isFullScreen()==!1&&n.isPlayMode==!0&&u&&u.isSlideActionActive()==!1&&t.pausePlaying()}function st(){if(i.gallery_pause_on_mouseover==!0&&n.isPlayMode==!0&&u&&u.isSlideActionActive()==!1){var r=u.isCurrentSlideLoadingImage();r==!1&&t.continuePlaying()}}function fi(n){var i=jQuery(n.target),r,u;if(i.is("textarea")||i.is("select")||i.is("input"))return!0;r=n.charCode?n.charCode:n.keyCode?n.keyCode:n.which?n.which:0;u=!0;switch(r){case 39:t.nextItem();break;case 37:t.prevItem();break;default:u=!1}u==!0&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation());f.trigger(t.events.GALLERY_KEYPRESS,[r,n])}function b(){var u=t.getSize(),e,o;if(u.width==0)return!0;t.setSizeClass();u=t.getSize();(u.width!=n.lastWidth||n.isFreestyleMode==!1&&u.height!=n.lastHeight)&&(e=!1,n.funcCustomHeight&&(o=n.funcCustomHeight(u),o&&(r.height(o),e=!0)),e==!1&&i.gallery_preserve_ratio==!0&&n.isFreestyleMode==!1&&et(),ft(),f.trigger(t.events.SIZE_CHANGE))}function ht(){i.gallery_images_preload_type=="visible"&&n.isAllItemsPreloaded==!1&&ot()}function ei(){var n=o.isFullScreen(),i=n?t.events.ENTER_FULLSCREEN:t.events.EXIT_FULLSCREEN,u=o.getGlobalData("fullscreenID");if(c!==u)return!0;n?r.addClass("ug-fullscreen"):r.removeClass("ug-fullscreen");f.trigger(i);b()}function oi(n,i){var r=t.getItem(i);ii(r)}function si(){t.isPlayMode()==!0&&t.continuePlaying()}function hi(){r.on("dragstart",function(n){n.preventDefault()});f.on(t.events.ITEM_IMAGE_UPDATED,oi);if(s)switch(n.thumbsType){case"strip":jQuery(s).on(s.events.STRIP_MOVE,ht);break;case"grid":jQuery(s).on(s.events.PANE_CHANGE,ht)}if(i.gallery_mousewheel_role=="advance"&&n.isFreestyleMode==!1)r.on("mousewheel",t.onGalleryMouseWheel);if(ft(),jQuery(window).resize(function(){r.css("width","auto");o.whenContiniousEventOver("gallery_resize",b,n.resizeDelay)}),setTimeout(function(){setInterval(b,2e3)},1e4),o.addFullScreenChangeEvent(ei),u){jQuery(u).on(u.events.ITEM_CHANGED,function(){var n=u.getCurrentItemIndex();n!=-1&&t.selectItem(n)});if(i.gallery_pause_on_mouseover==!0){var e=u.getElement();e.hover(ui,st);f.on(t.events.ENTER_FULLSCREEN,function(){st()})}lt(u,u.events.ACTION_START,t.events.SLIDER_ACTION_START);lt(u,u.events.ACTION_END,t.events.SLIDER_ACTION_END);jQuery(u).on(u.events.CURRENTSLIDE_LOAD_END,si)}i.gallery_control_keyboard==!0&&jQuery(document).keydown(fi)}function ct(n,t){var i;t?(i=t,i!="noitems"&&(i=jQuery(t).clone())):i=r.children().clone();k[n]=i}function ci(n){n||(n=r);n.removeClass("ug-under-480");n.removeClass("ug-under-780");n.removeClass("ug-under-960")}function lt(n,t,i){jQuery(n).on(t,function(){f.trigger(i,[this])})}function at(){var r=jQuery.now(),e=r-n.playTimeLastStep,u,f;if(n.playTimeLastStep=r,u=t.isGalleryVisible(),u==!1)return!1;n.playTimePassed+=e;n.objProgress&&(f=n.playTimePassed/i.gallery_play_interval,n.objProgress.setProgress(f));n.playTimePassed>=i.gallery_play_interval&&(t.nextItem(),n.playTimePassed=0)}function li(){if(v==null)return!0;s&&s.setThumbUnselected(v.objThumbWrapper);v=null;l=-1}function ai(){jQuery("body").addClass("ug-body-fullscreen");r.addClass("ug-fake-fullscreen");n.isFakeFullscreen=!0;f.trigger(t.events.ENTER_FULLSCREEN);f.trigger(t.events.SIZE_CHANGE)}function vi(){jQuery("body").removeClass("ug-body-fullscreen");r.removeClass("ug-fake-fullscreen");n.isFakeFullscreen=!1;f.trigger(t.events.EXIT_FULLSCREEN);f.trigger(t.events.SIZE_CHANGE)}var t=this,c,f=jQuery(t),r,vt,s,u,o=new UGFunctions,w,tt,e=[],h,v=null,l=-1,a,k={},i,n;this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"};i={gallery_width:900,gallery_height:500,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!1,gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:""};n={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};this.onItemBigImageLoaded=function(n,t){var t,u,i,r;t||(t=jQuery(this));u=t.data("itemIndex");i=e[u];i.isBigImageLoaded=!0;r=o.getImageOriginalSize(t);i.imageWidth=r.width;i.imageHeight=r.height};this.checkFillImageSize=function(n,t){var i,t,r;if(!t){if(i=n.data("itemIndex"),i===undefined)throw new Error("Wrong image given to gallery.checkFillImageSize");t=e[i]}r=o.getImageOriginalSize(n);t.imageWidth=r.width;t.imageHeight=r.height};this.setFreestyleMode=function(){n.isFreestyleMode=!0};this.attachThumbsPanel=function(t,i){n.thumbsType=t;s=i};this.initSlider=function(i,r){if(!i)var i={};i=jQuery.extend(n.objCustomOptions,i);u=new UGSlider;u.init(t,i,r)};this.onGalleryMouseWheel=function(n,i){n.preventDefault();i>0?t.prevItem():t.nextItem()};this.destroy=function(){if(r.off("dragstart"),f.off(t.events.ITEM_IMAGE_UPDATED),s)switch(n.thumbsType){case"strip":jQuery(s).off(s.events.STRIP_MOVE);break;case"grid":jQuery(s).off(s.events.PANE_CHANGE)}if(r.off("mousewheel"),jQuery(window).off("resize"),o.destroyFullScreenChangeEvent(),u){jQuery(u).off(u.events.ITEM_CHANGED);var e=u.getElement();e.off("mouseenter");e.off("mouseleave");f.off(t.events.ENTER_FULLSCREEN);jQuery(u).off(u.events.ACTION_START);jQuery(u).off(u.events.ACTION_END);jQuery(u).off(u.events.CURRENTSLIDE_LOAD_END)}i.gallery_control_keyboard==!0&&jQuery(document).off("keydown");a&&typeof a.destroy=="function"&&a.destroy();r.html("")};this.getArrItems=function(){return e};this.getObjects=function(){return{g_galleryID:c,g_objWrapper:r,g_objThumbs:s,g_objSlider:u,g_options:i,g_arrItems:e,g_numItems:h}};this.getObjSlider=function(){return u};this.getItem=function(n){if(n<0)throw new Error("item with index: "+n+" not found");if(n>=h)throw new Error("item with index: "+n+" not found");return e[n]};this.getWidth=function(){var n=t.getSize();return n.width};this.getHeight=function(){var n=t.getSize();return n.height};this.getSize=function(){var n=o.getElementSize(r);return n.orig_width=i.gallery_width,n.orig_height=i.gallery_height,n.orig_ratio=n.orig_width/n.orig_height,n};this.getGalleryID=function(){return c.replace("#","")};this.getNextItem=function(n,t){var r;if(typeof n=="object"&&(n=n.index),r=n+1,t!==!0&&h==1)return null;if(r>=h)if(i.gallery_carousel==!0||t===!0)r=0;else return null;return e[r]};this.getPrevItem=function(n){var t;if(typeof n=="object"&&(n=n.index),t=n-1,t<0)if(i.gallery_carousel==!0||forceCarousel===!0)t=h-1;else return null;return e[t]};this.getSelectedItem=function(){return v};this.getSelectedItemIndex=function(){return l};this.getNumItems=function(){return h};this.isLastItem=function(){return l==h-1?!0:!1};this.isFirstItem=function(){return l==0?!0:!1};this.getOptions=function(){return i};this.getElement=function(){return r};this.___________SET_CONTROLS___________=function(){};this.setNextButton=function(n){n.data("ug-button",!0);o.setButtonOnClick(n,t.nextItem)};this.setPrevButton=function(n){n.data("ug-button",!0);o.setButtonOnClick(n,t.prevItem)};this.setFullScreenToggleButton=function(n){n.data("ug-button",!0);o.setButtonOnTap(n,t.toggleFullscreen);f.on(t.events.ENTER_FULLSCREEN,function(){n.addClass("ug-fullscreenmode")});f.on(t.events.EXIT_FULLSCREEN,function(){n.removeClass("ug-fullscreenmode")})};this.destroyFullscreenButton=function(n){o.destroyButton(n);f.off(t.events.ENTER_FULLSCREEN);f.off(t.events.EXIT_FULLSCREEN)};this.setPlayButton=function(n){n.data("ug-button",!0);o.setButtonOnClick(n,t.togglePlayMode);f.on(t.events.START_PLAY,function(){n.addClass("ug-stop-mode")});f.on(t.events.STOP_PLAY,function(){n.removeClass("ug-stop-mode")})};this.destroyPlayButton=function(n){o.destroyButton(n);f.off(t.events.START_PLAY);f.off(t.events.STOP_PLAY)};this.setProgressIndicator=function(t){n.objProgress=t};this.setTextContainers=function(n,i){f.on(t.events.ITEM_CHANGE,function(){var r=t.getSelectedItem();n.html(r.title);i.html(r.description)})};this.showDisabledOverlay=function(){r.children(".ug-overlay-disabled").show()};this.hideDisabledOverlay=function(){r.children(".ug-overlay-disabled").hide()};this.___________END_SET_CONTROLS___________=function(){};this.___________PLAY_MODE___________=function(){};this.startPlayMode=function(){if(n.isPlayMode=!0,n.isPlayModePaused=!1,n.playTimePassed=0,n.playTimeLastStep=jQuery.now(),n.playHandle=setInterval(at,n.playStepInterval),n.objProgress){var i=n.objProgress.getElement();n.objProgress.setProgress(0);i.show()}f.trigger(t.events.START_PLAY);u&&u.isCurrentSlideLoadingImage()==!0&&t.pausePlaying()};this.resetPlaying=function(){if(n.isPlayMode==!1)return!0;n.playTimePassed=0;n.playTimeLastStep=jQuery.now()};this.pausePlaying=function(){if(n.isPlayModePaused==!0)return!0;n.isPlayModePaused=!0;clearInterval(n.playHandle);f.trigger(t.events.PAUSE_PLAYING)};this.continuePlaying=function(){if(n.isPlayModePaused==!1)return!0;n.isPlayModePaused=!1;n.playTimeLastStep=jQuery.now();n.playHandle=setInterval(at,n.playStepInterval)};this.stopPlayMode=function(){if(n.isPlayMode=!1,clearInterval(n.playHandle),n.playTimePassed=0,n.objProgress){var i=n.objProgress.getElement();i.hide()}f.trigger(t.events.STOP_PLAY)};this.isPlayMode=function(){return n.isPlayMode};this.togglePlayMode=function(){t.isPlayMode()==!1?t.startPlayMode():t.stopPlayMode()};this.___________GENERAL_EXTERNAL___________=function(){};this.shuffleItems=function(){e=o.arrayShuffle(e);for(var n in e)e[n].index=parseInt(n)};this.setOptions=function(n){i=jQuery.extend(i,n)};this.selectItem=function(i,r){var e,o;if(typeof i=="number"&&(i=t.getItem(i)),e=i.index,e==l)return!0;li();v=i;l=e;f.trigger(t.events.ITEM_CHANGE,[i,r]);n.isPlayMode==!0&&(t.resetPlaying(),o=u.isCurrentSlideLoadingImage(),o==!0&&t.pausePlaying())};this.nextItem=function(){var n=l+1;if(h==0||i.gallery_carousel==!1&&n>=h)return!0;n>=h&&(n=0);t.selectItem(n,"next")};this.prevItem=function(){var n=l-1;if((l==-1&&(n=0),h==0)||i.gallery_carousel==!1&&n<0)return!0;n<0&&(n=h-1);t.selectItem(n,"prev")};this.isFullScreen=function(){return n.isFakeFullscreen==!0?!0:o.isFullScreen()==!0?!0:!1};this.isFakeFullscreen=function(){return n.isFakeFullscreen};this.toFullScreen=function(){o.setGlobalData("fullscreenID",c);var n=r.get(0),t=o.toFullscreen(n);t==!1&&ai()};this.exitFullScreen=function(){n.isFakeFullscreen==!0?vi():o.exitFullscreen()};this.toggleFullscreen=function(){t.isFullScreen()==!1?t.toFullScreen():t.exitFullScreen()};this.resize=function(n,t,i){r.css("width","auto");r.css("max-width",n+"px");t&&r.height(t);i||i===!0||b()};this.setSizeClass=function(n,i){var n,f,i,u;if(n||(n=r),i||(f=t.getSize(),i=f.width),i==0&&(i=jQuery(window).width()),u="",i<=480?u="ug-under-480":i<=780?u="ug-under-780":i<960&&(u="ug-under-960"),n.hasClass(u)==!0)return!0;ci(n);u!=""&&n.addClass(u)};this.isMobileMode=function(){return r.hasClass("ug-under-480")?!0:!1};this.isSmallWindow=function(){var n=jQuery(window).width();return n?n<=480?!0:!1:!0};this.isGalleryVisible=function(){return r.is(":visible")};this.changeItems=function(n,t){if(!n)var n="noitems";d(c,"nochange",n,t)};this.addItems=function(n){var t,i;if(!n||n.length==0)return!1;if(t=r.children(".ug-newitems-wrapper"),t.length==0&&r.append("<div class='ug-newitems-wrapper' style='display:none'><\/div>"),t=r.children(".ug-newitems-wrapper"),t.append(n),i=jQuery(t.children()),g(i,!0),nt(),!a||typeof a.addItems!="function")throw new Error("addItems function not found in the theme");t.remove();a.addItems()};this.getNewAddedItemsIndexes=function(){var n=[];return jQuery.each(e,function(t,i){i.isNewAdded==!0&&n.push(t)}),n};this.showErrorMessageReplaceGallery=function(n){p(n)};this.setFuncCustomHeight=function(t){n.funcCustomHeight=t};this.__________EXTERNAL_EVENTS_______=function(){};this.triggerEvent=function(n,t){t?(jQuery.type(t)!="array"&&(t=[t]),f.trigger(n,t)):f.trigger(n)};this.onEvent=function(n,t){f.on(n,t)};this.destroyEvent=function(n){f.off(n)};this.__________AJAX_REQUEST_______=function(){};this.ajaxRequest=function(n,t,r,u){var f,t,e;if(!r||typeof r!="function")throw new Error("ajaxRequest error: success function should be passed");if(f=i.gallery_urlajax,!f||f=="")throw new Error("ajaxRequest error: Ajax url don't passed");typeof t=="undefined"&&(t={});e={action:"unitegallery_ajax_action",client_action:n,galleryID:c,data:t};jQuery.ajax({type:"post",url:i.gallery_urlajax,dataType:"json",data:e,success:function(n){if(!n)throw new Error("Empty ajax response!");if(n==-1||n===0)throw new Error("ajax error!!!");if(typeof n.success=="undefined")throw new Error("ajax error!!!");if(n.success==!1)return p(n.message,"ajax error"),!1;r(n)},error:function(n,t){console.log("Ajax Error!!! "+t);responseText=n.responseText;u&&typeof u=="function"?u(responseText):trace(responseText)}})};this.requestNewItems=function(n,r,u){var e=i.gallery_enable_cache,o;u||(u=n);r==!0&&(e=!1);e==!0&&k.hasOwnProperty(u)?(o=k[u],t.changeItems(o,u)):(f.trigger(t.events.GALLERY_BEFORE_REQUEST_ITEMS),t.ajaxRequest("front_get_cat_items",{catid:n},function(n){var i=n.html;t.changeItems(i,u)}))};this.run=function(n,t){var o=i.gallery_debug_errors,u;if(t&&t.hasOwnProperty("gallery_debug_errors")&&(i.gallery_debug_errors=t.gallery_debug_errors),i.gallery_debug_errors==!0)try{d(n,t)}catch(r){if(typeof r=="object"){var u=r.message,f=r.lineNumber,e=r.fileName,s=r.stack;u+=" <br><br> in file: "+e;u+=" <b> line "+f+"<\/b>";trace(r)}else u=r;u=u.replace("Error:","");p(u)}else d(n,t)}}function UGLightbox(){function ni(r,f){l=r;v=jQuery(r);i=jQuery.extend(i,dt);i=jQuery.extend(i,f);n.originalOptions=jQuery.extend({},i);i.lightbox_type=="compact"&&(n.isCompact=!0,i=jQuery.extend(i,gt),i=jQuery.extend(i,f));ot();n.putSlider==!0?(l.initSlider(i,"lightbox"),g_objects=r.getObjects(),t=g_objects.g_objSlider):t=null;i.lightbox_show_textpanel==!0?u.init(l,i,"lightbox"):u=null}function ot(){n.isCompact==!0&&i.lightbox_show_textpanel==!0&&(i.lightbox_slider_image_padding_bottom=n.initTextPanelHeight);n.isCompact==!0&&i.lightbox_arrows_position=="inside"&&(n.isArrowsInside=!0);n.isArrowsInside==!0&&i.lightbox_arrows_inside_alwayson==!1&&(n.isArrowsOnHoverMode=!0);i.lightbox_show_textpanel==!1&&(n.isTopPanelEnabled=!1,n.topPanelHeight=0,i.lightbox_slider_image_padding_top=0)}function ti(){var f="",l="";n.isCompact==!0&&(l=" ug-lightbox-compact");f+="<div class='ug-gallery-wrapper ug-lightbox"+l+"'>";f+="<div class='ug-lightbox-overlay'><\/div>";n.isCompact==!1&&n.isTopPanelEnabled?(f+="<div class='ug-lightbox-top-panel'>",f+="<div class='ug-lightbox-top-panel-overlay'><\/div>",i.lightbox_show_numbers&&(f+="<div class='ug-lightbox-numbers'><\/div>"),f+="<\/div>"):i.lightbox_show_numbers&&(f+="<div class='ug-lightbox-numbers'><\/div>");f+="<div class='ug-lightbox-button-close'><\/div>";f+="<div class='ug-lightbox-arrow-left'><\/div>";f+="<div class='ug-lightbox-arrow-right'><\/div>";f+="<\/div>";o=jQuery(f);jQuery("body").append(o);t&&t.setHtml(o);a=o.children(".ug-lightbox-overlay");n.isCompact==!1&&n.isTopPanelEnabled==!0&&(e=o.children(".ug-lightbox-top-panel"),e.length==0&&(e=null));c=o.find(".ug-lightbox-button-close");i.lightbox_show_numbers&&(s=o.find(".ug-lightbox-numbers"));r=o.children(".ug-lightbox-arrow-left");h=o.children(".ug-lightbox-arrow-right");u&&(e?u.appendHTML(e):u.appendHTML(o))}function ii(){if(i.lightbox_overlay_color!==null&&a.css("background-color",i.lightbox_overlay_color),i.lightbox_overlay_opacity!==null&&a.fadeTo(0,i.lightbox_overlay_opacity),e&&i.lightbox_top_panel_opacity!==null&&e.children(".ug-lightbox-top-panel-overlay").fadeTo(0,i.lightbox_top_panel_opacity),s){var n={};i.lightbox_numbers_size!==null&&(n["font-size"]=i.lightbox_numbers_size+"px");i.lightbox_numbers_color&&(n.color=i.lightbox_numbers_color);i.lightbox_numbers_padding_right!==null&&(n["padding-right"]=i.lightbox_numbers_padding_right+"px");i.lightbox_numbers_padding_top!==null&&(n["padding-top"]=i.lightbox_numbers_padding_top+"px");s.css(n)}}function st(n){if(!t)return!0;var i={slider_image_padding_top:n};t.setOptions(i);t.refreshSlideItems()}function g(){var r;if(!e||!u||(r=e.height(),r==0)||e.is(":visible")==!1)return!1;var i=r,o=u.getSize(),f=o.height;r!=n.topPanelHeight&&(i=n.topPanelHeight);f>i&&(i=f);r!=i&&(e.height(i),t&&t.isAnimating()==!1&&st(i))}function ri(n){var t={},r=i.lightbox_textpanel_width,f=47,e=40,o=n.width-f-e;r>o?(t.textpanel_padding_left=f,t.textpanel_padding_right=e,t.textpanel_title_text_align="center",t.textpanel_desc_text_align="center"):(t.textpanel_padding_left=Math.floor((n.width-r)/2),t.textpanel_padding_right=t.textpanel_padding_left,t.textpanel_title_text_align="left",t.textpanel_desc_text_align="left",i.lightbox_textpanel_title_text_align&&(t.textpanel_title_text_align=i.lightbox_textpanel_desc_text_align),i.lightbox_textpanel_desc_text_align&&(t.textpanel_desc_text_align=i.lightbox_textpanel_desc_text_align));u.setOptions(t);u.refresh(!0,!0);g("positionTextPanelWide");u.positionPanel()}function ui(){if(!e)return!1;e.hide()}function fi(){if(!e)return!1;e.show()}function nt(i){var s,r,h,i,c,l,e,a;return n.isOpened==!1?!1:u?t?(s=f.getElementSize(o),r=u.getSize(),r.width==0||r.height>120)?!1:(i||(h=t.getSlideImage(),i=f.getElementSize(h)),i.height==0||i.width==0)?!1:(c=i.bottom+r.height,c<s.height)?!1:(l=t.getOptions(),e=r.height,e!=l.slider_image_padding_bottom&&(a={slider_image_padding_bottom:e},t.isAnimating()==!1))?(t.setOptions(a),t.refreshSlideItems(),!0):!1:!1:!1}function ei(i,r){if(!i)var e=t.getSlideImage(),i=f.getElementSize(e);n.textPanelTop=i.bottom;r===!0&&u.positionPanel(n.textPanelTop,n.textPanelLeft)}function tt(i){var v=f.getElementSize(o),a=t.getSlideImage(),r=f.getElementSize(a),e,h,c,l;if(r.width==0)return!1;n.textPanelLeft=r.left;n.textPanelTop=r.bottom;e=r.width;s&&(h=f.getElementSize(s),e-=h.width,c=r.right-h.width,f.placeElement(s,c,n.textPanelTop));u&&(u.show(),u.refresh(!0,!0,e),ei(r));l=nt(r);l==!1&&(n.positionFrom="handleCompactTextpanelSizes",u&&(u.positionPanel(n.textPanelTop,n.textPanelLeft),i===!0&&(i(),p())))}function w(){if(t.isCurrentSlideType("image")==!1)return!0;return t.isCurrentImageInPlace()==!0}function b(u,e){var c,p,b;if(n.isArrowsInside==!1||!r)return!1;if(c=w(),r.show(),h.show(),n.positionFrom="positionArrowsInside",n.isArrowsOnHoverMode==!0&&c==!0&&it()==!1&&rt(!0),c==!1)var a=f.getElementRelativePos(r,"left",i.lightbox_arrows_offset),o=f.getElementRelativePos(r,"middle"),v=f.getElementRelativePos(h,"right",i.lightbox_arrows_offset),y=o;else var s=t.getSlideImage(),l=f.getElementSize(s),k=f.getElementSize(t.getElement()),a=f.getElementRelativePos(r,"left",0,s)+l.left+i.lightbox_arrows_inside_offset,o=f.getElementRelativePos(r,"middle",0,s)+l.top,v=f.getElementRelativePos(r,"right",0,s)+l.left-i.lightbox_arrows_inside_offset,y=o;e===!0?(p={left:a,top:o},b={left:v,top:y},r.stop().animate(p,{duration:n.fadeDuration}),h.stop().animate(b,{duration:n.fadeDuration})):(r.stop(),h.stop(),f.placeElement(r,a,o),f.placeElement(h,v,y));u==!0&&ut(e)}function k(r,u){var s,e,p;n.positionFrom=null;var b=w(),l=2,a=f.getElementRelativePos(c,"right",2,o);if(b==!1)e=l,s=a;else{var k=t.getSlideImage(),v=f.getElementSize(k),h=f.getElementSize(t.getElement()),y=f.getElementSize(c);h.top==h.height&&(h.top=0);s=h.left+v.right-y.width/2+i.lightbox_compact_closebutton_offsetx;e=h.top+v.top-y.height/2-i.lightbox_compact_closebutton_offsety;e<l&&(e=l);s>a&&(s=a)}u===!0?(p={left:s,top:e},c.stop().animate(p,{duration:n.fadeDuration})):(c.stop(),f.placeElement(c,s,e));r===!0&&hi(u)}function ht(){c&&c.stop().fadeTo(n.fadeDuration,0);lt();at();n.positionFrom="hideCompactElements";n.isArrowsInside==!0&&rt()}function oi(){c&&c.hide();r&&n.isArrowsInside==!0&&(r.hide(),h.hide());s&&s.hide();u&&u.hide()}function ct(){var s=f.getElementSize(o),l,a;e&&f.setElementSizeAndPosition(e,0,0,s.width,n.topPanelHeight);r&&n.isArrowsInside==!1&&(i.lightbox_hide_arrows_onvideoplay==!0&&(r.show(),h.show()),f.placeElement(r,"left","middle",i.lightbox_arrows_offset),f.placeElement(h,"right","middle",i.lightbox_arrows_offset));n.isCompact==!1&&f.placeElement(c,"right","top",2,2);u&&(n.positionFrom="positionElements",n.isCompact==!1?ri(s):(d(),p()));var v=s.width,y=s.height;t&&(e&&(l=e.height(),a={slider_image_padding_top:l},t.setOptions(a)),t.setSize(v,y),t.setPosition(0,0))}function lt(){u&&u.getElement().stop().fadeTo(n.fadeDuration,0)}function at(){s&&s.stop().fadeTo(n.fadeDuration,0)}function it(){if(!n.lastMouseX)return!0;var i={pageX:n.lastMouseX,pageY:n.lastMouseY};return t.isMouseInsideSlideImage(i)}function rt(t,i){if(!r)return!1;if(n.isArrowsOnHoverMode==!0&&i===!1)return it()==!0,!0;t===!0?(r.stop().fadeTo(0,0),h.stop().fadeTo(0,0)):(r.stop().fadeTo(n.fadeDuration,0),h.stop().fadeTo(n.fadeDuration,0))}function si(){if(!r||r.is(":visible")==!1)return!0;var n=r.css("opacity");return n!=1?!0:!1}function ut(i,u){if(!r)return!1;if(n.isArrowsOnHoverMode==!0&&u!==!0&&w()==!0||t.isSwiping()==!0)return!0;i!==!0&&(r.stop(),h.stop());r.fadeTo(n.fadeDuration,1);h.fadeTo(n.fadeDuration,1)}function hi(t){t!==!0&&c.stop();c.fadeTo(n.fadeDuration,1)}function ft(n){if(!u)return!1;if(!n)var n=t.getCurrentItem();u.setTextPlain(n.title,n.description)}function et(n){var n,i,r;if(!s)return!1;n||(n=t.getCurrentItem());i=l.getNumItems();r=n.index+1;s.html(r+" / "+i)}function d(){if(!u)return!1;u.getElement().show().stop().fadeTo(n.fadeDuration,1)}function p(){s&&s.stop().fadeTo(n.fadeDuration,1)}function vt(){if(n.isCompact==!1)return!0;ht()}function ci(){if(n.isCompact==!1)return!0;if(n.positionFrom="onZoomChange",k(!1,!0),b(!1,!0),n.isCompact==!0){var i=t.isCurrentSlideType("image")&&t.isCurrentImageInPlace()==!0;i==!1?(lt(),at()):(n.positionFrom="onZoomChange",d(),p())}}function yt(){if(n.isCompact==!1)return!0;n.positionFrom="onSliderAfterReturn";k(!0);b(!0);var t=nt();t==!1&&tt();d();p()}function li(i,r){if((r=jQuery(r),n.isCompact==!1)||t.isSlideCurrent(r)==!1)return!0;n.positionFrom="onSliderAfterPutImage";k(!0);b(!0);tt()}function ai(){var u=t.getOptions(),f=u.slider_image_padding_top,i,r;e&&(i=e.height(),i!=f&&st(i));n.isCompact==!0&&(ft(),et(),n.positionFrom="onSliderTransitionEnd",k(!0),b(!0),t.isSlideActionActive()==!1&&(r=nt(),r==!1&&tt()),d(),p())}function vi(i,r){n.isCompact==!1?(s&&et(r),u&&(ft(r),n.isRightNowOpened==!1&&(u.positionElements(!1),g("onchange"),u.positionPanel()))):t.isAnimating()==!1&&(u&&ft(r),s&&et(r));n.isSliderChangedOnce==!1&&(n.isSliderChangedOnce=!0,kt.trigger(y.events.LIGHTBOX_INIT))}function yi(r,u){var o=t.getSlideType(),f,e;if(o!="image"&&n.isCompact==!1&&t.isSlideActionActive())return!0;if(f=t.isPreloading(),f==!0)return y.close("slider"),!0;i.lightbox_close_on_emptyspace==!0&&(e=t.isMouseInsideSlideImage(u),e==!1&&y.close("slider_inside"))}function pi(){ct()}function wi(){e?ui():s&&s.hide();r&&i.lightbox_hide_arrows_onvideoplay==!0&&(r.hide(),h.hide())}function bi(){e?(fi(),g("onStopVideo")):s&&s.show();r&&i.lightbox_hide_arrows_onvideoplay==!0&&(r.show(),h.show())}function pt(t,i,r){var u=!1;switch(i){case 27:n.isOpened==!0&&y.close("keypress");break;case 38:case 40:case 33:case 34:u=!0}n.isOpened==!0&&u==!0&&r.preventDefault()}function wt(){n.isArrowsOnHoverMode==!0&&ut(!1,!0)}function bt(){n.positionFrom="hideCompactElements";n.isArrowsOnHoverMode==!0&&w()==!0&&rt(!1,!0)}function ki(i){n.lastMouseX=i.pageX;n.lastMouseY=i.pageY;var u=si();u==!0&&it()&&t.isAnimating()==!1&&(n.positionFrom="onMouseMove",r&&r.is(":animated")==!1&&ut(!1,!0))}function di(r,u,f,e){if(n.isOpened==!1)return!0;switch(i.gallery_mousewheel_role){default:case"zoom":var o=t.getSlideType();o!="image"&&r.preventDefault();break;case"none":r.preventDefault();break;case"advance":l.onGalleryMouseWheel(r,u,f,e)}}function gi(){a.on("touchstart",function(n){n.preventDefault()});a.on("touchend",function(){y.close("overlay")});f.addClassOnHover(h,"ug-arrow-hover");f.addClassOnHover(r,"ug-arrow-hover");f.addClassOnHover(c);l.setNextButton(h);l.setPrevButton(r);c.click(function(){y.close("button")});v.on(l.events.ITEM_CHANGE,vi);if(t){jQuery(t).on(t.events.TRANSITION_END,ai);jQuery(t).on(t.events.CLICK,yi);var i=t.getVideoObject();jQuery(i).on(i.events.PLAY_START,wi);jQuery(i).on(i.events.PLAY_STOP,bi);jQuery(t).on(t.events.START_DRAG,vt);jQuery(t).on(t.events.TRANSITION_START,vt);jQuery(t).on(t.events.AFTER_DRAG_CHANGE,yt);jQuery(t).on(t.events.AFTER_RETURN,yt);jQuery(t).on(t.events.AFTER_PUT_IMAGE,li);jQuery(t).on(t.events.ZOOM_CHANGE,ci);jQuery(t).on(t.events.IMAGE_MOUSEENTER,wt);jQuery(t).on(t.events.IMAGE_MOUSELEAVE,bt)}jQuery(window).resize(function(){if(n.isOpened==!1)return!0;f.whenContiniousEventOver("lightbox_resize",pi,100)});v.on(l.events.GALLERY_KEYPRESS,pt);n.isArrowsOnHoverMode==!0&&jQuery(document).bind("mousemove",ki);o.on("mousewheel",di)}function nr(){n.isCompact=!1;ot();n.isArrowsInside=!1;n.isArrowsOnHoverMode=!1;i=jQuery.extend({},n.originalOptions);i.lightbox_arrows_position="sides";t.setOptions(i)}var y=this,kt=jQuery(this),l=new UniteGalleryMain,v,o,t=new UGSlider,a,r,h,c,f=new UGFunctions,u=new UGTextPanel,s,e,i={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0};this.events={LIGHTBOX_INIT:"lightbox_init"};var n={topPanelHeight:44,initTextPanelHeight:26,isOpened:!1,isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},dt={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:n.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:0,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},gt={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};this.destroy=function(){if(jQuery(document).unbind("mousemove"),a.off("touchstart"),a.off("touchend"),c.off("click"),v.off(l.events.ITEM_CHANGE),t){jQuery(t).off(t.events.TRANSITION_END);jQuery(t).off(t.events.CLICK);jQuery(t).off(t.events.START_DRAG);jQuery(t).off(t.events.TRANSITION_START);jQuery(t).off(t.events.AFTER_DRAG_CHANGE);jQuery(t).off(t.events.AFTER_RETURN);var n=t.getVideoObject();jQuery(n).off(n.events.PLAY_START);jQuery(n).off(n.events.PLAY_STOP);jQuery(t).on(t.events.IMAGE_MOUSEENTER,wt);jQuery(t).on(t.events.IMAGE_MOUSELEAVE,bt);t.destroy()}jQuery(window).unbind("resize");v.off(l.events.GALLERY_KEYPRESS,pt);o.off("mousewheel");o.remove()};this.open=function(f){var e=l.getItem(f),s;n.isOpened=!0;n.isRightNowOpened=!0;setTimeout(function(){n.isRightNowOpened=!1},100);t&&t.setItem(e,"lightbox_open");u&&u.setTextPlain(e.title,e.description);a.stop().fadeTo(0,0);o.show();o.fadeTo(0,1);a.stop().fadeTo(n.fadeDuration,i.lightbox_overlay_opacity);ct();n.isCompact==!0&&(s=t.isPreloading(),s==!0?oi():n.isArrowsInside==!0&&(r.hide(),h.hide()));t&&t.startSlideAction();v.trigger(l.events.OPEN_LIGHTBOX,e)};this.close=function(){n.isOpened=!1;n.isCompact==!0&&ht();t&&t.stopSlideAction();var i=t.getSlideType();i!="image"?o.hide():o.fadeTo(n.fadeDuration,0,function(){o.hide()});v.trigger(l.events.CLOSE_LIGHTBOX)};this.init=function(n,t){ni(n,t)};this.putHtml=function(){var t=l.isSmallWindow();t&&n.isCompact==!0&&nr();ti()};this.run=function(){ii();t&&t.run();gi()}}function UGCarousel(){function et(i,r){g_objects=i.getObjects();a=i;ft=jQuery(i);s=g_objects.g_objWrapper;w=g_objects.g_arrItems;t=jQuery.extend(t,r);f.setFixedMode();f.setApproveClickFunction(fi);f.init(i,t);b=f.getObjThumbs();t=f.getOptions();n.initTileWidth=t.tile_width;n.initTileHeight=t.tile_height;n.tileWidth=t.tile_width}function ot(n){var n,t;n||(n=s);t="<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'><\/div><\/div>";s.append(t);e=s.children(".ug-carousel-wrapper");u=e.children(".ug-carousel-inner");f.setHtml(u);b.getThumbs().fadeTo(0,1)}function k(i,r){var r,u;r||(r=n.initTileHeight/n.initTileWidth*i);n.tileWidth=i;u={tile_width:i,tile_height:r};f.setOptions(u);t.tile_width=i;t.tile_height=r;f.resizeAllTiles(i);p(!0)}function st(){var o,u,h;if(n.carouselMaxWidth===null)throw new Error("The carousel width not set");n.tileWidth<n.initTileWidth?(u=n.carouselMaxWidth-t.carousel_padding*2,u>n.initTileWidth&&(u=n.initTileWidth),k(u),o=i.getNumItemsInSpace(n.carouselMaxWidth,u,t.carousel_space_between_tiles)):(o=i.getNumItemsInSpace(n.carouselMaxWidth,n.tileWidth,t.carousel_space_between_tiles),o<=0&&(o=1,u=n.carouselMaxWidth-t.carousel_padding*2,k(u)));h=i.getSpaceByNumItems(o,n.tileWidth,t.carousel_space_between_tiles);h+=t.carousel_padding*2;e.width(h);n.isFirstTimeRun==!0?(ui(),f.run(),jQuery.each(w,function(t,i){i.objThumbWrapper.data("index",t);s.trigger(n.eventSizeChange,[i.objThumbWrapper,!0]);i.objTileOriginal=i.objThumbWrapper.clone(!0,!0)}),p(!0),t.carousel_autoplay==!0&&r.startAutoplay()):(t.carousel_autoplay==!0&&r.pauseAutoplay(),l(0,!1),t.carousel_autoplay==!0&&r.startAutoplay());kt();n.isFirstTimeRun=!1}function v(){return i.getElementSize(u).left}function d(n){return i.getMousePosition(n).pageX}function c(){return u.children(".ug-thumb-wrapper")}function h(r){return i.getNumItemsInSpace(r,n.tileWidth,t.carousel_space_between_tiles)}function g(){return c().length}function y(n){tt(n);var t=c();return jQuery(t[n])}function ht(){return u.children(".ug-thumb-wrapper").first()}function ct(){return u.children(".ug-thumb-wrapper").last()}function lt(n,t,i){var r=n.data("index"),f,e,u,o;if(r==undefined)throw new Error("every tile should have index!");for(f=[],e=0;e<t;e++){if(u=i=="prev"?a.getPrevItem(r,!0):a.getNextItem(r,!0),!u)throw new Error("the item to add is empty");o=u.objTileOriginal.clone(!0,!0);r=u.index;o.addClass("cloned");f.push(o)}return f}function at(){var r=i.getElementSize(e),t=i.getElementSize(u),f=t.width-r.width+t.left;return n.sideSpace-f}function vt(){var t=-v();return n.sideSpace-t}function yt(){var n=i.getElementSize(e);return n.width}function nt(){var n=yt();return h(n)}function p(r){var r;r||(r=!1);var s=c(),h=0,f=0,o;return jQuery.each(s,function(n,r){r=jQuery(r);i.placeElement(r,h,0);var u=i.getElementSize(r);h+=u.width+t.carousel_space_between_tiles;f=Math.max(f,u.height);n==s.length-1&&(o=u.right)}),u.width(o),f+=t.carousel_padding*2,r===!0&&(u.height(f),e.height(f)),l(n.numCurrent,!1),o}function tt(n){if(n>c().length-1)throw new Error("Wrogn tile number: "+n);}function it(t,i){var r,e,o;r=i=="left"?ht():ct();e=i=="left"?"prev":"next";o=lt(r,t,e);jQuery.each(o,function(t,r){i=="left"?u.prepend(r):u.append(r);s.trigger(n.eventSizeChange,r);f.loadTileImage(r)})}function rt(n,t){var r,u,i;for(tt(u),r=c(),u=r.length,i=0;i<n;i++)t=="left"?jQuery(r[i]).remove():jQuery(r[u-1-i]).remove()}function pt(n){var t={left:n+"px"};u.css(t)}function l(r,f,e){var f,o,s;if(f===undefined&&(f=!0,u.is(":animated")))return!0;var c=y(r),l=i.getElementSize(c),a=-l.left+t.carousel_padding,h={left:a+"px"};f===!0?(o=t.carousel_scroll_duration,s=t.carousel_scroll_easing,e===!0&&(o=n.scrollShortDuration,s=n.scrollShortEasing),u.stop(!0).animate(h,{duration:o,easing:s,queue:!1,complete:function(){n.numCurrent=r;ut(!0)}})):(n.numCurrent=r,u.css(h))}function wt(){var t=-v(),n=h(t),r=i.getElementSize(y(n)).left,u=i.getElementSize(y(n+1)).left;return Math.abs(r-t)<Math.abs(u-t)?n:n+1}function bt(){var n=wt();l(n,!0,!0)}function ut(){var t=vt(),i=at(),r=0,e=0,u=0,f=0,s=g(),o;if(t>n.spaceActionSize?(r=h(t),it(r,"left"),n.numCurrent+=r):t<-n.spaceActionSize&&(u=h(Math.abs(t)),rt(u,"left"),n.numCurrent-=u),i>n.spaceActionSize?(e=h(i),it(e,"right")):i<-n.spaceActionSize&&(f=h(Math.abs(i)),rt(f,"right")),f>s)throw new Error("Can't remove more then num tiles");return o=!1,(r||e||u||f)&&(p(),o=!0),o}function kt(){i.placeElement(u,0,t.carousel_padding);ut()}function dt(){t.carousel_autoplay_direction=="left"?r.scrollRight(1):r.scrollLeft(1)}function gt(t){if(n.touchActive==!0)return!0;n.touchActive=!0;r.pauseAutoplay();n.startTime=jQuery.now();n.startMousePos=d(t);n.startInnerPos=v();n.lastTime=n.startTime;n.lastMousePos=n.startMousePos;i.storeEventData(t,n.storedEventID)}function ni(r){var e;if(n.touchActive==!1||(i.updateStoredEventData(r,n.storedEventID),r.preventDefault(),e=null,t.carousel_vertical_scroll_ondrag==!0&&(e=i.handleScrollTop(n.storedEventID)),e==="vert"))return!0;n.lastMousePos=d(r);var o=n.lastMousePos-n.startMousePos,f=n.startInnerPos+o,s=o>0?"prev":"next",h=i.getElementSize(u).width;f>0&&s=="prev"&&(f=f/3);f<-h&&s=="next"&&(f=n.startInnerPos+o/3);pt(f)}function ti(){if(n.touchActive==!1)return!0;n.touchActive=!1;bt();r.unpauseAutoplay()}function ii(){if(t.carousel_autoplay_pause_onhover==!1)return!0;n.isPlayMode==!0&&n.isPaused==!1&&r.pauseAutoplay()}function ri(){if(t.carousel_autoplay_pause_onhover==!1)return!0;r.unpauseAutoplay()}function ui(){f.initEvents();e.bind("mousedown touchstart",gt);jQuery("body").bind("mousemove touchmove",ni);jQuery(window).add("body").bind("mouseup touchend",ti);e.hover(ii,ri)}function fi(){var t=n.lastTime-n.startTime,i=Math.abs(n.lastMousePos-n.startMousePos);return t>300?!1:i>30?!1:!0}var r=this,o=jQuery(this),a=new UniteGalleryMain,ft,s,i=new UGFunctions,w,f=new UGTileDesign,b=new UGThumbsGeneral,e,u,t={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1},n;this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"};n={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!1,startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};this.startAutoplay=function(){n.isPlayMode=!0;n.isPaused=!1;o.trigger(r.events.START_PLAY);n.handle&&clearInterval(n.handle);n.handle=setInterval(dt,t.carousel_autoplay_timeout)};this.unpauseAutoplay=function(){if(n.isPlayMode==!1||n.isPaused==!1)return!0;r.startAutoplay()};this.pauseAutoplay=function(){if(n.isPlayMode==!1)return!0;n.isPaused=!0;n.handle&&clearInterval(n.handle);o.trigger(r.events.PAUSE_PLAY)};this.stopAutoplay=function(){if(n.isPlayMode==!1)return!0;n.isPaused=!1;n.isPlayMode=!1;n.handle&&clearInterval(n.handle);o.trigger(r.events.STOP_PLAY)};this.destroy=function(){n.handle&&clearInterval(n.handle);o.off(r.events.START_PLAY);o.off(r.events.STOP_PLAY);e.unbind("mousedown");e.unbind("touchstart");jQuery("body").unbind("mousemove");jQuery("body").unbind("touchmove");jQuery(window).add("body").unbind("mouseup").unbind("touchend");e.off("mouseenter").off("mouseleave");f.destroy()};this.init=function(n,t,i){i&&this.setMaxWidth(i);et(n,t)};this.setMaxWidth=function(t){n.carouselMaxWidth=t};this.setHtml=function(n){ot(n)};this.getElement=function(){return e};this.getObjTileDesign=function(){return f};this.getEstimatedHeight=function(){return t.tile_height+t.carousel_padding*2};this.run=function(){st()};this.scrollRight=function(i){var i,u,r;i&&typeof i!="object"||(i=t.carousel_navigation_numtiles);u=nt();i>u&&(i=u);r=n.numCurrent-i;r<=0&&(r=0);l(r)};this.scrollLeft=function(i){var i,u,f,r;i&&typeof i!="object"||(i=t.carousel_navigation_numtiles);u=nt();i>u&&(i=u);f=g();r=n.numCurrent+i;r>=f&&(r=f-1);l(r)};this.setScrollLeftButton=function(n){i.setButtonMobileReady(n);i.setButtonOnClick(n,r.scrollLeft)};this.setScrollRightButton=function(n){i.setButtonMobileReady(n);i.setButtonOnClick(n,r.scrollRight)};this.setPlayPauseButton=function(t){i.setButtonMobileReady(t);n.isPlayMode==!0&&n.isPaused==!1&&t.addClass("ug-pause-icon");o.on(r.events.START_PLAY,function(){t.addClass("ug-pause-icon")});o.on(r.events.STOP_PLAY,function(){t.removeClass("ug-pause-icon")});i.setButtonOnClick(t,function(){n.isPlayMode==!1||n.isPaused==!0?r.startAutoplay():r.stopAutoplay()})}}function UGTabs(){function e(u,e){r=u;f=jQuery(r);n=jQuery.extend(n,e);n.tabs_type=="select"?i=jQuery(n.tabs_container):t=jQuery(n.tabs_container+" .ug-tab")}function o(){c()}function u(n){r.requestNewItems(n)}function s(){var r=n.tabs_class_selected,i=jQuery(this),f;if(i.hasClass(r)||(t.not(i).removeClass(r),i.addClass(r),f=i.data("catid"),!f))return!0;u(f)}function h(){var t=jQuery(this),n=t.val();if(!n)return!0;u(n)}function c(){n.tabs_type=="select"?i.change(h):t.click(s)}var l=this,a=jQuery(this),f,r=new UniteGalleryMain,v=new UGFunctions,t,i,n={tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"};this.events={};this.destroy=function(){i&&i.off("change");t&&t.off("click")};this.init=function(n,t){e(n,t)};this.run=function(){o()}}function UG_API(n){function f(n){var i={index:n.index,title:n.title,description:n.description,urlImage:n.urlImage,urlThumb:n.urlThumb},r=n.objThumbImage.data();for(var t in r){switch(t){case"image":case"description":continue}i[t]=r[t]}return i}var r=this,e=jQuery(r),t=new UniteGalleryMain,i,u=[];t=n;i=jQuery(n);this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"};this.on=function(n,e,o){o!==!0&&u.push({event:n,func:e});switch(n){case"item_change":i.on(t.events.ITEM_CHANGE,function(){var i=t.getSelectedItem(),n=f(i);e(n.index,n)});break;case"resize":i.on(t.events.SIZE_CHANGE,e);break;case"enter_fullscreen":i.on(t.events.ENTER_FULLSCREEN,e);break;case"exit_fullscreen":i.on(t.events.EXIT_FULLSCREEN,e);break;case"play":i.on(t.events.START_PLAY,e);break;case"stop":i.on(t.events.STOP_PLAY,e);break;case"pause":i.on(t.events.PAUSE_PLAYING,e);break;case"continue":i.on(t.events.CONTINUE_PLAYING,e);break;case"open_lightbox":i.on(t.events.OPEN_LIGHTBOX,e);break;case"close_lightbox":i.on(t.events.CLOSE_LIGHTBOX,e);break;default:console&&console.log("wrong api event: "+n)}i.trigger(r.events.API_ON_EVENT,[n,e])};this.play=function(){t.startPlayMode()};this.stop=function(){t.stopPlayMode()};this.togglePlay=function(){t.togglePlayMode()};this.enterFullscreen=function(){t.toFullScreen()};this.exitFullscreen=function(){t.exitFullScreen()};this.toggleFullscreen=function(){t.toggleFullscreen()};this.resetZoom=function(){var n=t.getObjSlider();if(!n)return!1;n.zoomBack()};this.zoomIn=function(){var n=t.getObjSlider();if(!n)return!1;n.zoomIn()};this.zoomOut=function(){var n=t.getObjSlider();if(!n)return!1;n.zoomOut()};this.nextItem=function(){t.nextItem()};this.prevItem=function(){t.prevItem()};this.selectItem=function(n){t.selectItem(n)};this.resize=function(n,i){i?t.resize(n,i):t.resize(n)};this.getItem=function(n){var i=t.getItem(n);return f(i)};this.getNumItems=function(){return t.getNumItems()};this.reloadGallery=function(n){if(!n)var n={};t.run(null,n);u.map(function(n){r.on(n.event,n.func,!0)})};this.destroy=function(){t.destroy()};i.trigger(r.events.API_INIT_FUNCTIONS,r)}function UGLoadMore(){function s(){if((n=jQuery("#"+e.loadmore_container),n.length==0)||(r=n.find(".ug-loadmore-button"),r.length==0)||(i=n.find(".ug-loadmore-loader"),i.length==0)||(u=n.find(".ug-loadmore-error"),u.length==0))return!1;f.isInited=!0}function h(){n.show()}function c(){r.hide();i.show();var f={numitems:t.getNumItems()};t.ajaxRequest("front_loadmore",f,function(u){i.hide();var f=u.html_items,e=u.show_loadmore;e==!0?(r.blur().show(),i.hide()):n.hide();t.addItems(f)},function(n){n="Ajax Error!"+n;i.hide();u.show();u.html(n)})}function l(){t.onEvent("tiles_first_placed",h);r.click(c)}var a=this,v=jQuery(this),o,t=new UniteGalleryMain,y=new UGFunctions,n,r,i,u,f={isInited:!1},e={loadmore_container:"ug_loadmore_wrapper"};this.events={};this.destroy=function(){if(f.isInited==!1)return!1};this.init=function(n,i){if(t=n,o=jQuery(t),e=jQuery.extend(e,i),s(),f.isInited==!1)return trace("load more not inited, something is wrong"),!1;l()}}function UGTheme_default(){function rt(t,r){i=t;n=jQuery.extend(n,it);n=jQuery.extend(n,r);n=jQuery.extend(n,w);ft();i.setOptions(n);n.theme_load_panel==!0&&(e=new UGStripPanel,e.init(t,n));n.theme_load_slider==!0&&i.initSlider(n);y=t.getObjects();c=jQuery(t);l=y.g_objWrapper;n.theme_load_slider==!0&&(h=y.g_objSlider);n.theme_enable_text_panel==!0&&(u=new UGTextPanel,u.init(i,n,"slider"))}function ut(){et();b();vt()}function ft(){n=jQuery.extend({slider_textpanel_css_title:{},slider_textpanel_css_description:{}},n);n.slider_textpanel_css_title["text-align"]=n.theme_text_align;n.slider_textpanel_css_description["text-align"]=n.theme_text_align;switch(n.theme_text_type){case"title":n.slider_textpanel_enable_title=!0;n.slider_textpanel_enable_description=!1;break;case"both":n.slider_textpanel_enable_title=!0;n.slider_textpanel_enable_description=!0}}function et(){var i;l.addClass("ug-theme-default");i="<div class='ug-theme-panel'>";var r="ug-default-button-fullscreen",c="ug-default-button-play",a=".ug-default-button-fullscreen",v=".ug-default-button-play";u||(r="ug-default-button-fullscreen-single",c="ug-default-button-play-single",a=".ug-default-button-fullscreen-single",v=".ug-default-button-play-single");n.theme_enable_fullscreen_button==!0&&(i+="<div class='"+r+"'><\/div>");n.theme_enable_play_button==!0&&(i+="<div class='"+c+"'><\/div>");n.theme_enable_hidepanel_button&&(i+="<div class='ug-default-button-hidepanel'><div class='ug-default-button-hidepanel-bg'><\/div> <div class='ug-default-button-hidepanel-tip'><\/div><\/div>");i+="<\/div>";l.append(i);f=l.children(".ug-theme-panel");n.theme_enable_fullscreen_button==!0&&(o=f.children(a));n.theme_enable_play_button==!0&&(s=f.children(v));n.theme_enable_hidepanel_button==!0&&(t=f.children(".ug-default-button-hidepanel"));e.setHtml(f);u&&u.appendHTML(f);h&&h.setHtml()}function b(){n.theme_load_panel&&(ot(),st());h&&(p(),h.run())}function ot(){var ut=i.getSize(),d=ut.width,g,c,v,h,p,nt,b,tt,it,l,y,k,a,rt;e.setOrientation("bottom");e.setWidth(d);e.run();g=e.getSize();c=g.height;u?(c+=w.slider_textpanel_height,t&&(v=t.outerHeight(),c+=v)):(h=0,t&&(h=Math.max(t.outerHeight(),h)),o&&(h=Math.max(o.outerHeight(),h)),s&&(h=Math.max(s.outerHeight(),h)),c+=h);r.setElementSize(f,d,c);p=e.getElement();r.placeElement(p,"left","bottom");t&&(nt=t.children(".ug-default-button-hidepanel-tip"),r.placeElement(nt,"center","middle"),u&&(b=t.children(".ug-default-button-hidepanel-bg"),tt=u.getOption("textpanel_bg_opacity"),b.fadeTo(0,tt),it=u.getOption("textpanel_bg_color"),b.css({"background-color":it})));l=0;y=0;t&&(y=v);o&&(r.placeElement(o,"right","top",0,y),l=o.outerWidth());s&&(k=y,u||k++,r.placeElement(s,"right","top",l,k),l+=s.outerWidth());u&&(a={},a.slider_textpanel_padding_right=n.theme_text_padding_right+l,a.slider_textpanel_padding_left=n.theme_text_padding_left,t&&(a.slider_textpanel_margin=v),u.setOptions(a),u.positionPanel(),u.run());t&&(u?r.placeElement(t,"left","top"):(rt=p.outerHeight(),r.placeElement(t,"left","bottom",0,rt)))}function st(){if(a.isPanelHidden||k()==!0){var n=g();r.placeElement(f,0,n);a.isPanelHidden=!0}else r.placeElement(f,0,"bottom")}function p(){var n=i.getHeight(),t=n,r,u;e&&v()==!1&&(r=e.getSize(),t=n-r.height);u=i.getWidth();h.setSize(u,t);h.setPosition(0,0)}function k(){if(!n.theme_hide_panel_under_width)return!1;var t=jQuery(window).width(),i=n.theme_hide_panel_under_width;return t<=i?!0:!1}function ht(){if(!n.theme_hide_panel_under_width)return!1;var t=k();t==!0?nt(!0):tt(!0)}function ct(){b();ht()}function v(){return a.isPanelHidden}function d(n,t){var i={top:n+"px"};f.stop(!0).animate(i,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){t&&t()}})}function g(){var u=l.height(),n=u,i;return t&&(i=r.getElementSize(t),n-=i.bottom),n}function nt(n){var n,i;if(n||(n=!1),v()==!0)return!1;i=g();n==!0?r.placeElement(f,0,i):d(i,p);t&&t.addClass("ug-button-hidden-mode");a.isPanelHidden=!0}function tt(n){var n;if(n||(n=!1),v()==!1)return!1;var u=l.height(),e=f.outerHeight(),i=u-e;n==!0?r.placeElement(f,0,i):d(i,p);t&&t.removeClass("ug-button-hidden-mode");a.isPanelHidden=!1}function lt(n){if(n.stopPropagation(),n.stopImmediatePropagation(),r.validateClickTouchstartEvent(n.type)==!1)return!0;v()==!0?tt():nt()}function at(){i.showDisabledOverlay()}function vt(){c.on(i.events.SIZE_CHANGE,ct);c.on(i.events.GALLERY_BEFORE_REQUEST_ITEMS,at);if(s&&(r.addClassOnHover(s,"ug-button-hover"),i.setPlayButton(s)),o&&(r.addClassOnHover(o,"ug-button-hover"),i.setFullScreenToggleButton(o)),t){r.setButtonMobileReady(t);r.addClassOnHover(t,"ug-button-hover");t.on("click touchstart",lt)}c.on(i.events.SLIDER_ACTION_START,function(){f.css("z-index","1");h.getElement().css("z-index","11")});c.on(i.events.SLIDER_ACTION_END,function(){f.css("z-index","11");h.getElement().css("z-index","1")})}var yt=this,i=new UniteGalleryMain,c,y,l,o,s,t,h,f,e,u,r=new UGFunctions,n={theme_load_slider:!0,theme_load_panel:!0,theme_enable_fullscreen_button:!0,theme_enable_play_button:!0,theme_enable_hidepanel_button:!0,theme_enable_text_panel:!0,theme_text_padding_left:20,theme_text_padding_right:5,theme_text_align:"left",theme_text_type:"description",theme_hide_panel_under_width:480},it={slider_controls_always_on:!0,slider_zoompanel_align_vert:"top",slider_zoompanel_offset_vert:12,slider_textpanel_padding_top:0,slider_textpanel_enable_title:!1,slider_textpanel_enable_description:!0,slider_vertical_scroll_ondrag:!0,strippanel_background_color:"#232323",strippanel_padding_top:10},w={slider_enable_text_panel:!1,slider_enable_play_button:!1,slider_enable_fullscreen_button:!1,slider_enable_text_panel:!1,slider_textpanel_height:50,slider_textpanel_align:"top"},a={isPanelHidden:!1};this.destroy=function(){c.off(i.events.SIZE_CHANGE);c.off(i.events.GALLERY_BEFORE_REQUEST_ITEMS);s&&i.destroyPlayButton(s);o&&i.destroyFullscreenButton(o);t&&r.destroyButton(t);c.off(i.events.SLIDER_ACTION_START);c.off(i.events.SLIDER_ACTION_END);h&&h.destroy();e&&e.destroy();u&&u.destroy()};this.run=function(){ut()};this.init=function(n,t){rt(n,t)}}function UGTheme_slider(){function s(){f.addClass("ug-theme-slider");t&&t.setHtml()}function e(){var i=n.getHeight(),r=n.getWidth();t.setSize(r,i);t.setPosition(0,0)}function h(){e()}function c(){u.on(n.events.SIZE_CHANGE,h)}function l(){e();t.run()}var a=this,n=new UniteGalleryMain,u,r,f,t,v=new UGFunctions,i={},o={gallery_autoplay:!0,slider_scale_mode:"fill",slider_controls_always_on:!0,slider_enable_text_panel:!1,slider_controls_appear_ontap:!0,slider_enable_bullets:!0,slider_enable_arrows:!0,slider_enable_play_button:!1,slider_enable_fullscreen_button:!1,slider_enable_zoom_panel:!1,slider_vertical_scroll_ondrag:!0};this.init=function(e,s){n=e;i=jQuery.extend(i,o);i=jQuery.extend(i,s);n.setOptions(i);n.initSlider(i);r=e.getObjects();u=jQuery(e);f=r.g_objWrapper;t=r.g_objSlider};this.run=function(){s();l();c()}}var slidebars=function(){var e=$("[canvas]"),n={},t=!1,u=!1,o=["top","right","bottom","left"],s=["reveal","push","overlay","shift"],f=function(t){var i=$(),r="0px, 0px",u=parseFloat(n[t].element.css("transitionDuration"),10)*1e3;return(n[t].style==="reveal"||n[t].style==="push"||n[t].style==="shift")&&(i=i.add(e)),(n[t].style==="push"||n[t].style==="overlay"||n[t].style==="shift")&&(i=i.add(n[t].element)),n[t].active&&(n[t].side==="top"?r="0px, "+n[t].element.css("height"):n[t].side==="right"?r="-"+n[t].element.css("width")+", 0px":n[t].side==="bottom"?r="0px, -"+n[t].element.css("height"):n[t].side==="left"&&(r=n[t].element.css("width")+", 0px")),{elements:i,amount:r,duration:u}},h=function(t,r,u,f){if(i(t))throw"Error registering Slidebar, a Slidebar with id '"+t+"' already exists.";n[t]={id:t,side:r,style:u,element:f,active:!1}},i=function(t){return n.hasOwnProperty(t)?!0:!1},r;this.init=function(n){if(t)throw"Slidebars has already been initialized.";u||($("[off-canvas]").each(function(){var n=$(this).attr("off-canvas").split(" ",3);if(!n||!n[0]||o.indexOf(n[1])===-1||s.indexOf(n[2])===-1)throw"Error registering Slidebar, please specifiy a valid id, side and style'.";h(n[0],n[1],n[2],$(this))}),u=!0);t=!0;this.css();$(r).trigger("init");typeof n=="function"&&n()};this.exit=function(n){if(!t)throw"Slidebars hasn't been initialized.";var i=function(){t=!1;$(r).trigger("exit");typeof n=="function"&&n()};this.getActiveSlidebar()?this.close(i):i()};this.css=function(u){var f,e;if(!t)throw"Slidebars hasn't been initialized.";for(f in n)i(f)&&(e=n[f].side==="top"||n[f].side==="bottom"?n[f].element.css("height"):n[f].element.css("width"),(n[f].style==="push"||n[f].style==="overlay"||n[f].style==="shift")&&n[f].element.css("margin-"+n[f].side,"-"+e));this.getActiveSlidebar()&&this.open(this.getActiveSlidebar());$(r).trigger("css");typeof u=="function"&&u()};this.open=function(u,e){if(!t)throw"Slidebars hasn't been initialized.";if(!u||!i(u))throw"Error opening Slidebar, there is no Slidebar with id '"+u+"'.";var o=function(){n[u].active=!0;n[u].element.css("display","block");$(r).trigger("opening",[n[u].id]);var t=f(u);t.elements.css({"transition-duration":t.duration+"ms",transform:"translate("+t.amount+")"});setTimeout(function(){$(r).trigger("opened",[n[u].id]);typeof e=="function"&&e()},t.duration)};this.getActiveSlidebar()&&this.getActiveSlidebar()!==u?this.close(o):o()};this.close=function(u,e){if(typeof u=="function"&&(e=u,u=null),!t)throw"Slidebars hasn't been initialized.";if(u&&!i(u))throw"Error closing Slidebar, there is no Slidebar with id '"+u+"'.";if(u||(u=this.getActiveSlidebar()),u&&n[u].active){n[u].active=!1;$(r).trigger("closing",[n[u].id]);var o=f(u);o.elements.css("transform","");setTimeout(function(){o.elements.css("transition-duration","");n[u].element.css("display","");$(r).trigger("closed",[n[u].id]);typeof e=="function"&&e()},o.duration)}};this.toggle=function(r,u){if(!t)throw"Slidebars hasn't been initialized.";if(!r||!i(r))throw"Error toggling Slidebar, there is no Slidebar with id '"+r+"'.";n[r].active?this.close(r,function(){typeof u=="function"&&u()}):this.open(r,function(){typeof u=="function"&&u()})};this.isActive=function(){return t};this.isActiveSlidebar=function(r){if(!t)throw"Slidebars hasn't been initialized.";if(!r)throw"You must provide a Slidebar id.";if(!i(r))throw"Error retrieving Slidebar, there is no Slidebar with id '"+r+"'.";return n[r].active};this.getActiveSlidebar=function(){var u,r;if(!t)throw"Slidebars hasn't been initialized.";u=!1;for(r in n)if(i(r)&&n[r].active){u=n[r].id;break}return u};this.getSlidebars=function(){var r,u;if(!t)throw"Slidebars hasn't been initialized.";r=[];for(u in n)i(u)&&r.push(n[u].id);return r};this.getSlidebar=function(r){if(!t)throw"Slidebars hasn't been initialized.";if(!r)throw"You must pass a Slidebar id.";if(!r||!i(r))throw"Error retrieving Slidebar, there is no Slidebar with id '"+r+"'.";return n[r]};this.events={};r=this.events;$(window).on("resize",this.css.bind(this))},g_ugFunctions;(function(n){n(document).ready(function(){n.initSidebarMenu=function(){var n=new slidebars;n.init()};const t=function(){n("#navMenu").toggleClass("activeMenu");n("#btn-menu").toggleClass("header__btn-menu-active");n(".alp-icon-menu-blue").toggleClass("alp-icon-menu-white");setTimeout(i,200)};n("#btn-menu").click(function(){t()});const i=function(){n(".nav__btn-open-submenu").removeClass("activeSubMenu");n(".open").removeClass("open")};n(".nav__btn-open-submenu").click(function(){n(this).addClass("activeSubMenu");n(this).next().addClass("open")});n(".nav__btn-close-sub-menu").click(function(){n(this).closest(".nav-list-sub-menu__wrapper").hasClass("open")&&n(this).closest(".nav-list-sub-menu__wrapper").removeClass("open");n(this).closest(".nav-list-sub-menu__wrapper").prev().hasClass("activeSubMenu")&&n(this).closest(".nav-list-sub-menu__wrapper").prev().removeClass("activeSubMenu")});n(".force-reload").attr("href",window.location.origin+"/#/");n(".force-reload").click(function(){window.location.href===n(this).attr("href")?window.location.reload():(window.location="#/home",n("body").css("overflow","auto"),n(".bottom-menu").show(),window.location.reload())})})})(jQuery);MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m";MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png";MarkerClusterer.prototype.extend=function(n,t){return function(n){for(var t in n.prototype)this.prototype[t]=n.prototype[t];return this}.apply(n,[t])};MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)};MarkerClusterer.prototype.draw=function(){};MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var n=0,t;t=this.sizes[n];n++)this.styles_.push({url:this.imagePath_+(n+1)+"."+this.imageExtension_,height:t,width:t})};MarkerClusterer.prototype.fitMapToMarkers=function(){for(var r=this.getMarkers(),n=new google.maps.LatLngBounds,t=0,i;i=r[t];t++)n.extend(i.getPosition());this.map_.fitBounds(n)};MarkerClusterer.prototype.setStyles=function(n){this.styles_=n};MarkerClusterer.prototype.getStyles=function(){return this.styles_};MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_};MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_};MarkerClusterer.prototype.getMarkers=function(){return this.markers_};MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length};MarkerClusterer.prototype.setMaxZoom=function(n){this.maxZoom_=n};MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_};MarkerClusterer.prototype.calculator_=function(n,t){for(var i=0,u=n.length,r=u;r!==0;)r=parseInt(r/10,10),i++;return i=Math.min(i,t),{text:u,index:i}};MarkerClusterer.prototype.setCalculator=function(n){this.calculator_=n};MarkerClusterer.prototype.getCalculator=function(){return this.calculator_};MarkerClusterer.prototype.addMarkers=function(n,t){var r,i;if(n.length)for(r=0;i=n[r];r++)this.pushMarkerTo_(i);else if(Object.keys(n).length)for(i in n)this.pushMarkerTo_(n[i]);t||this.redraw()};MarkerClusterer.prototype.pushMarkerTo_=function(n){if(n.isAdded=!1,n.draggable){var t=this;google.maps.event.addListener(n,"dragend",function(){n.isAdded=!1;t.repaint()})}this.markers_.push(n)};MarkerClusterer.prototype.addMarker=function(n,t){this.pushMarkerTo_(n);t||this.redraw()};MarkerClusterer.prototype.removeMarker_=function(n){var t=-1,i,r;if(this.markers_.indexOf)t=this.markers_.indexOf(n);else for(i=0;r=this.markers_[i];i++)if(r==n){t=i;break}return t==-1?!1:(n.setMap(null),this.markers_.splice(t,1),!0)};MarkerClusterer.prototype.removeMarker=function(n,t){var i=this.removeMarker_(n);return!t&&i?(this.resetViewport(),this.redraw(),!0):!1};MarkerClusterer.prototype.removeMarkers=function(n,t){for(var f,i=!1,r=0,u;u=n[r];r++)f=this.removeMarker_(u),i=i||f;if(!t&&i)return this.resetViewport(),this.redraw(),!0};MarkerClusterer.prototype.setReady_=function(n){this.ready_||(this.ready_=n,this.createClusters_())};MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length};MarkerClusterer.prototype.getMap=function(){return this.map_};MarkerClusterer.prototype.setMap=function(n){this.map_=n};MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_};MarkerClusterer.prototype.setGridSize=function(n){this.gridSize_=n};MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_};MarkerClusterer.prototype.setMinClusterSize=function(n){this.minClusterSize_=n};MarkerClusterer.prototype.getExtendedBounds=function(n){var t=this.getProjection(),e=new google.maps.LatLng(n.getNorthEast().lat(),n.getNorthEast().lng()),o=new google.maps.LatLng(n.getSouthWest().lat(),n.getSouthWest().lng()),r=t.fromLatLngToDivPixel(e),i,u,f;return r.x+=this.gridSize_,r.y-=this.gridSize_,i=t.fromLatLngToDivPixel(o),i.x-=this.gridSize_,i.y+=this.gridSize_,u=t.fromDivPixelToLatLng(r),f=t.fromDivPixelToLatLng(i),n.extend(u),n.extend(f),n};MarkerClusterer.prototype.isMarkerInBounds_=function(n,t){return t.contains(n.getPosition())};MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0);this.markers_=[]};MarkerClusterer.prototype.resetViewport=function(n){for(var r,i,t=0;r=this.clusters_[t];t++)r.remove();for(t=0;i=this.markers_[t];t++)i.isAdded=!1,n&&i.setMap(null);this.clusters_=[]};MarkerClusterer.prototype.repaint=function(){var n=this.clusters_.slice();this.clusters_.length=0;this.resetViewport();this.redraw();window.setTimeout(function(){for(var t=0,i;i=n[t];t++)i.remove()},0)};MarkerClusterer.prototype.redraw=function(){this.createClusters_()};MarkerClusterer.prototype.distanceBetweenPoints_=function(n,t){if(!n||!t)return 0;var i=(t.lat()-n.lat())*Math.PI/180,r=(t.lng()-n.lng())*Math.PI/180,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n.lat()*Math.PI/180)*Math.cos(t.lat()*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return 6371*f};MarkerClusterer.prototype.addToClosestCluster_=function(n){for(var r,u,t,f=4e4,i=null,o=n.getPosition(),e=0;t=this.clusters_[e];e++)r=t.getCenter(),r&&(u=this.distanceBetweenPoints_(r,n.getPosition()),u<f&&(f=u,i=t));i&&i.isMarkerInClusterBounds(n)?i.addMarker(n):(t=new Cluster(this),t.addMarker(n),this.clusters_.push(t))};MarkerClusterer.prototype.createClusters_=function(){var i,r,t,n;if(this.ready_)for(i=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),r=this.getExtendedBounds(i),t=0;n=this.markers_[t];t++)!n.isAdded&&this.isMarkerInBounds_(n,r)&&this.addToClosestCluster_(n)};Cluster.prototype.isMarkerAlreadyAdded=function(n){if(this.markers_.indexOf)return this.markers_.indexOf(n)!=-1;for(var t=0,i;i=this.markers_[t];t++)if(i==n)return!0;return!1};Cluster.prototype.addMarker=function(n){var t,r;if(this.isMarkerAlreadyAdded(n))return!1;if(this.center_){if(this.averageCenter_){var i=this.markers_.length+1,u=(this.center_.lat()*(i-1)+n.getPosition().lat())/i,f=(this.center_.lng()*(i-1)+n.getPosition().lng())/i;this.center_=new google.maps.LatLng(u,f);this.calculateBounds_()}}else this.center_=n.getPosition(),this.calculateBounds_();if(n.isAdded=!0,this.markers_.push(n),t=this.markers_.length,t<this.minClusterSize_&&n.getMap()!=this.map_&&n.setMap(this.map_),t==this.minClusterSize_)for(r=0;r<t;r++)this.markers_[r].setMap(null);return t>=this.minClusterSize_&&n.setMap(null),this.updateIcon(),!0};Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_};Cluster.prototype.getBounds=function(){for(var n=new google.maps.LatLngBounds(this.center_,this.center_),r=this.getMarkers(),t=0,i;i=r[t];t++)n.extend(i.getPosition());return n};Cluster.prototype.remove=function(){this.clusterIcon_.remove();this.markers_.length=0;delete this.markers_};Cluster.prototype.getSize=function(){return this.markers_.length};Cluster.prototype.getMarkers=function(){return this.markers_};Cluster.prototype.getCenter=function(){return this.center_};Cluster.prototype.calculateBounds_=function(){var n=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(n)};Cluster.prototype.isMarkerInClusterBounds=function(n){return this.bounds_.contains(n.getPosition())};Cluster.prototype.getMap=function(){return this.map_};Cluster.prototype.updateIcon=function(){var f=this.map_.getZoom(),t=this.markerClusterer_.getMaxZoom(),n,i,r,u;if(t&&f>t){for(n=0;i=this.markers_[n];n++)i.setMap(this.map_);return}if(this.markers_.length<this.minClusterSize_){this.clusterIcon_.hide();return}r=this.markerClusterer_.getStyles().length;u=this.markerClusterer_.getCalculator()(this.markers_,r);this.clusterIcon_.setCenter(this.center_);this.clusterIcon_.setSums(u);this.clusterIcon_.show()};ClusterIcon.prototype.triggerClusterClick=function(){var n=this.cluster_.getMarkerClusterer();google.maps.event.trigger(n,"clusterclick",this.cluster_);n.isZoomOnClick()&&this.map_.fitBounds(this.cluster_.getBounds())};ClusterIcon.prototype.onAdd=function(){var n,t,i;this.div_=document.createElement("DIV");this.visible_&&(n=this.getPosFromLatLng_(this.center_),this.div_.style.cssText=this.createCss(n),this.div_.innerHTML=this.sums_.text);t=this.getPanes();t.overlayMouseTarget.appendChild(this.div_);i=this;google.maps.event.addDomListener(this.div_,"click",function(){i.triggerClusterClick()})};ClusterIcon.prototype.getPosFromLatLng_=function(n){var t=this.getProjection().fromLatLngToDivPixel(n);return t.x-=parseInt(this.width_/2,10),t.y-=parseInt(this.height_/2,10),t};ClusterIcon.prototype.draw=function(){if(this.visible_){var n=this.getPosFromLatLng_(this.center_);this.div_.style.top=n.y+"px";this.div_.style.left=n.x+"px"}};ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none");this.visible_=!1};ClusterIcon.prototype.show=function(){if(this.div_){var n=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(n);this.div_.style.display=""}this.visible_=!0};ClusterIcon.prototype.remove=function(){this.setMap(null)};ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)};ClusterIcon.prototype.setSums=function(n){this.sums_=n;this.text_=n.text;this.index_=n.index;this.div_&&(this.div_.innerHTML=n.text);this.useStyle()};ClusterIcon.prototype.useStyle=function(){var t=Math.max(0,this.sums_.index-1),n;t=Math.min(this.styles_.length-1,t);n=this.styles_[t];this.url_=n.url;this.height_=n.height;this.width_=n.width;this.textColor_=n.textColor;this.anchor_=n.anchor;this.textSize_=n.textSize;this.backgroundPosition_=n.backgroundPosition};ClusterIcon.prototype.setCenter=function(n){this.center_=n};ClusterIcon.prototype.createCss=function(n){var t=[],i,r,u;return t.push("background-image:url("+this.url_+");"),i=this.backgroundPosition_?this.backgroundPosition_:"0 0",t.push("background-position:"+i+";"),typeof this.anchor_=="object"?(typeof this.anchor_[0]=="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?t.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),typeof this.anchor_[1]=="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?t.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):t.push("width:"+this.width_+"px; text-align:center;")):t.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;"),r=this.textColor_?this.textColor_:"black",u=this.textSize_?this.textSize_:11,t.push("cursor:pointer; top:"+n.y+"px; left:"+n.x+"px; color:"+r+"; position:absolute; font-size:"+u+"px; font-family:Arial,sans-serif; font-weight:bold"),t.join("")};g_ugFunctions=new UGFunctions;!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof exports?module.exports=n:n(jQuery)}(function(n){function u(i){var r=i||window.event,y=c.call(arguments,1),s=0,e=0,u=0,l=0,a,v;if(i=n.event.fix(r),i.type="mousewheel","detail"in r&&(u=-1*r.detail),"wheelDelta"in r&&(u=r.wheelDelta),"wheelDeltaY"in r&&(u=r.wheelDeltaY),"wheelDeltaX"in r&&(e=-1*r.wheelDeltaX),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(e=-1*u,u=0),s=0===u?e:u,"deltaY"in r&&(u=-1*r.deltaY,s=u),"deltaX"in r&&(e=r.deltaX,0===u&&(s=-1*e)),0!==u||0!==e)return 1===r.deltaMode?(a=n.data(this,"mousewheel-line-height"),s*=a,u*=a,e*=a):2===r.deltaMode&&(v=n.data(this,"mousewheel-page-height"),s*=v,u*=v,e*=v),l=Math.max(Math.abs(u),Math.abs(e)),(!t||t>l)&&(t=l,o(r,l)&&(t/=40)),o(r,l)&&(s/=40,e/=40,u/=40),s=Math[s>=1?"floor":"ceil"](s/t),e=Math[e>=1?"floor":"ceil"](e/t),u=Math[u>=1?"floor":"ceil"](u/t),i.deltaX=e,i.deltaY=u,i.deltaFactor=t,i.deltaMode=0,y.unshift(i,s,e,u),f&&clearTimeout(f),f=setTimeout(h,200),(n.event.dispatch||n.event.handle).apply(this,y)}function h(){t=null}function o(n,t){return r.settings.adjustOldDeltas&&"mousewheel"===n.type&&t%120==0}var f,t,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],c=Array.prototype.slice,e,r;if(n.event.fixHooks)for(e=s.length;e;)n.event.fixHooks[s[--e]]=n.event.mouseHooks;r=n.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var t=i.length;t;)this.addEventListener(i[--t],u,!1);else this.onmousewheel=u;n.data(this,"mousewheel-line-height",r.getLineHeight(this));n.data(this,"mousewheel-page-height",r.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var n=i.length;n;)this.removeEventListener(i[--n],u,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(n(t)["offsetParent"in n.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return n(t).height()},settings:{adjustOldDeltas:!0}};n.fn.extend({mousewheel:function(n){return n?this.bind("mousewheel",n):this.trigger("mousewheel")},unmousewheel:function(n){return this.unbind("mousewheel",n)}})}),function(n){typeof define=="function"&&define.amd?define(["jquery"],function(t){return n(t)}):typeof module=="object"&&typeof module.exports=="object"?exports=n(require("jquery")):n(jQuery)}(function(n){function o(n){var i=7.5625,t=2.75;return n<1/t?i*n*n:n<2/t?i*(n-=1.5/t)*n+.75:n<2.5/t?i*(n-=2.25/t)*n+.9375:i*(n-=2.625/t)*n+.984375}n.easing.jswing=n.easing.swing;var t=Math.pow,u=Math.sqrt,i=Math.sin,s=Math.cos,r=Math.PI,f=1.70158,e=f*1.525,h=f+1,c=2*r/3,l=2*r/4.5;n.extend(n.easing,{def:"easeOutQuad",swing:function(t){return n.easing[n.easing.def](t)},easeInQuad:function(n){return n*n},easeOutQuad:function(n){return 1-(1-n)*(1-n)},easeInOutQuad:function(n){return n<.5?2*n*n:1-t(-2*n+2,2)/2},easeInCubic:function(n){return n*n*n},easeOutCubic:function(n){return 1-t(1-n,3)},easeInOutCubic:function(n){return n<.5?4*n*n*n:1-t(-2*n+2,3)/2},easeInQuart:function(n){return n*n*n*n},easeOutQuart:function(n){return 1-t(1-n,4)},easeInOutQuart:function(n){return n<.5?8*n*n*n*n:1-t(-2*n+2,4)/2},easeInQuint:function(n){return n*n*n*n*n},easeOutQuint:function(n){return 1-t(1-n,5)},easeInOutQuint:function(n){return n<.5?16*n*n*n*n*n:1-t(-2*n+2,5)/2},easeInSine:function(n){return 1-s(n*r/2)},easeOutSine:function(n){return i(n*r/2)},easeInOutSine:function(n){return-(s(r*n)-1)/2},easeInExpo:function(n){return n===0?0:t(2,10*n-10)},easeOutExpo:function(n){return n===1?1:1-t(2,-10*n)},easeInOutExpo:function(n){return n===0?0:n===1?1:n<.5?t(2,20*n-10)/2:(2-t(2,-20*n+10))/2},easeInCirc:function(n){return 1-u(1-t(n,2))},easeOutCirc:function(n){return u(1-t(n-1,2))},easeInOutCirc:function(n){return n<.5?(1-u(1-t(2*n,2)))/2:(u(1-t(-2*n+2,2))+1)/2},easeInElastic:function(n){return n===0?0:n===1?1:-t(2,10*n-10)*i((n*10-10.75)*c)},easeOutElastic:function(n){return n===0?0:n===1?1:t(2,-10*n)*i((n*10-.75)*c)+1},easeInOutElastic:function(n){return n===0?0:n===1?1:n<.5?-(t(2,20*n-10)*i((20*n-11.125)*l))/2:t(2,-20*n+10)*i((20*n-11.125)*l)/2+1},easeInBack:function(n){return h*n*n*n-f*n*n},easeOutBack:function(n){return 1+h*t(n-1,3)+f*t(n-1,2)},easeInOutBack:function(n){return n<.5?t(2*n,2)*((e+1)*2*n-e)/2:(t(2*n-2,2)*((e+1)*(n*2-2)+e)+2)/2},easeInBounce:function(n){return 1-o(1-n)},easeOutBounce:o,easeInOutBounce:function(n){return n<.5?(1-o(1-2*n))/2:(1+o(2*n-1))/2}})});!function(n,t){function f(n,t,i){var r=h[t.type]||{};return null==n?i||!t.def?null:t.def:(n=r.floor?~~n:parseFloat(n),isNaN(n)?t.def:r.mod?(n+r.mod)%r.mod:0>n?0:r.max<n?r.max:n)}function s(t){var f=i(),o=f._rgba=[];return t=t.toLowerCase(),r(v,function(n,i){var r,s=i.re.exec(t),h=s&&i.parse(s),e=i.space||"rgba";if(h)return(r=f[e](h),f[u[e].cache]=r[u[e].cache],o=f._rgba=r._rgba,!1)}),o.length?("0,0,0,0"===o.join()&&n.extend(o,e.transparent),f):e[t]}function o(n,t,i){return i=(i+1)%1,1>6*i?n+(t-n)*i*6:1>2*i?t:2>3*i?n+(t-n)*(2/3-i)*6:n}if(typeof n.cssHooks=="undefined")return!1;var e,a=/^([\-+])=\s*(\d+\.?\d*)/,v=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(n){return[n[1],n[2],n[3],n[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(n){return[2.55*n[1],2.55*n[2],2.55*n[3],n[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(n){return[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(n){return[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(n){return[n[1],n[2]/100,n[3]/100,n[4]]}}],i=n.Color=function(t,i,r,u){return new n.Color.fn.parse(t,i,r,u)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=i.support={},l=n("<p>")[0],r=n.each;l.style.cssText="background-color:rgba(1,1,1,.5)";c.rgba=l.style.backgroundColor.indexOf("rgba")>-1;r(u,function(n,t){t.cache="_"+n;t.props.alpha={idx:3,type:"percent",def:1}});i.fn=n.extend(i.prototype,{parse:function(o,h,c,l){if(o===t)return this._rgba=[null,null,null,null],this;(o.jquery||o.nodeType)&&(o=n(o).css(h),h=t);var a=this,v=n.type(o),y=this._rgba=[];return h!==t&&(o=[o,h,c,l],v="array"),"string"===v?this.parse(s(o)||e._default):"array"===v?(r(u.rgba.props,function(n,t){y[t.idx]=f(o[t.idx],t)}),this):"object"===v?(o instanceof i?r(u,function(n,t){o[t.cache]&&(a[t.cache]=o[t.cache].slice())}):r(u,function(t,i){var u=i.cache;r(i.props,function(n,t){if(!a[u]&&i.to){if("alpha"===n||null==o[n])return;a[u]=i.to(a._rgba)}a[u][t.idx]=f(o[n],t,!0)});a[u]&&n.inArray(null,a[u].slice(0,3))<0&&(a[u][3]=1,i.from&&(a._rgba=i.from(a[u])))}),this):void 0},is:function(n){var e=i(n),t=!0,f=this;return r(u,function(n,i){var o,u=e[i.cache];return u&&(o=f[i.cache]||i.to&&i.to(f._rgba)||[],r(i.props,function(n,i){if(null!=u[i.idx])return t=u[i.idx]===o[i.idx]})),t}),t},_space:function(){var n=[],t=this;return r(u,function(i,r){t[r.cache]&&n.push(i)}),n.pop()},transition:function(n,t){var e=i(n),c=e._space(),o=u[c],l=0===this.alpha()?i("transparent"):this,a=l[o.cache]||o.to(l._rgba),s=a.slice();return e=e[o.cache],r(o.props,function(n,i){var c=i.idx,r=a[c],u=e[c],o=h[i.type]||{};null!==u&&(null===r?s[c]=u:(o.mod&&(u-r>o.mod/2?r+=o.mod:r-u>o.mod/2&&(r-=o.mod)),s[c]=f((u-r)*t+r,i)))}),this[c](s)},blend:function(t){if(1===this._rgba[3])return this;var r=this._rgba.slice(),u=r.pop(),f=i(t)._rgba;return i(n.map(r,function(n,t){return(1-u)*f[t]+u*n}))},toRgbaString:function(){var i="rgba(",t=n.map(this._rgba,function(n,t){return null==n?t>2?1:0:n});return 1===t[3]&&(t.pop(),i="rgb("),i+t.join()+")"},toHslaString:function(){var i="hsla(",t=n.map(this.hsla(),function(n,t){return null==n&&(n=t>2?1:0),t&&3>t&&(n=Math.round(100*n)+"%"),n});return 1===t[3]&&(t.pop(),i="hsl("),i+t.join()+")"},toHexString:function(t){var i=this._rgba.slice(),r=i.pop();return t&&i.push(~~(255*r)),"#"+n.map(i,function(n){return n=(n||0).toString(16),1===n.length?"0"+n:n}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}});i.fn.parse.prototype=i.fn;u.hsla.to=function(n){if(null==n[0]||null==n[1]||null==n[2])return[null,null,null,n[3]];var s,h,i=n[0]/255,r=n[1]/255,f=n[2]/255,c=n[3],u=Math.max(i,r,f),e=Math.min(i,r,f),t=u-e,o=u+e,l=.5*o;return s=e===u?0:i===u?60*(r-f)/t+360:r===u?60*(f-i)/t+120:60*(i-r)/t+240,h=0===t?0:.5>=l?t/o:t/(2-o),[Math.round(s)%360,h,l,null==c?1:c]};u.hsla.from=function(n){if(null==n[0]||null==n[1]||null==n[2])return[null,null,null,n[3]];var r=n[0]/360,u=n[1],t=n[2],e=n[3],i=.5>=t?t*(1+u):t+u-t*u,f=2*t-i;return[Math.round(255*o(f,i,r+1/3)),Math.round(255*o(f,i,r)),Math.round(255*o(f,i,r-1/3)),e]};r(u,function(u,e){var s=e.props,o=e.cache,h=e.to,c=e.from;i.fn[u]=function(u){if(h&&!this[o]&&(this[o]=h(this._rgba)),u===t)return this[o].slice();var l,a=n.type(u),v="array"===a||"object"===a?u:arguments,e=this[o].slice();return r(s,function(n,t){var i=v["object"===a?n:t.idx];null==i&&(i=e[t.idx]);e[t.idx]=f(i,t)}),c?(l=i(c(e)),l[o]=e,l):i(e)};r(s,function(t,r){i.fn[t]||(i.fn[t]=function(i){var f,e=n.type(i),h="alpha"===t?this._hsla?"hsla":"rgba":u,o=this[h](),s=o[r.idx];return"undefined"===e?s:("function"===e&&(i=i.call(this,s),e=n.type(i)),null==i&&r.empty?this:("string"===e&&(f=a.exec(i),f&&(i=s+parseFloat(f[2])*("+"===f[1]?1:-1))),o[r.idx]=i,this[h](o)))})})});i.hook=function(t){var u=t.split(" ");r(u,function(t,r){n.cssHooks[r]={set:function(t,u){var o,f,e="";if("transparent"!==u&&("string"!==n.type(u)||(o=s(u)))){if(u=i(o||u),!c.rgba&&1!==u._rgba[3]){for(f="backgroundColor"===r?t.parentNode:t;(""===e||"transparent"===e)&&f&&f.style;)try{e=n.css(f,"backgroundColor");f=f.parentNode}catch(h){}u=u.blend(e&&"transparent"!==e?e:"_default")}u=u.toRgbaString()}try{t.style[r]=u}catch(h){}}};n.fx.step[r]=function(t){t.colorInit||(t.start=i(t.elem,r),t.end=i(t.end),t.colorInit=!0);n.cssHooks[r].set(t.elem,t.start.transition(t.end,t.pos))}})};i.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor");n.cssHooks.borderColor={expand:function(n){var t={};return r(["Top","Right","Bottom","Left"],function(i,r){t["border"+r+"Color"]=n}),t}};e=n.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery);!function(n){function t(){try{var i=this===document?n(this):n(this).contents()}catch(r){return!1}i.mousemove(function(t){n.mlp={x:t.pageX,y:t.pageY}});i.find("iframe").on("load",t)}n.mlp={x:0,y:0};n(t);n.fn.ismouseover=function(){var t=!1;return this.eq(0).each(function(){var r=n(this).is("iframe")?n(this).contents().find("body"):n(this),i=r.offset();t=i.left<=n.mlp.x&&i.left+r.outerWidth()>n.mlp.x&&i.top<=n.mlp.y&&i.top+r.outerHeight()>n.mlp.y}),t}}(jQuery);var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI;jQuery.fn.unitegallery=function(n){var i=jQuery(this),r="#"+i.attr("id"),n,t;return n||(n={}),t=new UniteGalleryMain,t.run(r,n),new UG_API(t)};typeof g_ugFunctions!="undefined"?g_ugFunctions.registerTheme("default"):jQuery(document).ready(function(){g_ugFunctions.registerTheme("default")});typeof g_ugFunctions!="undefined"?g_ugFunctions.registerTheme("slider"):jQuery(document).ready(function(){g_ugFunctions.registerTheme("slider")})