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){var o=n.getImageInsideParentData(i,r,u,f,e),s="<img";return o.imageWidth!==null&&(s+=" width = '"+o.imageWidth+"'",o.style+="width:"+o.imageWidth+";"),o.imageHeight!=null&&(o.imageHeight=="100%"?(s+=" height = '"+o.imageHeight+"'",o.style+="height:"+o.imageHeight+";"):(s+=" height = '"+o.imageHeight+"'",o.style+="height:"+o.imageHeight+"px;")),o.imageTop!==null&&(o.style+="top:"+o.imageTop+"px;"),o.imageLeft!==null&&(o.style+="left:"+o.imageLeft+"px;"),t=n.escapeDoubleSlash(t),s+=" style='"+o.style+"'",s+=' src="'+t+'"',s+=">",i.html(s),i.children("img")};this.scaleImageCoverParent=function(t,i,r){var f,o;typeof i=="number"?(f=i,o=r):(f=i.outerWidth(),o=i.outerHeight());var c=n.getImageOriginalSize(t),a=c.width,v=c.height,l=a/v,e=o,u=e*l,s=0,h=0;u<f?(u=f,e=u/l,h=0,s=Math.round((e-o)/-2)):(s=0,h=Math.round((u-f)/-2));u=Math.round(u);e=Math.round(e);t.css({width:u+"px",height:e+"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 u=jQuery.fn.jquery.split("."),f=n.split("."),i,r,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 i=[],r,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,i;for(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="",a,v,l,f,s,y,h;t.customThumbs==!1&&(c=" ug-thumb-generated");var p=o.index+1,w="style='z-index:"+p+";'",l="<div class='ug-thumb-wrapper"+c+"' "+w+"><\/div>";return n.thumb_wrapper_as_link==!0&&(a=o.link,o.link==""&&(a="javascript:void(0)"),v="",n.thumb_link_newpage==!0&&o.link&&(v=" target='_blank'"),l="<a href='"+a+"'"+v+" class='ug-thumb-wrapper"+c+"'><\/a>"),f=jQuery(l),s=o.objThumbImage,t.customThumbs==!1&&(n.thumb_show_loader==!0&&s&&(y="ug-thumb-loader-dark",n.thumb_loader_type=="bright"&&(y="ug-thumb-loader-bright"),f.append("<div class='ug-thumb-loader "+y+"'><\/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 c=e.children(".ug-thumb-wrapper"),o=0,r=0,t,s;for(f==!1&&(r=n.strip_padding_top),i=0;i<c.length;i++){if(t=jQuery(c[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}s=f==!1?o-n.strip_space_between_thumbs:r-n.strip_space_between_thumbs;ct(s)}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 f=h.getElementSize(i),t,u;switch(n.orientation){case"left":n.originalPos=f.left;t=-n.panelWidth;break;case"right":n.originalPos=f.left;u=r.getSize();t=u.width;break;case"top":n.originalPos=f.top;t=-n.panelHeight;break;case"bottom":n.originalPos=f.top;u=r.getSize();t=u.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(),a=n.gridpanel_padding_border_top,p,l,w,b,y;switch(n.gridpanel_grid_align){case"middle":switch(n.gridpanel_arrows_align_vert){default:l=u.height+n.gridpanel_arrows_padding_vert+h.height;a=(t.panelHeight-l)/2;break;case"border":case"borders":p=t.panelHeight-h.height-n.gridpanel_padding_border_bottom;a=(p-u.height)/2}break;case"bottom":l=u.height+h.height+n.gridpanel_arrows_padding_vert;a=t.panelHeight-l-n.gridpanel_padding_border_bottom}w=i.getElement();b=c();r.placeElement(w,b,a);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"),s=t.grid_padding,k=t.grid_padding,l=k,h=s,c=0,d=0,v=0,a=0,p=0,g,e,u;for(n.innerWidth=0,n.numPanes=1,n.arrPanes=[],n.numThumbsInPane=0,n.arrPanes.push(s-t.grid_padding),g=b.length,i=0;i<g;i++){var w=jQuery(b[i]),y=w.outerWidth(),nt=w.outerHeight();h-s+y>n.gridWidth&&(p++,l=0,p>=t.grid_num_rows?(p=0,s=h,l=k,v=0,n.numPanes==1&&(n.gridWidth=c+t.grid_padding,f.width(n.gridWidth),n.gridHeight=a+t.grid_padding,f.height(n.gridHeight)),n.numPanes++,n.arrPanes.push(s-t.grid_padding)):(h=s,l=v+n.spaceBetweenRows));r.placeElement(w,h,l);u=h+y;u>c&&(c=u);e=l+nt;e>v&&(v=e);e>a&&(a=e);e>d&&(d=e);u=c+y;u>n.innerWidth&&(n.innerWidth=u);h+=y+n.spaceBetweenCols;n.numPanes==1&&n.numThumbsInPane++}n.innerWidth=c+t.grid_padding;n.innerHeight=a+t.grid_padding;o.width(n.innerWidth);o.height(n.innerHeight);n.numPanes==1&&(n.gridWidth=c+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 y=0,s=0,e=[],p=0,c=0,f,r,l,a,u,o,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 r=0,u=0,t,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,b,o,h,v,k,ut,d,y,g,p,nt,tt,et,c,ft,l,it,ot,st,ht,w;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"),b=u.stripTags(f.title),b=u.htmlentitles(b),a+='<img src="'+u.escapeDoubleSlash(f.urlThumb)+"\" alt='"+b+"' 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&&(k="ug-button-play ug-icon-zoom",f.type!="image"&&(k="ug-button-play ug-icon-play"),v+="<div class='ug-tile-icon "+k+"' 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>"),d=t.isSaparateIcons,d==!1&&f.type!="image"&&t.isVideoplayIconAlwaysOn==!0&&(d=!0),y=d?i:i.children(".ug-thumb-overlay"),y.append(v),g=y.children("."+k),g.length==0?g=null:g.hide(),p=y.children(".ug-icon-link"),p.length==0?p=null:p.hide(),p||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"),w=new UGTextPanel,w.init(e,n,"tile"),w.appendHTML(ht),w.setTextPlain(l,it),i.data("objTextPanelClone",w))}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.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),l,s,v,p,c;if(a==0)return!1;l=a>0?"left":"right";s=!1;switch(l){case"right":t.isSlideHasItem(e.objPrevSlide)?(v=i.getElementSize(e.objPrevSlide),c=-v.left):s=!0;break;case"left":t.isSlideHasItem(e.objNextSlide)?(p=i.getElementSize(e.objNextSlide),c=-p.left):s=!0}s==!0?h(e):r.stop().animate({left:c+"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(l);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(),o=i.prop("tagName").toLowerCase(),d="",c,r,l,u,f,y,a,v,s,h,p,w,b,e,k;if(o=="a"&&(d=i.attr("href"),i=i.children(),o=i.prop("tagName").toLowerCase()),c=i.data("type"),c==undefined&&(c="image"),r={},r.type=c,o=="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("alt"),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,o=="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;s=i.data("width");h=i.data("height");s&&typeof s=="number"&&h&&typeof h=="number"&&(r.thumbWidth=s,r.thumbHeight=h,r.thumbRatioByWidth=s/h,r.thumbRatioByHeight=h/s);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,o=="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 l=f.getElementRelativePos(r,"left",i.lightbox_arrows_offset),o=f.getElementRelativePos(r,"middle"),a=f.getElementRelativePos(h,"right",i.lightbox_arrows_offset),v=o;else var s=t.getSlideImage(),y=f.getElementSize(s),k=f.getElementSize(t.getElement()),l=f.getElementRelativePos(r,"left",0,s)+y.left+i.lightbox_arrows_inside_offset,o=f.getElementRelativePos(r,"middle",0,s)+y.top,a=f.getElementRelativePos(r,"right",0,s)+y.left-i.lightbox_arrows_inside_offset,v=o;e===!0?(p={left:l,top:o},b={left:a,top:v},r.stop().animate(p,{duration:n.fadeDuration}),h.stop().animate(b,{duration:n.fadeDuration})):(r.stop(),h.stop(),f.placeElement(r,l,o),f.placeElement(h,a,v));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 u=n.data("index"),f,e,r,o;if(u==undefined)throw new Error("every tile should have index!");for(f=[],e=0;e<t;e++){if(r=i=="prev"?a.getPrevItem(u,!0):a.getNextItem(u,!0),!r)throw new Error("the item to add is empty");o=r.objTileOriginal.clone(!0,!0);u=r.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 i=vt(),r=at(),u=0,e=0,t=0,f=0,s=g(),o;if(i>n.spaceActionSize?(u=h(i),it(u,"left"),n.numCurrent+=u):i<-n.spaceActionSize&&(t=h(Math.abs(i)),rt(t,"left"),n.numCurrent-=t),r>n.spaceActionSize?(e=h(r),it(e,"right")):r<-n.spaceActionSize&&(f=h(Math.abs(r)),rt(f,"right")),f>s)throw new Error("Can't remove more then num tiles");return o=!1,(u||e||t||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(),t;for(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_tiles(){function v(r,s){u=r;n=jQuery.extend(n,a);n=jQuery.extend(n,s);y();u.setOptions(n);u.setFreestyleMode();c=r.getObjects();o=jQuery(r);t=c.g_objWrapper;f.init(r,n);i.init(r,n);e=f.getObjTileDesign()}function y(){n.theme_enable_preloader==!0&&(h.showPreloader=!0);switch(n.theme_appearance_order){case"shuffle":u.shuffleItems();break;case"keep":n.tiles_keep_order=!0}}function p(){t.addClass("ug-theme-tiles");t.append("<div class='ug-tiles-wrapper' style='position:relative'><\/div>");h.showPreloader==!0&&(t.append("<div class='ug-tiles-preloader ug-preloader-trans'><\/div>"),r=t.children(".ug-tiles-preloader"),r.fadeTo(0,0));s=t.children(".ug-tiles-wrapper");n.theme_gallery_padding&&t.css({"padding-left":n.theme_gallery_padding+"px","padding-right":n.theme_gallery_padding+"px"});f.setHtml(s);i.putHtml()}function w(){r&&(r.fadeTo(0,1),t.height(n.theme_preloading_height),l.placeElement(r,"center",n.theme_preloader_vertpos));nt();f.run();i.run()}function b(){p();w()}function k(n,t){t=jQuery(t);var r=e.getItemByTile(t),u=r.index;i.open(u)}function d(){if(s.hide(),r){r.show();var n=l.getElementSize(r),i=n.bottom+30;t.height(i)}}function g(){n.theme_auto_open!==null&&(i.open(n.theme_auto_open),n.theme_auto_open=null)}function nt(){if(r)u.onEvent(f.events.TILES_FIRST_PLACED,function(){t.height("auto");r.hide()});jQuery(e).on(e.events.TILE_CLICK,k);o.on(u.events.GALLERY_BEFORE_REQUEST_ITEMS,d);jQuery(i).on(i.events.LIGHTBOX_INIT,g)}var tt=this,u=new UniteGalleryMain,o,c,t,f=new UGTiles,i=new UGLightbox,r,s,l=new UGFunctions,e=new UGTileDesign,n={theme_enable_preloader:!0,theme_preloading_height:200,theme_preloader_vertpos:100,theme_gallery_padding:0,theme_appearance_order:"normal",theme_auto_open:null},a={gallery_width:"100%"},h={showPreloader:!1};this.destroy=function(){jQuery(e).off(e.events.TILE_CLICK);u.destroyEvent(f.events.TILES_FIRST_PLACED);o.off(u.events.GALLERY_BEFORE_REQUEST_ITEMS);jQuery(i).off(i.events.LIGHTBOX_INIT);f.destroy();i.destroy()};this.run=function(){b()};this.addItems=function(){f.runNewItems()};this.init=function(n,t){v(n,t)}}var g_ugFunctions;(function(n,t){function dt(n){var t=n.length,r=i.type(n);return i.isWindow(n)?!1:1===n.nodeType&&t?!0:"array"===r||"function"!==r&&(0===t||"number"==typeof t&&t>0&&t-1 in n)}function kf(n){var t=gt[n]={};return i.each(n.match(s)||[],function(n,i){t[i]=!0}),t}function ir(n,r,u,f){if(i.acceptData(n)){var s,h,c=i.expando,a="string"==typeof r,l=n.nodeType,o=l?i.cache:n,e=l?n[c]:n[c]&&c;if(e&&o[e]&&(f||o[e].data)||!a||u!==t)return e||(l?n[c]=e=b.pop()||i.guid++:e=c),o[e]||(o[e]={},l||(o[e].toJSON=i.noop)),("object"==typeof r||"function"==typeof r)&&(f?o[e]=i.extend(o[e],r):o[e].data=i.extend(o[e].data,r)),s=o[e],f||(s.data||(s.data={}),s=s.data),u!==t&&(s[i.camelCase(r)]=u),a?(h=s[r],null==h&&(h=s[i.camelCase(r)])):h=s,h}}function rr(n,t,r){if(i.acceptData(n)){var o,h,e,s=n.nodeType,u=s?i.cache:n,f=s?n[i.expando]:i.expando;if(u[f]){if(t&&(e=r?u[f]:u[f].data)){for(i.isArray(t)?t=t.concat(i.map(t,i.camelCase)):(t in e)?t=[t]:(t=i.camelCase(t),t=(t in e)?[t]:t.split(" ")),o=0,h=t.length;h>o;o++)delete e[t[o]];if(!(r?ni:i.isEmptyObject)(e))return}(r||(delete u[f].data,ni(u[f])))&&(s?i.cleanData([n],!0):i.support.deleteExpando||u!=u.window?delete u[f]:u[f]=null)}}}function ur(n,r,u){if(u===t&&1===n.nodeType){var f="data-"+r.replace(tr,"-$1").toLowerCase();if(u=n.getAttribute(f),"string"==typeof u){try{u="true"===u?!0:"false"===u?!1:"null"===u?null:+u+""===u?+u:nr.test(u)?i.parseJSON(u):u}catch(e){}i.data(n,r,u)}else u=t}return u}function ni(n){var t;for(t in n)if(("data"!==t||!i.isEmptyObject(n[t]))&&"toJSON"!==t)return!1;return!0}function ht(){return!0}function d(){return!1}function cr(n,t){do n=n[t];while(n&&1!==n.nodeType);return n}function lr(n,t,r){if(t=t||0,i.isFunction(t))return i.grep(n,function(n,i){var u=!!t.call(n,i,n);return u===r});if(t.nodeType)return i.grep(n,function(n){return n===t===r});if("string"==typeof t){var u=i.grep(n,function(n){return 1===n.nodeType});if(fe.test(t))return i.filter(t,u,!r);t=i.filter(t,u)}return i.grep(n,function(n){return i.inArray(n,t)>=0===r})}function ar(n){var i=vr.split("|"),t=n.createDocumentFragment();if(t.createElement)while(i.length)t.createElement(i.pop());return t}function ye(n,t){return n.getElementsByTagName(t)[0]||n.appendChild(n.ownerDocument.createElement(t))}function dr(n){var t=n.getAttributeNode("type");return n.type=(t&&t.specified)+"/"+n.type,n}function gr(n){var t=le.exec(n.type);return t?n.type=t[1]:n.removeAttribute("type"),n}function si(n,t){for(var u,r=0;null!=(u=n[r]);r++)i._data(u,"globalEval",!t||i._data(t[r],"globalEval"))}function nu(n,t){if(1===t.nodeType&&i.hasData(n)){var u,f,o,s=i._data(n),r=i._data(t,s),e=s.events;if(e){delete r.handle;r.events={};for(u in e)for(f=0,o=e[u].length;o>f;f++)i.event.add(t,u,e[u][f])}r.data&&(r.data=i.extend({},r.data))}}function pe(n,t){var r,f,u;if(1===t.nodeType){if(r=t.nodeName.toLowerCase(),!i.support.noCloneEvent&&t[i.expando]){u=i._data(t);for(f in u.events)i.removeEvent(t,f,u.handle);t.removeAttribute(i.expando)}"script"===r&&t.text!==n.text?(dr(t).text=n.text,gr(t)):"object"===r?(t.parentNode&&(t.outerHTML=n.outerHTML),i.support.html5Clone&&n.innerHTML&&!i.trim(t.innerHTML)&&(t.innerHTML=n.innerHTML)):"input"===r&&ei.test(n.type)?(t.defaultChecked=t.checked=n.checked,t.value!==n.value&&(t.value=n.value)):"option"===r?t.defaultSelected=t.selected=n.defaultSelected:("input"===r||"textarea"===r)&&(t.defaultValue=n.defaultValue)}}function u(n,r){var s,e,h=0,f=typeof n.getElementsByTagName!==o?n.getElementsByTagName(r||"*"):typeof n.querySelectorAll!==o?n.querySelectorAll(r||"*"):t;if(!f)for(f=[],s=n.childNodes||n;null!=(e=s[h]);h++)!r||i.nodeName(e,r)?f.push(e):i.merge(f,u(e,r));return r===t||r&&i.nodeName(n,r)?i.merge([n],f):f}function we(n){ei.test(n.type)&&(n.defaultChecked=n.checked)}function fu(n,t){if(t in n)return t;for(var r=t.charAt(0).toUpperCase()+t.slice(1),u=t,i=uu.length;i--;)if(t=uu[i]+r,t in n)return t;return u}function ut(n,t){return n=t||n,"none"===i.css(n,"display")||!i.contains(n.ownerDocument,n)}function eu(n,t){for(var f,r,o,e=[],u=0,s=n.length;s>u;u++)r=n[u],r.style&&(e[u]=i._data(r,"olddisplay"),f=r.style.display,t?(e[u]||"none"!==f||(r.style.display=""),""===r.style.display&&ut(r)&&(e[u]=i._data(r,"olddisplay",cu(r.nodeName)))):e[u]||(o=ut(r),(f&&"none"!==f||!o)&&i._data(r,"olddisplay",o?f:i.css(r,"display"))));for(u=0;s>u;u++)r=n[u],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?e[u]||"":"none"));return n}function ou(n,t,i){var r=ge.exec(t);return r?Math.max(0,r[1]-(i||0))+(r[2]||"px"):t}function su(n,t,r,u,f){for(var e=r===(u?"border":"content")?4:"width"===t?1:0,o=0;4>e;e+=2)"margin"===r&&(o+=i.css(n,r+p[e],!0,f)),u?("content"===r&&(o-=i.css(n,"padding"+p[e],!0,f)),"margin"!==r&&(o-=i.css(n,"border"+p[e]+"Width",!0,f))):(o+=i.css(n,"padding"+p[e],!0,f),"padding"!==r&&(o+=i.css(n,"border"+p[e]+"Width",!0,f)));return o}function hu(n,t,r){var e=!0,u="width"===t?n.offsetWidth:n.offsetHeight,f=v(n),o=i.support.boxSizing&&"border-box"===i.css(n,"boxSizing",!1,f);if(0>=u||null==u){if(u=y(n,t,f),(0>u||null==u)&&(u=n.style[t]),ct.test(u))return u;e=o&&(i.support.boxSizingReliable||u===n.style[t]);u=parseFloat(u)||0}return u+su(n,t,r||(o?"border":"content"),e,f)+"px"}function cu(n){var u=r,t=iu[n];return t||(t=lu(n,u),"none"!==t&&t||(rt=(rt||i("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(u.documentElement),u=(rt[0].contentWindow||rt[0].contentDocument).document,u.write("<!doctype html><html><body>"),u.close(),t=lu(n,u),rt.detach()),iu[n]=t),t}function lu(n,t){var r=i(t.createElement(n)).appendTo(t.body),u=i.css(r[0],"display");return r.remove(),u}function ci(n,t,r,u){var f;if(i.isArray(t))i.each(t,function(t,i){r||ro.test(n)?u(n,i):ci(n+"["+("object"==typeof i?t:"")+"]",i,r,u)});else if(r||"object"!==i.type(t))u(n,t);else for(f in t)ci(n+"["+f+"]",t[f],r,u)}function ku(n){return function(t,r){"string"!=typeof t&&(r=t,t="*");var u,f=0,e=t.toLowerCase().match(s)||[];if(i.isFunction(r))while(u=e[f++])"+"===u[0]?(u=u.slice(1)||"*",(n[u]=n[u]||[]).unshift(r)):(n[u]=n[u]||[]).push(r)}}function du(n,r,u,f){function o(h){var c;return e[h]=!0,i.each(n[h]||[],function(n,i){var h=i(r,u,f);return"string"!=typeof h||s||e[h]?s?!(c=h):t:(r.dataTypes.unshift(h),o(h),!1)}),c}var e={},s=n===vi;return o(r.dataTypes[0])||!e["*"]&&o("*")}function yi(n,r){var f,u,e=i.ajaxSettings.flatOptions||{};for(u in r)r[u]!==t&&((e[u]?n:f||(f={}))[u]=r[u]);return f&&i.extend(!0,n,f),n}function co(n,i,r){var s,o,e,u,h=n.contents,f=n.dataTypes,c=n.responseFields;for(u in c)u in r&&(i[c[u]]=r[u]);while("*"===f[0])f.shift(),o===t&&(o=n.mimeType||i.getResponseHeader("Content-Type"));if(o)for(u in h)if(h[u]&&h[u].test(o)){f.unshift(u);break}if(f[0]in r)e=f[0];else{for(u in r){if(!f[0]||n.converters[u+" "+f[0]]){e=u;break}s||(s=u)}e=e||s}return e?(e!==f[0]&&f.unshift(e),r[e]):t}function lo(n,t){var o,r,i,e,u={},h=0,s=n.dataTypes.slice(),f=s[0];if(n.dataFilter&&(t=n.dataFilter(t,n.dataType)),s[1])for(i in n.converters)u[i.toLowerCase()]=n.converters[i];for(;r=s[++h];)if("*"!==r){if("*"!==f&&f!==r){if(i=u[f+" "+r]||u["* "+r],!i)for(o in u)if(e=o.split(" "),e[1]===r&&(i=u[f+" "+e[0]]||u["* "+e[0]])){i===!0?i=u[o]:u[o]!==!0&&(r=e[0],s.splice(h--,0,r));break}if(i!==!0)if(i&&n.throws)t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+f+" to "+r}}}f=r}return{state:"success",data:t}}function nf(){try{return new n.XMLHttpRequest}catch(t){}}function ao(){try{return new n.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function tf(){return setTimeout(function(){tt=t}),tt=i.now()}function wo(n,t){i.each(t,function(t,i){for(var u=(ft[t]||[]).concat(ft["*"]),r=0,f=u.length;f>r;r++)if(u[r].call(n,t,i))return})}function rf(n,t,r){var h,e,o=0,l=yt.length,f=i.Deferred().always(function(){delete c.elem}),c=function(){if(e)return!1;for(var s=tt||tf(),t=Math.max(0,u.startTime+u.duration-s),h=t/u.duration||0,i=1-h,r=0,o=u.tweens.length;o>r;r++)u.tweens[r].run(i);return f.notifyWith(n,[u,i,t]),1>i&&o?t:(f.resolveWith(n,[u]),!1)},u=f.promise({elem:n,props:i.extend({},t),opts:i.extend(!0,{specialEasing:{}},r),originalProperties:t,originalOptions:r,startTime:tt||tf(),duration:r.duration,tweens:[],createTween:function(t,r){var f=i.Tween(n,u.opts,t,r,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(f),f},stop:function(t){var i=0,r=t?u.tweens.length:0;if(e)return this;for(e=!0;r>i;i++)u.tweens[i].run(1);return t?f.resolveWith(n,[u,t]):f.rejectWith(n,[u,t]),this}}),s=u.props;for(bo(s,u.opts.specialEasing);l>o;o++)if(h=yt[o].call(u,n,s,u.opts))return h;return wo(u,s),i.isFunction(u.opts.start)&&u.opts.start.call(n,u),i.fx.timer(i.extend(c,{elem:n,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function bo(n,t){var u,f,r,e,o;for(r in n)if(f=i.camelCase(r),e=t[f],u=n[r],i.isArray(u)&&(e=u[1],u=n[r]=u[0]),r!==f&&(n[f]=u,delete n[r]),o=i.cssHooks[f],o&&"expand"in o){u=o.expand(u);delete n[f];for(r in u)r in n||(n[r]=u[r],t[r]=e)}else t[f]=e}function ko(n,t,r){var u,o,w,a,s,v,l,f,b,h=this,e=n.style,y={},p=[],c=n.nodeType&&ut(n);r.queue||(f=i._queueHooks(n,"fx"),null==f.unqueued&&(f.unqueued=0,b=f.empty.fire,f.empty.fire=function(){f.unqueued||b()}),f.unqueued++,h.always(function(){h.always(function(){f.unqueued--;i.queue(n,"fx").length||f.empty.fire()})}));1===n.nodeType&&("height"in t||"width"in t)&&(r.overflow=[e.overflow,e.overflowX,e.overflowY],"inline"===i.css(n,"display")&&"none"===i.css(n,"float")&&(i.support.inlineBlockNeedsLayout&&"inline"!==cu(n.nodeName)?e.zoom=1:e.display="inline-block"));r.overflow&&(e.overflow="hidden",i.support.shrinkWrapBlocks||h.always(function(){e.overflow=r.overflow[0];e.overflowX=r.overflow[1];e.overflowY=r.overflow[2]}));for(o in t)if(a=t[o],vo.exec(a)){if(delete t[o],v=v||"toggle"===a,a===(c?"hide":"show"))continue;p.push(o)}if(w=p.length)for(s=i._data(n,"fxshow")||i._data(n,"fxshow",{}),("hidden"in s)&&(c=s.hidden),v&&(s.hidden=!c),c?i(n).show():h.done(function(){i(n).hide()}),h.done(function(){var t;i._removeData(n,"fxshow");for(t in y)i.style(n,t,y[t])}),o=0;w>o;o++)u=p[o],l=h.createTween(u,c?s[u]:0),y[u]=s[u]||i.style(n,u),u in s||(s[u]=l.start,c&&(l.end=l.start,l.start="width"===u||"height"===u?1:0))}function f(n,t,i,r,u){return new f.prototype.init(n,t,i,r,u)}function pt(n,t){var r,i={height:n},u=0;for(t=t?1:0;4>u;u+=2-t)r=p[u],i["margin"+r]=i["padding"+r]=n;return t&&(i.opacity=i.width=n),i}function uf(n){return i.isWindow(n)?n:9===n.nodeType?n.defaultView||n.parentWindow:!1}var et,wi,o=typeof t,r=n.document,ff=n.location,ef=n.jQuery,of=n.$,ot={},b=[],wt="1.9.1",bi=b.concat,bt=b.push,l=b.slice,ki=b.indexOf,sf=ot.toString,it=ot.hasOwnProperty,kt=wt.trim,i=function(n,t){return new i.fn.init(n,t,wi)},st=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,s=/\S+/g,hf=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,cf=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,di=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,lf=/^[\],:{}\s]*$/,af=/(?:^|:|,)(?:\s*\[)+/g,vf=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,yf=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,pf=/^-ms-/,wf=/-([\da-z])/gi,bf=function(n,t){return t.toUpperCase()},h=function(n){(r.addEventListener||"load"===n.type||"complete"===r.readyState)&&(gi(),i.ready())},gi=function(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",h,!1),n.removeEventListener("load",h,!1)):(r.detachEvent("onreadystatechange",h),n.detachEvent("onload",h))},gt,nr,tr,pi,lt,g,nt,gu,at;i.fn=i.prototype={jquery:wt,constructor:i,init:function(n,u,f){var e,o;if(!n)return this;if("string"==typeof n){if(e="<"===n.charAt(0)&&">"===n.charAt(n.length-1)&&n.length>=3?[null,n,null]:cf.exec(n),!e||!e[1]&&u)return!u||u.jquery?(u||f).find(n):this.constructor(u).find(n);if(e[1]){if(u=u instanceof i?u[0]:u,i.merge(this,i.parseHTML(e[1],u&&u.nodeType?u.ownerDocument||u:r,!0)),di.test(e[1])&&i.isPlainObject(u))for(e in u)i.isFunction(this[e])?this[e](u[e]):this.attr(e,u[e]);return this}if(o=r.getElementById(e[2]),o&&o.parentNode){if(o.id!==e[2])return f.find(n);this.length=1;this[0]=o}return this.context=r,this.selector=n,this}return n.nodeType?(this.context=this[0]=n,this.length=1,this):i.isFunction(n)?f.ready(n):(n.selector!==t&&(this.selector=n.selector,this.context=n.context),i.makeArray(n,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(n){return null==n?this.toArray():0>n?this[this.length+n]:this[n]},pushStack:function(n){var t=i.merge(this.constructor(),n);return t.prevObject=this,t.context=this.context,t},each:function(n,t){return i.each(this,n,t)},ready:function(n){return i.ready.promise().done(n),this},slice:function(){return this.pushStack(l.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(n){var i=this.length,t=+n+(0>n?i:0);return this.pushStack(t>=0&&i>t?[this[t]]:[])},map:function(n){return this.pushStack(i.map(this,function(t,i){return n.call(t,i,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:bt,sort:[].sort,splice:[].splice};i.fn.init.prototype=i.fn;i.extend=i.fn.extend=function(){var u,o,r,e,s,h,n=arguments[0]||{},f=1,l=arguments.length,c=!1;for("boolean"==typeof n&&(c=n,n=arguments[1]||{},f=2),"object"==typeof n||i.isFunction(n)||(n={}),l===f&&(n=this,--f);l>f;f++)if(null!=(s=arguments[f]))for(e in s)u=n[e],r=s[e],n!==r&&(c&&r&&(i.isPlainObject(r)||(o=i.isArray(r)))?(o?(o=!1,h=u&&i.isArray(u)?u:[]):h=u&&i.isPlainObject(u)?u:{},n[e]=i.extend(c,h,r)):r!==t&&(n[e]=r));return n};i.extend({noConflict:function(t){return n.$===i&&(n.$=of),t&&n.jQuery===i&&(n.jQuery=ef),i},isReady:!1,readyWait:1,holdReady:function(n){n?i.readyWait++:i.ready(!0)},ready:function(n){if(n===!0?!--i.readyWait:!i.isReady){if(!r.body)return setTimeout(i.ready);i.isReady=!0;n!==!0&&--i.readyWait>0||(et.resolveWith(r,[i]),i.fn.trigger&&i(r).trigger("ready").off("ready"))}},isFunction:function(n){return"function"===i.type(n)},isArray:Array.isArray||function(n){return"array"===i.type(n)},isWindow:function(n){return null!=n&&n==n.window},isNumeric:function(n){return!isNaN(parseFloat(n))&&isFinite(n)},type:function(n){return null==n?n+"":"object"==typeof n||"function"==typeof n?ot[sf.call(n)]||"object":typeof n},isPlainObject:function(n){if(!n||"object"!==i.type(n)||n.nodeType||i.isWindow(n))return!1;try{if(n.constructor&&!it.call(n,"constructor")&&!it.call(n.constructor.prototype,"isPrototypeOf"))return!1}catch(u){return!1}var r;for(r in n);return r===t||it.call(n,r)},isEmptyObject:function(n){var t;for(t in n)return!1;return!0},error:function(n){throw Error(n);},parseHTML:function(n,t,u){if(!n||"string"!=typeof n)return null;"boolean"==typeof t&&(u=t,t=!1);t=t||r;var f=di.exec(n),e=!u&&[];return f?[t.createElement(f[1])]:(f=i.buildFragment([n],t,e),e&&i(e).remove(),i.merge([],f.childNodes))},parseJSON:function(r){return n.JSON&&n.JSON.parse?n.JSON.parse(r):null===r?r:"string"==typeof r&&(r=i.trim(r),r&&lf.test(r.replace(vf,"@").replace(yf,"]").replace(af,"")))?Function("return "+r)():(i.error("Invalid JSON: "+r),t)},parseXML:function(r){var u,f;if(!r||"string"!=typeof r)return null;try{n.DOMParser?(f=new DOMParser,u=f.parseFromString(r,"text/xml")):(u=new ActiveXObject("Microsoft.XMLDOM"),u.async="false",u.loadXML(r))}catch(e){u=t}return u&&u.documentElement&&!u.getElementsByTagName("parsererror").length||i.error("Invalid XML: "+r),u},noop:function(){},globalEval:function(t){t&&i.trim(t)&&(n.execScript||function(t){n.eval.call(n,t)})(t)},camelCase:function(n){return n.replace(pf,"ms-").replace(wf,bf)},nodeName:function(n,t){return n.nodeName&&n.nodeName.toLowerCase()===t.toLowerCase()},each:function(n,t,i){var u,r=0,f=n.length,e=dt(n);if(i){if(e){for(;f>r;r++)if(u=t.apply(n[r],i),u===!1)break}else for(r in n)if(u=t.apply(n[r],i),u===!1)break}else if(e){for(;f>r;r++)if(u=t.call(n[r],r,n[r]),u===!1)break}else for(r in n)if(u=t.call(n[r],r,n[r]),u===!1)break;return n},trim:kt&&!kt.call("﻿ ")?function(n){return null==n?"":kt.call(n)}:function(n){return null==n?"":(n+"").replace(hf,"")},makeArray:function(n,t){var r=t||[];return null!=n&&(dt(Object(n))?i.merge(r,"string"==typeof n?[n]:n):bt.call(r,n)),r},inArray:function(n,t,i){var r;if(t){if(ki)return ki.call(t,n,i);for(r=t.length,i=i?0>i?Math.max(0,r+i):i:0;r>i;i++)if(i in t&&t[i]===n)return i}return-1},merge:function(n,i){var f=i.length,u=n.length,r=0;if("number"==typeof f)for(;f>r;r++)n[u++]=i[r];else while(i[r]!==t)n[u++]=i[r++];return n.length=u,n},grep:function(n,t,i){var u,f=[],r=0,e=n.length;for(i=!!i;e>r;r++)u=!!t(n[r],r),i!==u&&f.push(n[r]);return f},map:function(n,t,i){var u,r=0,e=n.length,o=dt(n),f=[];if(o)for(;e>r;r++)u=t(n[r],r,i),null!=u&&(f[f.length]=u);else for(r in n)u=t(n[r],r,i),null!=u&&(f[f.length]=u);return bi.apply([],f)},guid:1,proxy:function(n,r){var f,u,e;return"string"==typeof r&&(e=n[r],r=n,n=e),i.isFunction(n)?(f=l.call(arguments,2),u=function(){return n.apply(r||this,f.concat(l.call(arguments)))},u.guid=n.guid=n.guid||i.guid++,u):t},access:function(n,r,u,f,e,o,s){var h=0,l=n.length,c=null==u;if("object"===i.type(u)){e=!0;for(h in u)i.access(n,r,h,u[h],!0,o,s)}else if(f!==t&&(e=!0,i.isFunction(f)||(s=!0),c&&(s?(r.call(n,f),r=null):(c=r,r=function(n,t,r){return c.call(i(n),r)})),r))for(;l>h;h++)r(n[h],u,s?f:f.call(n[h],h,r(n[h],u)));return e?n:c?r.call(n):l?r(n[0],u):o},now:function(){return(new Date).getTime()}});i.ready.promise=function(t){if(!et)if(et=i.Deferred(),"complete"===r.readyState)setTimeout(i.ready);else if(r.addEventListener)r.addEventListener("DOMContentLoaded",h,!1),n.addEventListener("load",h,!1);else{r.attachEvent("onreadystatechange",h);n.attachEvent("onload",h);var u=!1;try{u=null==n.frameElement&&r.documentElement}catch(e){}u&&u.doScroll&&function f(){if(!i.isReady){try{u.doScroll("left")}catch(n){return setTimeout(f,50)}gi();i.ready()}}()}return et.promise(t)};i.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(n,t){ot["[object "+t+"]"]=t.toLowerCase()});wi=i(r);gt={};i.Callbacks=function(n){n="string"==typeof n?gt[n]||kf(n):i.extend({},n);var o,f,c,s,e,l,r=[],u=!n.once&&[],a=function(t){for(f=n.memory&&t,c=!0,e=l||0,l=0,s=r.length,o=!0;r&&s>e;e++)if(r[e].apply(t[0],t[1])===!1&&n.stopOnFalse){f=!1;break}o=!1;r&&(u?u.length&&a(u.shift()):f?r=[]:h.disable())},h={add:function(){if(r){var t=r.length;(function u(t){i.each(t,function(t,f){var e=i.type(f);"function"===e?n.unique&&h.has(f)||r.push(f):f&&f.length&&"string"!==e&&u(f)})})(arguments);o?s=r.length:f&&(l=t,a(f))}return this},remove:function(){return r&&i.each(arguments,function(n,t){for(var u;(u=i.inArray(t,r,u))>-1;)r.splice(u,1),o&&(s>=u&&s--,e>=u&&e--)}),this},has:function(n){return n?i.inArray(n,r)>-1:!(!r||!r.length)},empty:function(){return r=[],this},disable:function(){return r=u=f=t,this},disabled:function(){return!r},lock:function(){return u=t,f||h.disable(),this},locked:function(){return!u},fireWith:function(n,t){return t=t||[],t=[n,t.slice?t.slice():t],!r||c&&!u||(o?u.push(t):a(t)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!c}};return h};i.extend({Deferred:function(n){var u=[["resolve","done",i.Callbacks("once memory"),"resolved"],["reject","fail",i.Callbacks("once memory"),"rejected"],["notify","progress",i.Callbacks("memory")]],f="pending",r={state:function(){return f},always:function(){return t.done(arguments).fail(arguments),this},then:function(){var n=arguments;return i.Deferred(function(f){i.each(u,function(u,e){var s=e[0],o=i.isFunction(n[u])&&n[u];t[e[1]](function(){var n=o&&o.apply(this,arguments);n&&i.isFunction(n.promise)?n.promise().done(f.resolve).fail(f.reject).progress(f.notify):f[s+"With"](this===r?f.promise():this,o?[n]:arguments)})});n=null}).promise()},promise:function(n){return null!=n?i.extend(n,r):r}},t={};return r.pipe=r.then,i.each(u,function(n,i){var e=i[2],o=i[3];r[i[1]]=e.add;o&&e.add(function(){f=o},u[1^n][2].disable,u[2][2].lock);t[i[0]]=function(){return t[i[0]+"With"](this===t?r:this,arguments),this};t[i[0]+"With"]=e.fireWith}),r.promise(t),n&&n.call(t,t),t},when:function(n){var t=0,u=l.call(arguments),r=u.length,e=1!==r||n&&i.isFunction(n.promise)?r:0,f=1===e?n:i.Deferred(),h=function(n,t,i){return function(r){t[n]=this;i[n]=arguments.length>1?l.call(arguments):r;i===o?f.notifyWith(t,i):--e||f.resolveWith(t,i)}},o,c,s;if(r>1)for(o=Array(r),c=Array(r),s=Array(r);r>t;t++)u[t]&&i.isFunction(u[t].promise)?u[t].promise().done(h(t,s,u)).fail(f.reject).progress(h(t,c,o)):--e;return e||f.resolveWith(s,u),f.promise()}});i.support=function(){var u,s,e,f,h,c,l,a,y,v,t=r.createElement("div");if(t.setAttribute("className","t"),t.innerHTML="  <link/><table><\/table><a href='/a'>a<\/a><input type='checkbox'/>",s=t.getElementsByTagName("*"),e=t.getElementsByTagName("a")[0],!s||!e||!s.length)return{};h=r.createElement("select");l=h.appendChild(r.createElement("option"));f=t.getElementsByTagName("input")[0];e.style.cssText="top:1px;float:left;opacity:.5";u={getSetAttribute:"t"!==t.className,leadingWhitespace:3===t.firstChild.nodeType,tbody:!t.getElementsByTagName("tbody").length,htmlSerialize:!!t.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:"/a"===e.getAttribute("href"),opacity:/^0.5/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:!!f.value,optSelected:l.selected,enctype:!!r.createElement("form").enctype,html5Clone:"<:nav><\/:nav>"!==r.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===r.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1};f.checked=!0;u.noCloneChecked=f.cloneNode(!0).checked;h.disabled=!0;u.optDisabled=!l.disabled;try{delete t.test}catch(p){u.deleteExpando=!1}f=r.createElement("input");f.setAttribute("value","");u.input=""===f.getAttribute("value");f.value="t";f.setAttribute("type","radio");u.radioValue="t"===f.value;f.setAttribute("checked","t");f.setAttribute("name","t");c=r.createDocumentFragment();c.appendChild(f);u.appendChecked=f.checked;u.checkClone=c.cloneNode(!0).cloneNode(!0).lastChild.checked;t.attachEvent&&(t.attachEvent("onclick",function(){u.noCloneEvent=!1}),t.cloneNode(!0).click());for(v in{submit:!0,change:!0,focusin:!0})t.setAttribute(a="on"+v,"t"),u[v+"Bubbles"]=a in n||t.attributes[a].expando===!1;return t.style.backgroundClip="content-box",t.cloneNode(!0).style.backgroundClip="",u.clearCloneStyle="content-box"===t.style.backgroundClip,i(function(){var e,f,i,h="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",s=r.getElementsByTagName("body")[0];s&&(e=r.createElement("div"),e.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",s.appendChild(e).appendChild(t),t.innerHTML="<table><tr><td><\/td><td>t<\/td><\/tr><\/table>",i=t.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",y=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",u.reliableHiddenOffsets=y&&0===i[0].offsetHeight,t.innerHTML="",t.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",u.boxSizing=4===t.offsetWidth,u.doesNotIncludeMarginInBodyOffset=1!==s.offsetTop,n.getComputedStyle&&(u.pixelPosition="1%"!==(n.getComputedStyle(t,null)||{}).top,u.boxSizingReliable="4px"===(n.getComputedStyle(t,null)||{width:"4px"}).width,f=t.appendChild(r.createElement("div")),f.style.cssText=t.style.cssText=h,f.style.marginRight=f.style.width="0",t.style.width="1px",u.reliableMarginRight=!parseFloat((n.getComputedStyle(f,null)||{}).marginRight)),typeof t.style.zoom!==o&&(t.innerHTML="",t.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",u.inlineBlockNeedsLayout=3===t.offsetWidth,t.style.display="block",t.innerHTML="<div><\/div>",t.firstChild.style.width="5px",u.shrinkWrapBlocks=3!==t.offsetWidth,u.inlineBlockNeedsLayout&&(s.style.zoom=1)),s.removeChild(e),e=t=i=f=null)}),s=h=c=l=e=f=null,u}();nr=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/;tr=/([A-Z])/g;i.extend({cache:{},expando:"jQuery"+(wt+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(n){return n=n.nodeType?i.cache[n[i.expando]]:n[i.expando],!!n&&!ni(n)},data:function(n,t,i){return ir(n,t,i)},removeData:function(n,t){return rr(n,t)},_data:function(n,t,i){return ir(n,t,i,!0)},_removeData:function(n,t){return rr(n,t,!0)},acceptData:function(n){if(n.nodeType&&1!==n.nodeType&&9!==n.nodeType)return!1;var t=n.nodeName&&i.noData[n.nodeName.toLowerCase()];return!t||t!==!0&&n.getAttribute("classid")===t}});i.fn.extend({data:function(n,r){var e,f,u=this[0],o=0,s=null;if(n===t){if(this.length&&(s=i.data(u),1===u.nodeType&&!i._data(u,"parsedAttrs"))){for(e=u.attributes;e.length>o;o++)f=e[o].name,f.indexOf("data-")||(f=i.camelCase(f.slice(5)),ur(u,f,s[f]));i._data(u,"parsedAttrs",!0)}return s}return"object"==typeof n?this.each(function(){i.data(this,n)}):i.access(this,function(r){return r===t?u?ur(u,n,i.data(u,n)):null:(this.each(function(){i.data(this,n,r)}),t)},null,r,arguments.length>1,null,!0)},removeData:function(n){return this.each(function(){i.removeData(this,n)})}});i.extend({queue:function(n,r,u){var f;return n?(r=(r||"fx")+"queue",f=i._data(n,r),u&&(!f||i.isArray(u)?f=i._data(n,r,i.makeArray(u)):f.push(u)),f||[]):t},dequeue:function(n,t){t=t||"fx";var f=i.queue(n,t),e=f.length,r=f.shift(),u=i._queueHooks(n,t),o=function(){i.dequeue(n,t)};"inprogress"===r&&(r=f.shift(),e--);u.cur=r;r&&("fx"===t&&f.unshift("inprogress"),delete u.stop,r.call(n,o,u));!e&&u&&u.empty.fire()},_queueHooks:function(n,t){var r=t+"queueHooks";return i._data(n,r)||i._data(n,r,{empty:i.Callbacks("once memory").add(function(){i._removeData(n,t+"queue");i._removeData(n,r)})})}});i.fn.extend({queue:function(n,r){var u=2;return"string"!=typeof n&&(r=n,n="fx",u--),u>arguments.length?i.queue(this[0],n):r===t?this:this.each(function(){var t=i.queue(this,n,r);i._queueHooks(this,n);"fx"===n&&"inprogress"!==t[0]&&i.dequeue(this,n)})},dequeue:function(n){return this.each(function(){i.dequeue(this,n)})},delay:function(n,t){return n=i.fx?i.fx.speeds[n]||n:n,t=t||"fx",this.queue(t,function(t,i){var r=setTimeout(t,n);i.stop=function(){clearTimeout(r)}})},clearQueue:function(n){return this.queue(n||"fx",[])},promise:function(n,r){var u,e=1,o=i.Deferred(),f=this,s=this.length,h=function(){--e||o.resolveWith(f,[f])};for("string"!=typeof n&&(r=n,n=t),n=n||"fx";s--;)u=i._data(f[s],n+"queueHooks"),u&&u.empty&&(e++,u.empty.add(h));return h(),o.promise(r)}});var k,fr,ti=/[\t\r\n]/g,df=/\r/g,gf=/^(?:input|select|textarea|button|object)$/i,ne=/^(?:a|area)$/i,er=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,ii=/^(?:checked|selected)$/i,a=i.support.getSetAttribute,ri=i.support.input;i.fn.extend({attr:function(n,t){return i.access(this,i.attr,n,t,arguments.length>1)},removeAttr:function(n){return this.each(function(){i.removeAttr(this,n)})},prop:function(n,t){return i.access(this,i.prop,n,t,arguments.length>1)},removeProp:function(n){return n=i.propFix[n]||n,this.each(function(){try{this[n]=t;delete this[n]}catch(i){}})},addClass:function(n){var e,t,r,u,o,f=0,h=this.length,c="string"==typeof n&&n;if(i.isFunction(n))return this.each(function(t){i(this).addClass(n.call(this,t,this.className))});if(c)for(e=(n||"").match(s)||[];h>f;f++)if(t=this[f],r=1===t.nodeType&&(t.className?(" "+t.className+" ").replace(ti," "):" ")){for(o=0;u=e[o++];)0>r.indexOf(" "+u+" ")&&(r+=u+" ");t.className=i.trim(r)}return this},removeClass:function(n){var e,t,r,u,o,f=0,h=this.length,c=0===arguments.length||"string"==typeof n&&n;if(i.isFunction(n))return this.each(function(t){i(this).removeClass(n.call(this,t,this.className))});if(c)for(e=(n||"").match(s)||[];h>f;f++)if(t=this[f],r=1===t.nodeType&&(t.className?(" "+t.className+" ").replace(ti," "):"")){for(o=0;u=e[o++];)while(r.indexOf(" "+u+" ")>=0)r=r.replace(" "+u+" "," ");t.className=n?i.trim(r):""}return this},toggleClass:function(n,t){var r=typeof n,u="boolean"==typeof t;return i.isFunction(n)?this.each(function(r){i(this).toggleClass(n.call(this,r,this.className,t),t)}):this.each(function(){if("string"===r)for(var f,c=0,h=i(this),e=t,l=n.match(s)||[];f=l[c++];)e=u?e:!h.hasClass(f),h[e?"addClass":"removeClass"](f);else(r===o||"boolean"===r)&&(this.className&&i._data(this,"__className__",this.className),this.className=this.className||n===!1?"":i._data(this,"__className__")||"")})},hasClass:function(n){for(var i=" "+n+" ",t=0,r=this.length;r>t;t++)if(1===this[t].nodeType&&(" "+this[t].className+" ").replace(ti," ").indexOf(i)>=0)return!0;return!1},val:function(n){var u,r,e,f=this[0];return arguments.length?(e=i.isFunction(n),this.each(function(u){var f,o=i(this);1===this.nodeType&&(f=e?n.call(this,u,o.val()):n,null==f?f="":"number"==typeof f?f+="":i.isArray(f)&&(f=i.map(f,function(n){return null==n?"":n+""})),r=i.valHooks[this.type]||i.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,f,"value")!==t||(this.value=f))})):f?(r=i.valHooks[f.type]||i.valHooks[f.nodeName.toLowerCase()],r&&"get"in r&&(u=r.get(f,"value"))!==t?u:(u=f.value,"string"==typeof u?u.replace(df,""):null==u?"":u)):void 0}});i.extend({valHooks:{option:{get:function(n){var t=n.attributes.value;return!t||t.specified?n.value:n.text}},select:{get:function(n){for(var e,t,o=n.options,r=n.selectedIndex,u="select-one"===n.type||0>r,s=u?null:[],h=u?r+1:o.length,f=0>r?h:u?r:0;h>f;f++)if(t=o[f],!(!t.selected&&f!==r||(i.support.optDisabled?t.disabled:null!==t.getAttribute("disabled"))||t.parentNode.disabled&&i.nodeName(t.parentNode,"optgroup"))){if(e=i(t).val(),u)return e;s.push(e)}return s},set:function(n,t){var r=i.makeArray(t);return i(n).find("option").each(function(){this.selected=i.inArray(i(this).val(),r)>=0}),r.length||(n.selectedIndex=-1),r}}},attr:function(n,r,u){var f,s,e,h=n.nodeType;if(n&&3!==h&&8!==h&&2!==h)return typeof n.getAttribute===o?i.prop(n,r,u):(s=1!==h||!i.isXMLDoc(n),s&&(r=r.toLowerCase(),f=i.attrHooks[r]||(er.test(r)?fr:k)),u===t?f&&s&&"get"in f&&null!==(e=f.get(n,r))?e:(typeof n.getAttribute!==o&&(e=n.getAttribute(r)),null==e?t:e):null!==u?f&&s&&"set"in f&&(e=f.set(n,u,r))!==t?e:(n.setAttribute(r,u+""),u):(i.removeAttr(n,r),t))},removeAttr:function(n,t){var r,u,e=0,f=t&&t.match(s);if(f&&1===n.nodeType)while(r=f[e++])u=i.propFix[r]||r,er.test(r)?!a&&ii.test(r)?n[i.camelCase("default-"+r)]=n[u]=!1:n[u]=!1:i.attr(n,r,""),n.removeAttribute(a?r:u)},attrHooks:{type:{set:function(n,t){if(!i.support.radioValue&&"radio"===t&&i.nodeName(n,"input")){var r=n.value;return n.setAttribute("type",t),r&&(n.value=r),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(n,r,u){var e,f,s,o=n.nodeType;if(n&&3!==o&&8!==o&&2!==o)return s=1!==o||!i.isXMLDoc(n),s&&(r=i.propFix[r]||r,f=i.propHooks[r]),u!==t?f&&"set"in f&&(e=f.set(n,u,r))!==t?e:n[r]=u:f&&"get"in f&&null!==(e=f.get(n,r))?e:n[r]},propHooks:{tabIndex:{get:function(n){var i=n.getAttributeNode("tabindex");return i&&i.specified?parseInt(i.value,10):gf.test(n.nodeName)||ne.test(n.nodeName)&&n.href?0:t}}}});fr={get:function(n,r){var u=i.prop(n,r),f="boolean"==typeof u&&n.getAttribute(r),e="boolean"==typeof u?ri&&a?null!=f:ii.test(r)?n[i.camelCase("default-"+r)]:!!f:n.getAttributeNode(r);return e&&e.value!==!1?r.toLowerCase():t},set:function(n,t,r){return t===!1?i.removeAttr(n,r):ri&&a||!ii.test(r)?n.setAttribute(!a&&i.propFix[r]||r,r):n[i.camelCase("default-"+r)]=n[r]=!0,r}};ri&&a||(i.attrHooks.value={get:function(n,r){var u=n.getAttributeNode(r);return i.nodeName(n,"input")?n.defaultValue:u&&u.specified?u.value:t},set:function(n,r,u){return i.nodeName(n,"input")?(n.defaultValue=r,t):k&&k.set(n,r,u)}});a||(k=i.valHooks.button={get:function(n,i){var r=n.getAttributeNode(i);return r&&("id"===i||"name"===i||"coords"===i?""!==r.value:r.specified)?r.value:t},set:function(n,i,r){var u=n.getAttributeNode(r);return u||n.setAttributeNode(u=n.ownerDocument.createAttribute(r)),u.value=i+="","value"===r||i===n.getAttribute(r)?i:t}},i.attrHooks.contenteditable={get:k.get,set:function(n,t,i){k.set(n,""===t?!1:t,i)}},i.each(["width","height"],function(n,r){i.attrHooks[r]=i.extend(i.attrHooks[r],{set:function(n,i){return""===i?(n.setAttribute(r,"auto"),i):t}})}));i.support.hrefNormalized||(i.each(["href","src","width","height"],function(n,r){i.attrHooks[r]=i.extend(i.attrHooks[r],{get:function(n){var i=n.getAttribute(r,2);return null==i?t:i}})}),i.each(["href","src"],function(n,t){i.propHooks[t]={get:function(n){return n.getAttribute(t,4)}}}));i.support.style||(i.attrHooks.style={get:function(n){return n.style.cssText||t},set:function(n,t){return n.style.cssText=t+""}});i.support.optSelected||(i.propHooks.selected=i.extend(i.propHooks.selected,{get:function(n){var t=n.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}));i.support.enctype||(i.propFix.enctype="encoding");i.support.checkOn||i.each(["radio","checkbox"],function(){i.valHooks[this]={get:function(n){return null===n.getAttribute("value")?"on":n.value}}});i.each(["radio","checkbox"],function(){i.valHooks[this]=i.extend(i.valHooks[this],{set:function(n,r){return i.isArray(r)?n.checked=i.inArray(i(n).val(),r)>=0:t}})});var ui=/^(?:input|select|textarea)$/i,te=/^key/,ie=/^(?:mouse|contextmenu)|click/,or=/^(?:focusinfocus|focusoutblur)$/,sr=/^([^.]*)(?:\.(.+)|)$/;i.event={global:{},add:function(n,r,u,f,e){var b,p,k,w,c,l,a,v,h,d,g,y=i._data(n);if(y){for(u.handler&&(w=u,u=w.handler,e=w.selector),u.guid||(u.guid=i.guid++),(p=y.events)||(p=y.events={}),(l=y.handle)||(l=y.handle=function(n){return typeof i===o||n&&i.event.triggered===n.type?t:i.event.dispatch.apply(l.elem,arguments)},l.elem=n),r=(r||"").match(s)||[""],k=r.length;k--;)b=sr.exec(r[k])||[],h=g=b[1],d=(b[2]||"").split(".").sort(),c=i.event.special[h]||{},h=(e?c.delegateType:c.bindType)||h,c=i.event.special[h]||{},a=i.extend({type:h,origType:g,data:f,handler:u,guid:u.guid,selector:e,needsContext:e&&i.expr.match.needsContext.test(e),namespace:d.join(".")},w),(v=p[h])||(v=p[h]=[],v.delegateCount=0,c.setup&&c.setup.call(n,f,d,l)!==!1||(n.addEventListener?n.addEventListener(h,l,!1):n.attachEvent&&n.attachEvent("on"+h,l))),c.add&&(c.add.call(n,a),a.handler.guid||(a.handler.guid=u.guid)),e?v.splice(v.delegateCount++,0,a):v.push(a),i.event.global[h]=!0;n=null}},remove:function(n,t,r,u,f){var y,o,h,b,p,a,c,l,e,w,k,v=i.hasData(n)&&i._data(n);if(v&&(a=v.events)){for(t=(t||"").match(s)||[""],p=t.length;p--;)if(h=sr.exec(t[p])||[],e=k=h[1],w=(h[2]||"").split(".").sort(),e){for(c=i.event.special[e]||{},e=(u?c.delegateType:c.bindType)||e,l=a[e]||[],h=h[2]&&RegExp("(^|\\.)"+w.join("\\.(?:.*\\.|)")+"(\\.|$)"),b=y=l.length;y--;)o=l[y],!f&&k!==o.origType||r&&r.guid!==o.guid||h&&!h.test(o.namespace)||u&&u!==o.selector&&("**"!==u||!o.selector)||(l.splice(y,1),o.selector&&l.delegateCount--,c.remove&&c.remove.call(n,o));b&&!l.length&&(c.teardown&&c.teardown.call(n,w,v.handle)!==!1||i.removeEvent(n,e,v.handle),delete a[e])}else for(e in a)i.event.remove(n,e+t[p],r,u,!0);i.isEmptyObject(a)&&(delete v.handle,i._removeData(n,"events"))}},trigger:function(u,f,e,o){var a,v,h,p,l,c,w,b=[e||r],s=it.call(u,"type")?u.type:u,y=it.call(u,"namespace")?u.namespace.split("."):[];if(h=c=e=e||r,3!==e.nodeType&&8!==e.nodeType&&!or.test(s+i.event.triggered)&&(s.indexOf(".")>=0&&(y=s.split("."),s=y.shift(),y.sort()),v=0>s.indexOf(":")&&"on"+s,u=u[i.expando]?u:new i.Event(s,"object"==typeof u&&u),u.isTrigger=!0,u.namespace=y.join("."),u.namespace_re=u.namespace?RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u.result=t,u.target||(u.target=e),f=null==f?[u]:i.makeArray(f,[u]),l=i.event.special[s]||{},o||!l.trigger||l.trigger.apply(e,f)!==!1)){if(!o&&!l.noBubble&&!i.isWindow(e)){for(p=l.delegateType||s,or.test(p+s)||(h=h.parentNode);h;h=h.parentNode)b.push(h),c=h;c===(e.ownerDocument||r)&&b.push(c.defaultView||c.parentWindow||n)}for(w=0;(h=b[w++])&&!u.isPropagationStopped();)u.type=w>1?p:l.bindType||s,a=(i._data(h,"events")||{})[u.type]&&i._data(h,"handle"),a&&a.apply(h,f),a=v&&h[v],a&&i.acceptData(h)&&a.apply&&a.apply(h,f)===!1&&u.preventDefault();if(u.type=s,!(o||u.isDefaultPrevented()||l._default&&l._default.apply(e.ownerDocument,f)!==!1||"click"===s&&i.nodeName(e,"a")||!i.acceptData(e)||!v||!e[s]||i.isWindow(e))){c=e[v];c&&(e[v]=null);i.event.triggered=s;try{e[s]()}catch(k){}i.event.triggered=t;c&&(e[v]=c)}return u.result}},dispatch:function(n){n=i.event.fix(n);var o,e,r,u,s,h=[],c=l.call(arguments),a=(i._data(this,"events")||{})[n.type]||[],f=i.event.special[n.type]||{};if(c[0]=n,n.delegateTarget=this,!f.preDispatch||f.preDispatch.call(this,n)!==!1){for(h=i.event.handlers.call(this,n,a),o=0;(u=h[o++])&&!n.isPropagationStopped();)for(n.currentTarget=u.elem,s=0;(r=u.handlers[s++])&&!n.isImmediatePropagationStopped();)(!n.namespace_re||n.namespace_re.test(r.namespace))&&(n.handleObj=r,n.data=r.data,e=((i.event.special[r.origType]||{}).handle||r.handler).apply(u.elem,c),e!==t&&(n.result=e)===!1&&(n.preventDefault(),n.stopPropagation()));return f.postDispatch&&f.postDispatch.call(this,n),n.result}},handlers:function(n,r){var e,o,f,s,c=[],h=r.delegateCount,u=n.target;if(h&&u.nodeType&&(!n.button||"click"!==n.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==n.type)){for(f=[],s=0;h>s;s++)o=r[s],e=o.selector+" ",f[e]===t&&(f[e]=o.needsContext?i(e,this).index(u)>=0:i.find(e,this,null,[u]).length),f[e]&&f.push(o);f.length&&c.push({elem:u,handlers:f})}return r.length>h&&c.push({elem:this,handlers:r.slice(h)}),c},fix:function(n){if(n[i.expando])return n;var e,o,s,u=n.type,f=n,t=this.fixHooks[u];for(t||(this.fixHooks[u]=t=ie.test(u)?this.mouseHooks:te.test(u)?this.keyHooks:{}),s=t.props?this.props.concat(t.props):this.props,n=new i.Event(f),e=s.length;e--;)o=s[e],n[o]=f[o];return n.target||(n.target=f.srcElement||r),3===n.target.nodeType&&(n.target=n.target.parentNode),n.metaKey=!!n.metaKey,t.filter?t.filter(n,f):n},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(n,t){return null==n.which&&(n.which=null!=t.charCode?t.charCode:t.keyCode),n}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(n,i){var u,o,f,e=i.button,s=i.fromElement;return null==n.pageX&&null!=i.clientX&&(o=n.target.ownerDocument||r,f=o.documentElement,u=o.body,n.pageX=i.clientX+(f&&f.scrollLeft||u&&u.scrollLeft||0)-(f&&f.clientLeft||u&&u.clientLeft||0),n.pageY=i.clientY+(f&&f.scrollTop||u&&u.scrollTop||0)-(f&&f.clientTop||u&&u.clientTop||0)),!n.relatedTarget&&s&&(n.relatedTarget=s===n.target?i.toElement:s),n.which||e===t||(n.which=1&e?1:2&e?3:4&e?2:0),n}},special:{load:{noBubble:!0},click:{trigger:function(){return i.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==r.activeElement&&this.focus)try{return this.focus(),!1}catch(n){}},delegateType:"focusin"},blur:{trigger:function(){return this===r.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(n){n.result!==t&&(n.originalEvent.returnValue=n.result)}}},simulate:function(n,t,r,u){var f=i.extend(new i.Event,r,{type:n,isSimulated:!0,originalEvent:{}});u?i.event.trigger(f,null,t):i.event.dispatch.call(t,f);f.isDefaultPrevented()&&r.preventDefault()}};i.removeEvent=r.removeEventListener?function(n,t,i){n.removeEventListener&&n.removeEventListener(t,i,!1)}:function(n,t,i){var r="on"+t;n.detachEvent&&(typeof n[r]===o&&(n[r]=null),n.detachEvent(r,i))};i.Event=function(n,r){return this instanceof i.Event?(n&&n.type?(this.originalEvent=n,this.type=n.type,this.isDefaultPrevented=n.defaultPrevented||n.returnValue===!1||n.getPreventDefault&&n.getPreventDefault()?ht:d):this.type=n,r&&i.extend(this,r),this.timeStamp=n&&n.timeStamp||i.now(),this[i.expando]=!0,t):new i.Event(n,r)};i.Event.prototype={isDefaultPrevented:d,isPropagationStopped:d,isImmediatePropagationStopped:d,preventDefault:function(){var n=this.originalEvent;this.isDefaultPrevented=ht;n&&(n.preventDefault?n.preventDefault():n.returnValue=!1)},stopPropagation:function(){var n=this.originalEvent;this.isPropagationStopped=ht;n&&(n.stopPropagation&&n.stopPropagation(),n.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ht;this.stopPropagation()}};i.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(n,t){i.event.special[n]={delegateType:t,bindType:t,handle:function(n){var u,f=this,r=n.relatedTarget,e=n.handleObj;return(!r||r!==f&&!i.contains(f,r))&&(n.type=e.origType,u=e.handler.apply(this,arguments),n.type=t),u}}});i.support.submitBubbles||(i.event.special.submit={setup:function(){return i.nodeName(this,"form")?!1:(i.event.add(this,"click._submit keypress._submit",function(n){var u=n.target,r=i.nodeName(u,"input")||i.nodeName(u,"button")?u.form:t;r&&!i._data(r,"submitBubbles")&&(i.event.add(r,"submit._submit",function(n){n._submit_bubble=!0}),i._data(r,"submitBubbles",!0))}),t)},postDispatch:function(n){n._submit_bubble&&(delete n._submit_bubble,this.parentNode&&!n.isTrigger&&i.event.simulate("submit",this.parentNode,n,!0))},teardown:function(){return i.nodeName(this,"form")?!1:(i.event.remove(this,"._submit"),t)}});i.support.changeBubbles||(i.event.special.change={setup:function(){return ui.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(i.event.add(this,"propertychange._change",function(n){"checked"===n.originalEvent.propertyName&&(this._just_changed=!0)}),i.event.add(this,"click._change",function(n){this._just_changed&&!n.isTrigger&&(this._just_changed=!1);i.event.simulate("change",this,n,!0)})),!1):(i.event.add(this,"beforeactivate._change",function(n){var t=n.target;ui.test(t.nodeName)&&!i._data(t,"changeBubbles")&&(i.event.add(t,"change._change",function(n){!this.parentNode||n.isSimulated||n.isTrigger||i.event.simulate("change",this.parentNode,n,!0)}),i._data(t,"changeBubbles",!0))}),t)},handle:function(n){var i=n.target;return this!==i||n.isSimulated||n.isTrigger||"radio"!==i.type&&"checkbox"!==i.type?n.handleObj.handler.apply(this,arguments):t},teardown:function(){return i.event.remove(this,"._change"),!ui.test(this.nodeName)}});i.support.focusinBubbles||i.each({focus:"focusin",blur:"focusout"},function(n,t){var u=0,f=function(n){i.event.simulate(t,n.target,i.event.fix(n),!0)};i.event.special[t]={setup:function(){0==u++&&r.addEventListener(n,f,!0)},teardown:function(){0==--u&&r.removeEventListener(n,f,!0)}}});i.fn.extend({on:function(n,r,u,f,e){var s,o;if("object"==typeof n){"string"!=typeof r&&(u=u||r,r=t);for(s in n)this.on(s,r,u,n[s],e);return this}if(null==u&&null==f?(f=r,u=r=t):null==f&&("string"==typeof r?(f=u,u=t):(f=u,u=r,r=t)),f===!1)f=d;else if(!f)return this;return 1===e&&(o=f,f=function(n){return i().off(n),o.apply(this,arguments)},f.guid=o.guid||(o.guid=i.guid++)),this.each(function(){i.event.add(this,n,f,u,r)})},one:function(n,t,i,r){return this.on(n,t,i,r,1)},off:function(n,r,u){var f,e;if(n&&n.preventDefault&&n.handleObj)return f=n.handleObj,i(n.delegateTarget).off(f.namespace?f.origType+"."+f.namespace:f.origType,f.selector,f.handler),this;if("object"==typeof n){for(e in n)this.off(e,r,n[e]);return this}return(r===!1||"function"==typeof r)&&(u=r,r=t),u===!1&&(u=d),this.each(function(){i.event.remove(this,n,u,r)})},bind:function(n,t,i){return this.on(n,null,t,i)},unbind:function(n,t){return this.off(n,null,t)},delegate:function(n,t,i,r){return this.on(t,n,i,r)},undelegate:function(n,t,i){return 1===arguments.length?this.off(n,"**"):this.off(t,n||"**",i)},trigger:function(n,t){return this.each(function(){i.event.trigger(n,t,this)})},triggerHandler:function(n,r){var u=this[0];return u?i.event.trigger(n,r,u,!0):t}}),function(n,t){function ti(n){return tr.test(n+"")}function ii(){var n,t=[];return n=function(i,u){return t.push(i+=" ")>r.cacheLength&&delete n[t.shift()],n[i]=u}}function l(n){return n[f]=!0,n}function b(n){var t=s.createElement("div");try{return n(t)}catch(i){return!1}finally{t=null}}function u(n,t,i,r){var y,u,e,l,p,v,w,h,d,b;if((t?t.ownerDocument||t:k)!==s&&it(t),t=t||s,i=i||[],!n||"string"!=typeof n)return i;if(1!==(l=t.nodeType)&&9!==l)return[];if(!c&&!r){if(y=ir.exec(n))if(e=y[1]){if(9===l){if(u=t.getElementById(e),!u||!u.parentNode)return i;if(u.id===e)return i.push(u),i}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(e))&&et(t,u)&&u.id===e)return i.push(u),i}else{if(y[2])return ut.apply(i,ft.call(t.getElementsByTagName(n),0)),i;if((e=y[3])&&o.getByClassName&&t.getElementsByClassName)return ut.apply(i,ft.call(t.getElementsByClassName(e),0)),i}if(o.qsa&&!a.test(n)){if(w=!0,h=f,d=t,b=9===l&&n,1===l&&"object"!==t.nodeName.toLowerCase()){for(v=yt(n),(w=t.getAttribute("id"))?h=w.replace(fr,"\\$&"):t.setAttribute("id",h),h="[id='"+h+"'] ",p=v.length;p--;)v[p]=h+pt(v[p]);d=ni.test(n)&&t.parentNode||t;b=v.join(",")}if(b)try{return ut.apply(i,ft.call(d.querySelectorAll(b),0)),i}catch(g){}finally{w||t.removeAttribute("id")}}}return lr(n.replace(at,"$1"),t,i,r)}function yi(n,t){var i=t&&n,r=i&&(~t.sourceIndex||li)-(~n.sourceIndex||li);if(r)return r;if(i)while(i=i.nextSibling)if(i===t)return-1;return n?1:-1}function or(n){return function(t){var i=t.nodeName.toLowerCase();return"input"===i&&t.type===n}}function sr(n){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===n}}function g(n){return l(function(t){return t=+t,l(function(i,r){for(var u,f=n([],i.length,t),e=f.length;e--;)i[u=f[e]]&&(i[u]=!(r[u]=i[u]))})})}function yt(n,t){var e,f,s,o,i,h,c,l=hi[n+" "];if(l)return t?0:l.slice(0);for(i=n,h=[],c=r.preFilter;i;){(!e||(f=ki.exec(i)))&&(f&&(i=i.slice(f[0].length)||i),h.push(s=[]));e=!1;(f=di.exec(i))&&(e=f.shift(),s.push({value:e,type:f[0].replace(at," ")}),i=i.slice(e.length));for(o in r.filter)(f=vt[o].exec(i))&&(!c[o]||(f=c[o](f)))&&(e=f.shift(),s.push({value:e,type:o,matches:f}),i=i.slice(e.length));if(!e)break}return t?i.length:i?u.error(n):hi(n,h).slice(0)}function pt(n){for(var t=0,r=n.length,i="";r>t;t++)i+=n[t].value;return i}function ri(n,t,i){var r=t.dir,u=i&&"parentNode"===r,e=wi++;return t.first?function(t,i,f){while(t=t[r])if(1===t.nodeType||u)return n(t,i,f)}:function(t,i,o){var h,s,c,l=v+" "+e;if(o){while(t=t[r])if((1===t.nodeType||u)&&n(t,i,o))return!0}else while(t=t[r])if(1===t.nodeType||u)if(c=t[f]||(t[f]={}),(s=c[r])&&s[0]===l){if((h=s[1])===!0||h===ot)return h===!0}else if(s=c[r]=[l],s[1]=n(t,i,o)||ot,s[1]===!0)return!0}}function ui(n){return n.length>1?function(t,i,r){for(var u=n.length;u--;)if(!n[u](t,i,r))return!1;return!0}:n[0]}function wt(n,t,i,r,u){for(var e,o=[],f=0,s=n.length,h=null!=t;s>f;f++)(e=n[f])&&(!i||i(e,r,u))&&(o.push(e),h&&t.push(f));return o}function fi(n,t,i,r,u,e){return r&&!r[f]&&(r=fi(r)),u&&!u[f]&&(u=fi(u,e)),l(function(f,e,o,s){var l,c,a,p=[],y=[],w=e.length,b=f||cr(t||"*",o.nodeType?[o]:o,[]),v=!n||!f&&t?b:wt(b,p,n,o,s),h=i?u||(f?n:w||r)?[]:e:v;if(i&&i(v,h,o,s),r)for(l=wt(h,y),r(l,[],o,s),c=l.length;c--;)(a=l[c])&&(h[y[c]]=!(v[y[c]]=a));if(f){if(u||n){if(u){for(l=[],c=h.length;c--;)(a=h[c])&&l.push(v[c]=a);u(null,h=[],l,s)}for(c=h.length;c--;)(a=h[c])&&(l=u?dt.call(f,a):p[c])>-1&&(f[l]=!(e[l]=a))}}else h=wt(h===e?h.splice(w,h.length):h),u?u(null,e,h,s):ut.apply(e,h)})}function ei(n){for(var s,u,i,o=n.length,h=r.relative[n[0].type],c=h||r.relative[" "],t=h?1:0,l=ri(function(n){return n===s},c,!0),a=ri(function(n){return dt.call(s,n)>-1},c,!0),e=[function(n,t,i){return!h&&(i||t!==ht)||((s=t).nodeType?l(n,t,i):a(n,t,i))}];o>t;t++)if(u=r.relative[n[t].type])e=[ri(ui(e),u)];else{if(u=r.filter[n[t].type].apply(null,n[t].matches),u[f]){for(i=++t;o>i;i++)if(r.relative[n[i].type])break;return fi(t>1&&ui(e),t>1&&pt(n.slice(0,t-1)).replace(at,"$1"),u,i>t&&ei(n.slice(t,i)),o>i&&ei(n=n.slice(i)),o>i&&pt(n))}e.push(u)}return ui(e)}function hr(n,t){var f=0,i=t.length>0,e=n.length>0,o=function(o,h,c,l,a){var p,d,b,w=[],k=0,y="0",g=o&&[],nt=null!=a,tt=ht,rt=o||e&&r.find.TAG("*",a&&h.parentNode||h),it=v+=null==tt?1:Math.random()||.1;for(nt&&(ht=h!==s&&h,ot=f);null!=(p=rt[y]);y++){if(e&&p){for(d=0;b=n[d++];)if(b(p,h,c)){l.push(p);break}nt&&(v=it,ot=++f)}i&&((p=!b&&p)&&k--,o&&g.push(p))}if(k+=y,i&&y!==k){for(d=0;b=t[d++];)b(g,w,h,c);if(o){if(k>0)while(y--)g[y]||w[y]||(w[y]=bi.call(l));w=wt(w)}ut.apply(l,w);nt&&!o&&w.length>0&&k+t.length>1&&u.uniqueSort(l)}return nt&&(v=it,ht=tt),g};return i?l(o):o}function cr(n,t,i){for(var r=0,f=t.length;f>r;r++)u(n,t[r],i);return i}function lr(n,t,i,u){var o,f,e,h,l,s=yt(n);if(!u&&1===s.length){if(f=s[0]=s[0].slice(0),f.length>2&&"ID"===(e=f[0]).type&&9===t.nodeType&&!c&&r.relative[f[1].type]){if(t=r.find.ID(e.matches[0].replace(p,w),t)[0],!t)return i;n=n.slice(f.shift().value.length)}for(o=vt.needsContext.test(n)?0:f.length;o--;){if(e=f[o],r.relative[h=e.type])break;if((l=r.find[h])&&(u=l(e.matches[0].replace(p,w),ni.test(f[0].type)&&t.parentNode||t))){if(f.splice(o,1),n=u.length&&pt(f),!n)return ut.apply(i,ft.call(u,0)),i;break}}}return bt(n,s)(u,t,c,i,ni.test(n)),i}function pi(){}var nt,ot,r,st,oi,bt,tt,ht,it,s,h,c,a,rt,ct,et,kt,f="sizzle"+-new Date,k=n.document,o={},v=0,wi=0,si=ii(),hi=ii(),ci=ii(),y=typeof t,li=-2147483648,lt=[],bi=lt.pop,ut=lt.push,ft=lt.slice,dt=lt.indexOf||function(n){for(var t=0,i=this.length;i>t;t++)if(this[t]===n)return t;return-1},e="[\\x20\\t\\r\\n\\f]",d="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ai=d.replace("w","w#"),vi="\\["+e+"*("+d+")"+e+"*(?:([*^$|!~]?=)"+e+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+ai+")|)|)"+e+"*\\]",gt=":("+d+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+vi.replace(3,8)+")*)|.*)\\)|)",at=RegExp("^"+e+"+|((?:^|[^\\\\])(?:\\\\.)*)"+e+"+$","g"),ki=RegExp("^"+e+"*,"+e+"*"),di=RegExp("^"+e+"*([\\x20\\t\\r\\n\\f>+~])"+e+"*"),gi=RegExp(gt),nr=RegExp("^"+ai+"$"),vt={ID:RegExp("^#("+d+")"),CLASS:RegExp("^\\.("+d+")"),NAME:RegExp("^\\[name=['\"]?("+d+")['\"]?\\]"),TAG:RegExp("^("+d.replace("w","w*")+")"),ATTR:RegExp("^"+vi),PSEUDO:RegExp("^"+gt),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+e+"*(even|odd|(([+-]|)(\\d*)n|)"+e+"*(?:([+-]|)"+e+"*(\\d+)|))"+e+"*\\)|)","i"),needsContext:RegExp("^"+e+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+e+"*((?:-\\d)?\\d*)"+e+"*\\)|)(?=[^-]|$)","i")},ni=/[\x20\t\r\n\f]*[+~]/,tr=/^[^{]+\{\s*\[native code/,ir=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rr=/^(?:input|select|textarea|button)$/i,ur=/^h\d$/i,fr=/'|\\/g,er=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,p=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,w=function(n,t){var i="0x"+t-65536;return i!==i?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(55296|i>>10,56320|1023&i)};try{ft.call(k.documentElement.childNodes,0)[0].nodeType}catch(ar){ft=function(n){for(var t,i=[];t=this[n++];)i.push(t);return i}}oi=u.isXML=function(n){var t=n&&(n.ownerDocument||n).documentElement;return t?"HTML"!==t.nodeName:!1};it=u.setDocument=function(n){var i=n?n.ownerDocument||n:k;return i!==s&&9===i.nodeType&&i.documentElement?(s=i,h=i.documentElement,c=oi(i),o.tagNameNoComments=b(function(n){return n.appendChild(i.createComment("")),!n.getElementsByTagName("*").length}),o.attributes=b(function(n){n.innerHTML="<select><\/select>";var t=typeof n.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),o.getByClassName=b(function(n){return n.innerHTML="<div class='hidden e'><\/div><div class='hidden'><\/div>",n.getElementsByClassName&&n.getElementsByClassName("e").length?(n.lastChild.className="e",2===n.getElementsByClassName("e").length):!1}),o.getByName=b(function(n){n.id=f+0;n.innerHTML="<a name='"+f+"'><\/a><div name='"+f+"'><\/div>";h.insertBefore(n,h.firstChild);var t=i.getElementsByName&&i.getElementsByName(f).length===2+i.getElementsByName(f+0).length;return o.getIdNotName=!i.getElementById(f),h.removeChild(n),t}),r.attrHandle=b(function(n){return n.innerHTML="<a href='#'><\/a>",n.firstChild&&typeof n.firstChild.getAttribute!==y&&"#"===n.firstChild.getAttribute("href")})?{}:{href:function(n){return n.getAttribute("href",2)},type:function(n){return n.getAttribute("type")}},o.getIdNotName?(r.find.ID=function(n,t){if(typeof t.getElementById!==y&&!c){var i=t.getElementById(n);return i&&i.parentNode?[i]:[]}},r.filter.ID=function(n){var t=n.replace(p,w);return function(n){return n.getAttribute("id")===t}}):(r.find.ID=function(n,i){if(typeof i.getElementById!==y&&!c){var r=i.getElementById(n);return r?r.id===n||typeof r.getAttributeNode!==y&&r.getAttributeNode("id").value===n?[r]:t:[]}},r.filter.ID=function(n){var t=n.replace(p,w);return function(n){var i=typeof n.getAttributeNode!==y&&n.getAttributeNode("id");return i&&i.value===t}}),r.find.TAG=o.tagNameNoComments?function(n,i){return typeof i.getElementsByTagName!==y?i.getElementsByTagName(n):t}:function(n,t){var i,r=[],f=0,u=t.getElementsByTagName(n);if("*"===n){while(i=u[f++])1===i.nodeType&&r.push(i);return r}return u},r.find.NAME=o.getByName&&function(n,i){return typeof i.getElementsByName!==y?i.getElementsByName(name):t},r.find.CLASS=o.getByClassName&&function(n,i){return typeof i.getElementsByClassName===y||c?t:i.getElementsByClassName(n)},rt=[],a=[":focus"],(o.qsa=ti(i.querySelectorAll))&&(b(function(n){n.innerHTML="<select><option selected=''><\/option><\/select>";n.querySelectorAll("[selected]").length||a.push("\\["+e+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)");n.querySelectorAll(":checked").length||a.push(":checked")}),b(function(n){n.innerHTML="<input type='hidden' i=''/>";n.querySelectorAll("[i^='']").length&&a.push("[*^$]="+e+"*(?:\"\"|'')");n.querySelectorAll(":enabled").length||a.push(":enabled",":disabled");n.querySelectorAll("*,:x");a.push(",.*:")})),(o.matchesSelector=ti(ct=h.matchesSelector||h.mozMatchesSelector||h.webkitMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&b(function(n){o.disconnectedMatch=ct.call(n,"div");ct.call(n,"[s!='']:x");rt.push("!=",gt)}),a=RegExp(a.join("|")),rt=RegExp(rt.join("|")),et=ti(h.contains)||h.compareDocumentPosition?function(n,t){var r=9===n.nodeType?n.documentElement:n,i=t&&t.parentNode;return n===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):n.compareDocumentPosition&&16&n.compareDocumentPosition(i)))}:function(n,t){if(t)while(t=t.parentNode)if(t===n)return!0;return!1},kt=h.compareDocumentPosition?function(n,t){var r;return n===t?(tt=!0,0):(r=t.compareDocumentPosition&&n.compareDocumentPosition&&n.compareDocumentPosition(t))?1&r||n.parentNode&&11===n.parentNode.nodeType?n===i||et(k,n)?-1:t===i||et(k,t)?1:0:4&r?-1:1:n.compareDocumentPosition?-1:1}:function(n,t){var r,u=0,o=n.parentNode,s=t.parentNode,f=[n],e=[t];if(n===t)return tt=!0,0;if(!o||!s)return n===i?-1:t===i?1:o?-1:s?1:0;if(o===s)return yi(n,t);for(r=n;r=r.parentNode;)f.unshift(r);for(r=t;r=r.parentNode;)e.unshift(r);while(f[u]===e[u])u++;return u?yi(f[u],e[u]):f[u]===k?-1:e[u]===k?1:0},tt=!1,[0,0].sort(kt),o.detectDuplicates=tt,s):s};u.matches=function(n,t){return u(n,null,null,t)};u.matchesSelector=function(n,t){if((n.ownerDocument||n)!==s&&it(n),t=t.replace(er,"='$1']"),!(!o.matchesSelector||c||rt&&rt.test(t)||a.test(t)))try{var i=ct.call(n,t);if(i||o.disconnectedMatch||n.document&&11!==n.document.nodeType)return i}catch(r){}return u(t,s,null,[n]).length>0};u.contains=function(n,t){return(n.ownerDocument||n)!==s&&it(n),et(n,t)};u.attr=function(n,t){var i;return(n.ownerDocument||n)!==s&&it(n),c||(t=t.toLowerCase()),(i=r.attrHandle[t])?i(n):c||o.attributes?n.getAttribute(t):((i=n.getAttributeNode(t))||n.getAttribute(t))&&n[t]===!0?t:i&&i.specified?i.value:null};u.error=function(n){throw Error("Syntax error, unrecognized expression: "+n);};u.uniqueSort=function(n){var r,u=[],t=1,i=0;if(tt=!o.detectDuplicates,n.sort(kt),tt){for(;r=n[t];t++)r===n[t-1]&&(i=u.push(t));while(i--)n.splice(u[i],1)}return n};st=u.getText=function(n){var r,i="",u=0,t=n.nodeType;if(t){if(1===t||9===t||11===t){if("string"==typeof n.textContent)return n.textContent;for(n=n.firstChild;n;n=n.nextSibling)i+=st(n)}else if(3===t||4===t)return n.nodeValue}else for(;r=n[u];u++)i+=st(r);return i};r=u.selectors={cacheLength:50,createPseudo:l,match:vt,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(n){return n[1]=n[1].replace(p,w),n[3]=(n[4]||n[5]||"").replace(p,w),"~="===n[2]&&(n[3]=" "+n[3]+" "),n.slice(0,4)},CHILD:function(n){return n[1]=n[1].toLowerCase(),"nth"===n[1].slice(0,3)?(n[3]||u.error(n[0]),n[4]=+(n[4]?n[5]+(n[6]||1):2*("even"===n[3]||"odd"===n[3])),n[5]=+(n[7]+n[8]||"odd"===n[3])):n[3]&&u.error(n[0]),n},PSEUDO:function(n){var i,t=!n[5]&&n[2];return vt.CHILD.test(n[0])?null:(n[4]?n[2]=n[4]:t&&gi.test(t)&&(i=yt(t,!0))&&(i=t.indexOf(")",t.length-i)-t.length)&&(n[0]=n[0].slice(0,i),n[2]=t.slice(0,i)),n.slice(0,3))}},filter:{TAG:function(n){return"*"===n?function(){return!0}:(n=n.replace(p,w).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===n})},CLASS:function(n){var t=si[n+" "];return t||(t=RegExp("(^|"+e+")"+n+"("+e+"|$)"))&&si(n,function(n){return t.test(n.className||typeof n.getAttribute!==y&&n.getAttribute("class")||"")})},ATTR:function(n,t,i){return function(r){var f=u.attr(r,n);return null==f?"!="===t:t?(f+="","="===t?f===i:"!="===t?f!==i:"^="===t?i&&0===f.indexOf(i):"*="===t?i&&f.indexOf(i)>-1:"$="===t?i&&f.slice(-i.length)===i:"~="===t?(" "+f+" ").indexOf(i)>-1:"|="===t?f===i||f.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(n,t,i,r,u){var s="nth"!==n.slice(0,3),o="last"!==n.slice(-4),e="of-type"===t;return 1===r&&0===u?function(n){return!!n.parentNode}:function(t,i,h){var a,k,c,l,y,w,b=s!==o?"nextSibling":"previousSibling",p=t.parentNode,g=e&&t.nodeName.toLowerCase(),d=!h&&!e;if(p){if(s){while(b){for(c=t;c=c[b];)if(e?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;w=b="only"===n&&!w&&"nextSibling"}return!0}if(w=[o?p.firstChild:p.lastChild],o&&d){for(k=p[f]||(p[f]={}),a=k[n]||[],y=a[0]===v&&a[1],l=a[0]===v&&a[2],c=y&&p.childNodes[y];c=++y&&c&&c[b]||(l=y=0)||w.pop();)if(1===c.nodeType&&++l&&c===t){k[n]=[v,y,l];break}}else if(d&&(a=(t[f]||(t[f]={}))[n])&&a[0]===v)l=a[1];else while(c=++y&&c&&c[b]||(l=y=0)||w.pop())if((e?c.nodeName.toLowerCase()===g:1===c.nodeType)&&++l&&(d&&((c[f]||(c[f]={}))[n]=[v,l]),c===t))break;return l-=u,l===r||0==l%r&&l/r>=0}}},PSEUDO:function(n,t){var e,i=r.pseudos[n]||r.setFilters[n.toLowerCase()]||u.error("unsupported pseudo: "+n);return i[f]?i(t):i.length>1?(e=[n,n,"",t],r.setFilters.hasOwnProperty(n.toLowerCase())?l(function(n,r){for(var u,f=i(n,t),e=f.length;e--;)u=dt.call(n,f[e]),n[u]=!(r[u]=f[e])}):function(n){return i(n,0,e)}):i}},pseudos:{not:l(function(n){var i=[],r=[],t=bt(n.replace(at,"$1"));return t[f]?l(function(n,i,r,u){for(var e,o=t(n,null,u,[]),f=n.length;f--;)(e=o[f])&&(n[f]=!(i[f]=e))}):function(n,u,f){return i[0]=n,t(i,null,f,r),!r.pop()}}),has:l(function(n){return function(t){return u(n,t).length>0}}),contains:l(function(n){return function(t){return(t.textContent||t.innerText||st(t)).indexOf(n)>-1}}),lang:l(function(n){return nr.test(n||"")||u.error("unsupported lang: "+n),n=n.replace(p,w).toLowerCase(),function(t){var i;do if(i=c?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return i=i.toLowerCase(),i===n||0===i.indexOf(n+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=n.location&&n.location.hash;return i&&i.slice(1)===t.id},root:function(n){return n===h},focus:function(n){return n===s.activeElement&&(!s.hasFocus||s.hasFocus())&&!!(n.type||n.href||~n.tabIndex)},enabled:function(n){return n.disabled===!1},disabled:function(n){return n.disabled===!0},checked:function(n){var t=n.nodeName.toLowerCase();return"input"===t&&!!n.checked||"option"===t&&!!n.selected},selected:function(n){return n.parentNode&&n.parentNode.selectedIndex,n.selected===!0},empty:function(n){for(n=n.firstChild;n;n=n.nextSibling)if(n.nodeName>"@"||3===n.nodeType||4===n.nodeType)return!1;return!0},parent:function(n){return!r.pseudos.empty(n)},header:function(n){return ur.test(n.nodeName)},input:function(n){return rr.test(n.nodeName)},button:function(n){var t=n.nodeName.toLowerCase();return"input"===t&&"button"===n.type||"button"===t},text:function(n){var t;return"input"===n.nodeName.toLowerCase()&&"text"===n.type&&(null==(t=n.getAttribute("type"))||t.toLowerCase()===n.type)},first:g(function(){return[0]}),last:g(function(n,t){return[t-1]}),eq:g(function(n,t,i){return[0>i?i+t:i]}),even:g(function(n,t){for(var i=0;t>i;i+=2)n.push(i);return n}),odd:g(function(n,t){for(var i=1;t>i;i+=2)n.push(i);return n}),lt:g(function(n,t,i){for(var r=0>i?i+t:i;--r>=0;)n.push(r);return n}),gt:g(function(n,t,i){for(var r=0>i?i+t:i;t>++r;)n.push(r);return n})}};for(nt in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[nt]=or(nt);for(nt in{submit:!0,reset:!0})r.pseudos[nt]=sr(nt);bt=u.compile=function(n,t){var r,u=[],e=[],i=ci[n+" "];if(!i){for(t||(t=yt(n)),r=t.length;r--;)i=ei(t[r]),i[f]?u.push(i):e.push(i);i=ci(n,hr(e,u))}return i};r.pseudos.nth=r.pseudos.eq;r.filters=pi.prototype=r.pseudos;r.setFilters=new pi;it();u.attr=i.attr;i.find=u;i.expr=u.selectors;i.expr[":"]=i.expr.pseudos;i.unique=u.uniqueSort;i.text=u.getText;i.isXMLDoc=u.isXML;i.contains=u.contains}(n);var re=/Until$/,ue=/^(?:parents|prev(?:Until|All))/,fe=/^.[^:#\[\.,]*$/,hr=i.expr.match.needsContext,ee={children:!0,contents:!0,next:!0,prev:!0};i.fn.extend({find:function(n){var t,r,f,u=this.length;if("string"!=typeof n)return f=this,this.pushStack(i(n).filter(function(){for(t=0;u>t;t++)if(i.contains(f[t],this))return!0}));for(r=[],t=0;u>t;t++)i.find(n,this[t],r);return r=this.pushStack(u>1?i.unique(r):r),r.selector=(this.selector?this.selector+" ":"")+n,r},has:function(n){var t,r=i(n,this),u=r.length;return this.filter(function(){for(t=0;u>t;t++)if(i.contains(this,r[t]))return!0})},not:function(n){return this.pushStack(lr(this,n,!1))},filter:function(n){return this.pushStack(lr(this,n,!0))},is:function(n){return!!n&&("string"==typeof n?hr.test(n)?i(n,this.context).index(this[0])>=0:i.filter(n,this).length>0:this.filter(n).length>0)},closest:function(n,t){for(var r,f=0,o=this.length,u=[],e=hr.test(n)||"string"!=typeof n?i(n,t||this.context):0;o>f;f++)for(r=this[f];r&&r.ownerDocument&&r!==t&&11!==r.nodeType;){if(e?e.index(r)>-1:i.find.matchesSelector(r,n)){u.push(r);break}r=r.parentNode}return this.pushStack(u.length>1?i.unique(u):u)},index:function(n){return n?"string"==typeof n?i.inArray(this[0],i(n)):i.inArray(n.jquery?n[0]:n,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(n,t){var r="string"==typeof n?i(n,t):i.makeArray(n&&n.nodeType?[n]:n),u=i.merge(this.get(),r);return this.pushStack(i.unique(u))},addBack:function(n){return this.add(null==n?this.prevObject:this.prevObject.filter(n))}});i.fn.andSelf=i.fn.addBack;i.each({parent:function(n){var t=n.parentNode;return t&&11!==t.nodeType?t:null},parents:function(n){return i.dir(n,"parentNode")},parentsUntil:function(n,t,r){return i.dir(n,"parentNode",r)},next:function(n){return cr(n,"nextSibling")},prev:function(n){return cr(n,"previousSibling")},nextAll:function(n){return i.dir(n,"nextSibling")},prevAll:function(n){return i.dir(n,"previousSibling")},nextUntil:function(n,t,r){return i.dir(n,"nextSibling",r)},prevUntil:function(n,t,r){return i.dir(n,"previousSibling",r)},siblings:function(n){return i.sibling((n.parentNode||{}).firstChild,n)},children:function(n){return i.sibling(n.firstChild)},contents:function(n){return i.nodeName(n,"iframe")?n.contentDocument||n.contentWindow.document:i.merge([],n.childNodes)}},function(n,t){i.fn[n]=function(r,u){var f=i.map(this,t,r);return re.test(n)||(u=r),u&&"string"==typeof u&&(f=i.filter(u,f)),f=this.length>1&&!ee[n]?i.unique(f):f,this.length>1&&ue.test(n)&&(f=f.reverse()),this.pushStack(f)}});i.extend({filter:function(n,t,r){return r&&(n=":not("+n+")"),1===t.length?i.find.matchesSelector(t[0],n)?[t[0]]:[]:i.find.matches(n,t)},dir:function(n,r,u){for(var e=[],f=n[r];f&&9!==f.nodeType&&(u===t||1!==f.nodeType||!i(f).is(u));)1===f.nodeType&&e.push(f),f=f[r];return e},sibling:function(n,t){for(var i=[];n;n=n.nextSibling)1===n.nodeType&&n!==t&&i.push(n);return i}});var vr="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",oe=/ jQuery\d+="(?:null|\d+)"/g,yr=RegExp("<(?:"+vr+")[\\s/>]","i"),fi=/^\s+/,pr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,wr=/<([\w:]+)/,br=/<tbody/i,se=/<|&#?\w+;/,he=/<(?:script|style|link)/i,ei=/^(?:checkbox|radio)$/i,ce=/checked\s*(?:[^=]|=\s*.checked.)/i,kr=/^$|\/(?:java|ecma)script/i,le=/^true\/(.*)/,ae=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,e={option:[1,"<select multiple='multiple'>","<\/select>"],legend:[1,"<fieldset>","<\/fieldset>"],area:[1,"<map>","<\/map>"],param:[1,"<object>","<\/object>"],thead:[1,"<table>","<\/table>"],tr:[2,"<table><tbody>","<\/tbody><\/table>"],col:[2,"<table><tbody><\/tbody><colgroup>","<\/colgroup><\/table>"],td:[3,"<table><tbody><tr>","<\/tr><\/tbody><\/table>"],_default:i.support.htmlSerialize?[0,"",""]:[1,"X<div>","<\/div>"]},ve=ar(r),oi=ve.appendChild(r.createElement("div"));e.optgroup=e.option;e.tbody=e.tfoot=e.colgroup=e.caption=e.thead;e.th=e.td;i.fn.extend({text:function(n){return i.access(this,function(n){return n===t?i.text(this):this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(n))},null,n,arguments.length)},wrapAll:function(n){if(i.isFunction(n))return this.each(function(t){i(this).wrapAll(n.call(this,t))});if(this[0]){var t=i(n,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]);t.map(function(){for(var n=this;n.firstChild&&1===n.firstChild.nodeType;)n=n.firstChild;return n}).append(this)}return this},wrapInner:function(n){return i.isFunction(n)?this.each(function(t){i(this).wrapInner(n.call(this,t))}):this.each(function(){var t=i(this),r=t.contents();r.length?r.wrapAll(n):t.append(n)})},wrap:function(n){var t=i.isFunction(n);return this.each(function(r){i(this).wrapAll(t?n.call(this,r):n)})},unwrap:function(){return this.parent().each(function(){i.nodeName(this,"body")||i(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(n){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(n)})},prepend:function(){return this.domManip(arguments,!0,function(n){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(n,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(n){this.parentNode&&this.parentNode.insertBefore(n,this)})},after:function(){return this.domManip(arguments,!1,function(n){this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling)})},remove:function(n,t){for(var r,f=0;null!=(r=this[f]);f++)(!n||i.filter(n,[r]).length>0)&&(t||1!==r.nodeType||i.cleanData(u(r)),r.parentNode&&(t&&i.contains(r.ownerDocument,r)&&si(u(r,"script")),r.parentNode.removeChild(r)));return this},empty:function(){for(var n,t=0;null!=(n=this[t]);t++){for(1===n.nodeType&&i.cleanData(u(n,!1));n.firstChild;)n.removeChild(n.firstChild);n.options&&i.nodeName(n,"select")&&(n.options.length=0)}return this},clone:function(n,t){return n=null==n?!1:n,t=null==t?n:t,this.map(function(){return i.clone(this,n,t)})},html:function(n){return i.access(this,function(n){var r=this[0]||{},f=0,o=this.length;if(n===t)return 1===r.nodeType?r.innerHTML.replace(oe,""):t;if(!("string"!=typeof n||he.test(n)||!i.support.htmlSerialize&&yr.test(n)||!i.support.leadingWhitespace&&fi.test(n)||e[(wr.exec(n)||["",""])[1].toLowerCase()])){n=n.replace(pr,"<$1><\/$2>");try{for(;o>f;f++)r=this[f]||{},1===r.nodeType&&(i.cleanData(u(r,!1)),r.innerHTML=n);r=0}catch(s){}}r&&this.empty().append(n)},null,n,arguments.length)},replaceWith:function(n){var t=i.isFunction(n);return t||"string"==typeof n||(n=i(n).not(this).detach()),this.domManip([n],!0,function(n){var r=this.nextSibling,t=this.parentNode;t&&(i(this).remove(),t.insertBefore(n,r))})},detach:function(n){return this.remove(n,!0)},domManip:function(n,r,f){n=bi.apply([],n);var c,e,l,s,y,h,o=0,a=this.length,w=this,b=a-1,v=n[0],p=i.isFunction(v);if(p||!(1>=a||"string"!=typeof v||i.support.checkClone)&&ce.test(v))return this.each(function(i){var u=w.eq(i);p&&(n[0]=v.call(this,i,r?u.html():t));u.domManip(n,r,f)});if(a&&(h=i.buildFragment(n,this[0].ownerDocument,!1,this),c=h.firstChild,1===h.childNodes.length&&(h=c),c)){for(r=r&&i.nodeName(c,"tr"),s=i.map(u(h,"script"),dr),l=s.length;a>o;o++)e=h,o!==b&&(e=i.clone(e,!0,!0),l&&i.merge(s,u(e,"script"))),f.call(r&&i.nodeName(this[o],"table")?ye(this[o],"tbody"):this[o],e,o);if(l)for(y=s[s.length-1].ownerDocument,i.map(s,gr),o=0;l>o;o++)e=s[o],kr.test(e.type||"")&&!i._data(e,"globalEval")&&i.contains(y,e)&&(e.src?i.ajax({url:e.src,type:"GET",dataType:"script",async:!1,global:!1,throws:!0}):i.globalEval((e.text||e.textContent||e.innerHTML||"").replace(ae,"")));h=c=null}return this}});i.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(n,t){i.fn[n]=function(n){for(var u,r=0,f=[],e=i(n),o=e.length-1;o>=r;r++)u=r===o?this:this.clone(!0),i(e[r])[t](u),bt.apply(f,u.get());return this.pushStack(f)}});i.extend({clone:function(n,t,r){var f,h,o,e,s,c=i.contains(n.ownerDocument,n);if(i.support.html5Clone||i.isXMLDoc(n)||!yr.test("<"+n.nodeName+">")?o=n.cloneNode(!0):(oi.innerHTML=n.outerHTML,oi.removeChild(o=oi.firstChild)),!(i.support.noCloneEvent&&i.support.noCloneChecked||1!==n.nodeType&&11!==n.nodeType||i.isXMLDoc(n)))for(f=u(o),s=u(n),e=0;null!=(h=s[e]);++e)f[e]&&pe(h,f[e]);if(t)if(r)for(s=s||u(n),f=f||u(o),e=0;null!=(h=s[e]);e++)nu(h,f[e]);else nu(n,o);return f=u(o,"script"),f.length>0&&si(f,!c&&u(n,"script")),f=s=h=null,o},buildFragment:function(n,t,r,f){for(var h,o,w,s,y,p,l,b=n.length,a=ar(t),c=[],v=0;b>v;v++)if(o=n[v],o||0===o)if("object"===i.type(o))i.merge(c,o.nodeType?[o]:o);else if(se.test(o)){for(s=s||a.appendChild(t.createElement("div")),y=(wr.exec(o)||["",""])[1].toLowerCase(),l=e[y]||e._default,s.innerHTML=l[1]+o.replace(pr,"<$1><\/$2>")+l[2],h=l[0];h--;)s=s.lastChild;if(!i.support.leadingWhitespace&&fi.test(o)&&c.push(t.createTextNode(fi.exec(o)[0])),!i.support.tbody)for(o="table"!==y||br.test(o)?"<table>"!==l[1]||br.test(o)?0:s:s.firstChild,h=o&&o.childNodes.length;h--;)i.nodeName(p=o.childNodes[h],"tbody")&&!p.childNodes.length&&o.removeChild(p);for(i.merge(c,s.childNodes),s.textContent="";s.firstChild;)s.removeChild(s.firstChild);s=a.lastChild}else c.push(t.createTextNode(o));for(s&&a.removeChild(s),i.support.appendChecked||i.grep(u(c,"input"),we),v=0;o=c[v++];)if((!f||-1===i.inArray(o,f))&&(w=i.contains(o.ownerDocument,o),s=u(a.appendChild(o),"script"),w&&si(s),r))for(h=0;o=s[h++];)kr.test(o.type||"")&&r.push(o);return s=null,a},cleanData:function(n,t){for(var r,f,u,e,c=0,s=i.expando,h=i.cache,l=i.support.deleteExpando,a=i.event.special;null!=(r=n[c]);c++)if((t||i.acceptData(r))&&(u=r[s],e=u&&h[u])){if(e.events)for(f in e.events)a[f]?i.event.remove(r,f):i.removeEvent(r,f,e.handle);h[u]&&(delete h[u],l?delete r[s]:typeof r.removeAttribute!==o?r.removeAttribute(s):r[s]=null,b.push(u))}}});var rt,v,y,hi=/alpha\([^)]*\)/i,be=/opacity\s*=\s*([^)]*)/,ke=/^(top|right|bottom|left)$/,de=/^(none|table(?!-c[ea]).+)/,tu=/^margin/,ge=RegExp("^("+st+")(.*)$","i"),ct=RegExp("^("+st+")(?!px)[a-z%]+$","i"),no=RegExp("^([+-])=("+st+")","i"),iu={BODY:"block"},to={position:"absolute",visibility:"hidden",display:"block"},ru={letterSpacing:0,fontWeight:400},p=["Top","Right","Bottom","Left"],uu=["Webkit","O","Moz","ms"];i.fn.extend({css:function(n,r){return i.access(this,function(n,r,u){var e,o,s={},f=0;if(i.isArray(r)){for(o=v(n),e=r.length;e>f;f++)s[r[f]]=i.css(n,r[f],!1,o);return s}return u!==t?i.style(n,r,u):i.css(n,r)},n,r,arguments.length>1)},show:function(){return eu(this,!0)},hide:function(){return eu(this)},toggle:function(n){var t="boolean"==typeof n;return this.each(function(){(t?n:ut(this))?i(this).show():i(this).hide()})}});i.extend({cssHooks:{opacity:{get:function(n,t){if(t){var i=y(n,"opacity");return""===i?"1":i}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:i.support.cssFloat?"cssFloat":"styleFloat"},style:function(n,r,u,f){if(n&&3!==n.nodeType&&8!==n.nodeType&&n.style){var o,s,e,h=i.camelCase(r),c=n.style;if(r=i.cssProps[h]||(i.cssProps[h]=fu(c,h)),e=i.cssHooks[r]||i.cssHooks[h],u===t)return e&&"get"in e&&(o=e.get(n,!1,f))!==t?o:c[r];if(s=typeof u,"string"===s&&(o=no.exec(u))&&(u=(o[1]+1)*o[2]+parseFloat(i.css(n,r)),s="number"),!(null==u||"number"===s&&isNaN(u)||("number"!==s||i.cssNumber[h]||(u+="px"),i.support.clearCloneStyle||""!==u||0!==r.indexOf("background")||(c[r]="inherit"),e&&"set"in e&&(u=e.set(n,u,f))===t)))try{c[r]=u}catch(l){}}},css:function(n,r,u,f){var h,e,o,s=i.camelCase(r);return r=i.cssProps[s]||(i.cssProps[s]=fu(n.style,s)),o=i.cssHooks[r]||i.cssHooks[s],o&&"get"in o&&(e=o.get(n,!0,u)),e===t&&(e=y(n,r,f)),"normal"===e&&r in ru&&(e=ru[r]),""===u||u?(h=parseFloat(e),u===!0||i.isNumeric(h)?h||0:e):e},swap:function(n,t,i,r){var f,u,e={};for(u in t)e[u]=n.style[u],n.style[u]=t[u];f=i.apply(n,r||[]);for(u in t)n.style[u]=e[u];return f}});n.getComputedStyle?(v=function(t){return n.getComputedStyle(t,null)},y=function(n,r,u){var s,h,c,o=u||v(n),e=o?o.getPropertyValue(r)||o[r]:t,f=n.style;return o&&(""!==e||i.contains(n.ownerDocument,n)||(e=i.style(n,r)),ct.test(e)&&tu.test(r)&&(s=f.width,h=f.minWidth,c=f.maxWidth,f.minWidth=f.maxWidth=f.width=e,e=o.width,f.width=s,f.minWidth=h,f.maxWidth=c)),e}):r.documentElement.currentStyle&&(v=function(n){return n.currentStyle},y=function(n,i,r){var s,e,o,h=r||v(n),u=h?h[i]:t,f=n.style;return null==u&&f&&f[i]&&(u=f[i]),ct.test(u)&&!ke.test(i)&&(s=f.left,e=n.runtimeStyle,o=e&&e.left,o&&(e.left=n.currentStyle.left),f.left="fontSize"===i?"1em":u,u=f.pixelLeft+"px",f.left=s,o&&(e.left=o)),""===u?"auto":u});i.each(["height","width"],function(n,r){i.cssHooks[r]={get:function(n,u,f){return u?0===n.offsetWidth&&de.test(i.css(n,"display"))?i.swap(n,to,function(){return hu(n,r,f)}):hu(n,r,f):t},set:function(n,t,u){var f=u&&v(n);return ou(n,t,u?su(n,r,u,i.support.boxSizing&&"border-box"===i.css(n,"boxSizing",!1,f),f):0)}}});i.support.opacity||(i.cssHooks.opacity={get:function(n,t){return be.test((t&&n.currentStyle?n.currentStyle.filter:n.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(n,t){var r=n.style,u=n.currentStyle,e=i.isNumeric(t)?"alpha(opacity="+100*t+")":"",f=u&&u.filter||r.filter||"";r.zoom=1;(t>=1||""===t)&&""===i.trim(f.replace(hi,""))&&r.removeAttribute&&(r.removeAttribute("filter"),""===t||u&&!u.filter)||(r.filter=hi.test(f)?f.replace(hi,e):f+" "+e)}});i(function(){i.support.reliableMarginRight||(i.cssHooks.marginRight={get:function(n,r){return r?i.swap(n,{display:"inline-block"},y,[n,"marginRight"]):t}});!i.support.pixelPosition&&i.fn.position&&i.each(["top","left"],function(n,r){i.cssHooks[r]={get:function(n,u){return u?(u=y(n,r),ct.test(u)?i(n).position()[r]+"px":u):t}}})});i.expr&&i.expr.filters&&(i.expr.filters.hidden=function(n){return 0>=n.offsetWidth&&0>=n.offsetHeight||!i.support.reliableHiddenOffsets&&"none"===(n.style&&n.style.display||i.css(n,"display"))},i.expr.filters.visible=function(n){return!i.expr.filters.hidden(n)});i.each({margin:"",padding:"",border:"Width"},function(n,t){i.cssHooks[n+t]={expand:function(i){for(var r=0,f={},u="string"==typeof i?i.split(" "):[i];4>r;r++)f[n+p[r]+t]=u[r]||u[r-2]||u[0];return f}};tu.test(n)||(i.cssHooks[n+t].set=ou)});var io=/%20/g,ro=/\[\]$/,au=/\r?\n/g,uo=/^(?:submit|button|image|reset|file)$/i,fo=/^(?:input|select|textarea|keygen)/i;i.fn.extend({serialize:function(){return i.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var n=i.prop(this,"elements");return n?i.makeArray(n):this}).filter(function(){var n=this.type;return this.name&&!i(this).is(":disabled")&&fo.test(this.nodeName)&&!uo.test(n)&&(this.checked||!ei.test(n))}).map(function(n,t){var r=i(this).val();return null==r?null:i.isArray(r)?i.map(r,function(n){return{name:t.name,value:n.replace(au,"\r\n")}}):{name:t.name,value:r.replace(au,"\r\n")}}).get()}});i.param=function(n,r){var u,f=[],e=function(n,t){t=i.isFunction(t)?t():null==t?"":t;f[f.length]=encodeURIComponent(n)+"="+encodeURIComponent(t)};if(r===t&&(r=i.ajaxSettings&&i.ajaxSettings.traditional),i.isArray(n)||n.jquery&&!i.isPlainObject(n))i.each(n,function(){e(this.name,this.value)});else for(u in n)ci(u,n[u],r,e);return f.join("&").replace(io,"+")};i.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(n,t){i.fn[t]=function(n,i){return arguments.length>0?this.on(t,null,n,i):this.trigger(t)}});i.fn.hover=function(n,t){return this.mouseenter(n).mouseleave(t||n)};var w,c,li=i.now(),ai=/\?/,eo=/#.*$/,vu=/([?&])_=[^&]*/,oo=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,so=/^(?:GET|HEAD)$/,ho=/^\/\//,yu=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,pu=i.fn.load,wu={},vi={},bu="*/".concat("*");try{c=ff.href}catch(go){c=r.createElement("a");c.href="";c=c.href}w=yu.exec(c.toLowerCase())||[];i.fn.load=function(n,r,u){if("string"!=typeof n&&pu)return pu.apply(this,arguments);var f,s,h,e=this,o=n.indexOf(" ");return o>=0&&(f=n.slice(o,n.length),n=n.slice(0,o)),i.isFunction(r)?(u=r,r=t):r&&"object"==typeof r&&(h="POST"),e.length>0&&i.ajax({url:n,type:h,dataType:"html",data:r}).done(function(n){s=arguments;e.html(f?i("<div>").append(i.parseHTML(n)).find(f):n)}).complete(u&&function(n,t){e.each(u,s||[n.responseText,t,n])}),this};i.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(n,t){i.fn[t]=function(n){return this.on(t,n)}});i.each(["get","post"],function(n,r){i[r]=function(n,u,f,e){return i.isFunction(u)&&(e=e||f,f=u,u=t),i.ajax({url:n,type:r,dataType:e,data:u,success:f})}});i.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:c,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(w[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":bu,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":n.String,"text html":!0,"text json":i.parseJSON,"text xml":i.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(n,t){return t?yi(yi(n,i.ajaxSettings),t):yi(i.ajaxSettings,n)},ajaxPrefilter:ku(wu),ajaxTransport:ku(vi),ajax:function(n,r){function k(n,r,s,c){var l,k,w,rt,p,a=r;2!==o&&(o=2,g&&clearTimeout(g),y=t,d=c||"",f.readyState=n>0?4:0,s&&(rt=co(u,f,s)),n>=200&&300>n||304===n?(u.ifModified&&(p=f.getResponseHeader("Last-Modified"),p&&(i.lastModified[e]=p),p=f.getResponseHeader("etag"),p&&(i.etag[e]=p)),204===n?(l=!0,a="nocontent"):304===n?(l=!0,a="notmodified"):(l=lo(u,rt),a=l.state,k=l.data,w=l.error,l=!w)):(w=a,(n||!a)&&(a="error",0>n&&(n=0))),f.status=n,f.statusText=(r||a)+"",l?tt.resolveWith(h,[k,a,f]):tt.rejectWith(h,[f,a,w]),f.statusCode(b),b=t,v&&nt.trigger(l?"ajaxSuccess":"ajaxError",[f,u,l?k:w]),it.fireWith(h,[f,a]),v&&(nt.trigger("ajaxComplete",[f,u]),--i.active||i.event.trigger("ajaxStop")))}"object"==typeof n&&(r=n,n=t);r=r||{};var l,a,e,d,g,v,y,p,u=i.ajaxSetup({},r),h=u.context||u,nt=u.context&&(h.nodeType||h.jquery)?i(h):i.event,tt=i.Deferred(),it=i.Callbacks("once memory"),b=u.statusCode||{},rt={},ut={},o=0,ft="canceled",f={readyState:0,getResponseHeader:function(n){var t;if(2===o){if(!p)for(p={};t=oo.exec(d);)p[t[1].toLowerCase()]=t[2];t=p[n.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===o?d:null},setRequestHeader:function(n,t){var i=n.toLowerCase();return o||(n=ut[i]=ut[i]||n,rt[n]=t),this},overrideMimeType:function(n){return o||(u.mimeType=n),this},statusCode:function(n){var t;if(n)if(2>o)for(t in n)b[t]=[b[t],n[t]];else f.always(n[f.status]);return this},abort:function(n){var t=n||ft;return y&&y.abort(t),k(0,t),this}};if(tt.promise(f).complete=it.add,f.success=f.done,f.error=f.fail,u.url=((n||u.url||c)+"").replace(eo,"").replace(ho,w[1]+"//"),u.type=r.method||r.type||u.method||u.type,u.dataTypes=i.trim(u.dataType||"*").toLowerCase().match(s)||[""],null==u.crossDomain&&(l=yu.exec(u.url.toLowerCase()),u.crossDomain=!(!l||l[1]===w[1]&&l[2]===w[2]&&(l[3]||("http:"===l[1]?80:443))==(w[3]||("http:"===w[1]?80:443)))),u.data&&u.processData&&"string"!=typeof u.data&&(u.data=i.param(u.data,u.traditional)),du(wu,u,r,f),2===o)return f;v=u.global;v&&0==i.active++&&i.event.trigger("ajaxStart");u.type=u.type.toUpperCase();u.hasContent=!so.test(u.type);e=u.url;u.hasContent||(u.data&&(e=u.url+=(ai.test(e)?"&":"?")+u.data,delete u.data),u.cache===!1&&(u.url=vu.test(e)?e.replace(vu,"$1_="+li++):e+(ai.test(e)?"&":"?")+"_="+li++));u.ifModified&&(i.lastModified[e]&&f.setRequestHeader("If-Modified-Since",i.lastModified[e]),i.etag[e]&&f.setRequestHeader("If-None-Match",i.etag[e]));(u.data&&u.hasContent&&u.contentType!==!1||r.contentType)&&f.setRequestHeader("Content-Type",u.contentType);f.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+bu+"; q=0.01":""):u.accepts["*"]);for(a in u.headers)f.setRequestHeader(a,u.headers[a]);if(u.beforeSend&&(u.beforeSend.call(h,f,u)===!1||2===o))return f.abort();ft="abort";for(a in{success:1,error:1,complete:1})f[a](u[a]);if(y=du(vi,u,r,f)){f.readyState=1;v&&nt.trigger("ajaxSend",[f,u]);u.async&&u.timeout>0&&(g=setTimeout(function(){f.abort("timeout")},u.timeout));try{o=1;y.send(rt,k)}catch(et){if(!(2>o))throw et;k(-1,et)}}else k(-1,"No Transport");return f},getScript:function(n,r){return i.get(n,t,r,"script")},getJSON:function(n,t,r){return i.get(n,t,r,"json")}});i.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(n){return i.globalEval(n),n}}});i.ajaxPrefilter("script",function(n){n.cache===t&&(n.cache=!1);n.crossDomain&&(n.type="GET",n.global=!1)});i.ajaxTransport("script",function(n){if(n.crossDomain){var u,f=r.head||i("head")[0]||r.documentElement;return{send:function(t,i){u=r.createElement("script");u.async=!0;n.scriptCharset&&(u.charset=n.scriptCharset);u.src=n.url;u.onload=u.onreadystatechange=function(n,t){(t||!u.readyState||/loaded|complete/.test(u.readyState))&&(u.onload=u.onreadystatechange=null,u.parentNode&&u.parentNode.removeChild(u),u=null,t||i(200,"success"))};f.insertBefore(u,f.firstChild)},abort:function(){u&&u.onload(t,!0)}}}});pi=[];lt=/(=)\?(?=&|$)|\?\?/;i.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var n=pi.pop()||i.expando+"_"+li++;return this[n]=!0,n}});i.ajaxPrefilter("json jsonp",function(r,u,f){var e,s,o,h=r.jsonp!==!1&&(lt.test(r.url)?"url":"string"==typeof r.data&&!(r.contentType||"").indexOf("application/x-www-form-urlencoded")&&lt.test(r.data)&&"data");return h||"jsonp"===r.dataTypes[0]?(e=r.jsonpCallback=i.isFunction(r.jsonpCallback)?r.jsonpCallback():r.jsonpCallback,h?r[h]=r[h].replace(lt,"$1"+e):r.jsonp!==!1&&(r.url+=(ai.test(r.url)?"&":"?")+r.jsonp+"="+e),r.converters["script json"]=function(){return o||i.error(e+" was not called"),o[0]},r.dataTypes[0]="json",s=n[e],n[e]=function(){o=arguments},f.always(function(){n[e]=s;r[e]&&(r.jsonpCallback=u.jsonpCallback,pi.push(e));o&&i.isFunction(s)&&s(o[0]);o=s=t}),"script"):t});gu=0;at=n.ActiveXObject&&function(){var n;for(n in g)g[n](t,!0)};i.ajaxSettings.xhr=n.ActiveXObject?function(){return!this.isLocal&&nf()||ao()}:nf;nt=i.ajaxSettings.xhr();i.support.cors=!!nt&&"withCredentials"in nt;nt=i.support.ajax=!!nt;nt&&i.ajaxTransport(function(r){if(!r.crossDomain||i.support.cors){var u;return{send:function(f,e){var h,s,o=r.xhr();if(r.username?o.open(r.type,r.url,r.async,r.username,r.password):o.open(r.type,r.url,r.async),r.xhrFields)for(s in r.xhrFields)o[s]=r.xhrFields[s];r.mimeType&&o.overrideMimeType&&o.overrideMimeType(r.mimeType);r.crossDomain||f["X-Requested-With"]||(f["X-Requested-With"]="XMLHttpRequest");try{for(s in f)o.setRequestHeader(s,f[s])}catch(c){}o.send(r.hasContent&&r.data||null);u=function(n,f){var s,a,l,c;try{if(u&&(f||4===o.readyState))if(u=t,h&&(o.onreadystatechange=i.noop,at&&delete g[h]),f)4!==o.readyState&&o.abort();else{c={};s=o.status;a=o.getAllResponseHeaders();"string"==typeof o.responseText&&(c.text=o.responseText);try{l=o.statusText}catch(y){l=""}s||!r.isLocal||r.crossDomain?1223===s&&(s=204):s=c.text?200:404}}catch(v){f||e(-1,v)}c&&e(s,l,c,a)};r.async?4===o.readyState?setTimeout(u):(h=++gu,at&&(g||(g={},i(n).unload(at)),g[h]=u),o.onreadystatechange=u):u()},abort:function(){u&&u(t,!0)}}}});var tt,vt,vo=/^(?:toggle|show|hide)$/,yo=RegExp("^(?:([+-])=|)("+st+")([a-z%]*)$","i"),po=/queueHooks$/,yt=[ko],ft={"*":[function(n,t){var o,s,r=this.createTween(n,t),e=yo.exec(t),h=r.cur(),u=+h||0,f=1,c=20;if(e){if(o=+e[2],s=e[3]||(i.cssNumber[n]?"":"px"),"px"!==s&&u){u=i.css(r.elem,n,!0)||o||1;do f=f||".5",u/=f,i.style(r.elem,n,u+s);while(f!==(f=r.cur()/h)&&1!==f&&--c)}r.unit=s;r.start=u;r.end=e[1]?u+(e[1]+1)*o:o}return r}]};i.Animation=i.extend(rf,{tweener:function(n,t){i.isFunction(n)?(t=n,n=["*"]):n=n.split(" ");for(var r,u=0,f=n.length;f>u;u++)r=n[u],ft[r]=ft[r]||[],ft[r].unshift(t)},prefilter:function(n,t){t?yt.unshift(n):yt.push(n)}});i.Tween=f;f.prototype={constructor:f,init:function(n,t,r,u,f,e){this.elem=n;this.prop=r;this.easing=f||"swing";this.options=t;this.start=this.now=this.cur();this.end=u;this.unit=e||(i.cssNumber[r]?"":"px")},cur:function(){var n=f.propHooks[this.prop];return n&&n.get?n.get(this):f.propHooks._default.get(this)},run:function(n){var r,t=f.propHooks[this.prop];return this.pos=r=this.options.duration?i.easing[this.easing](n,this.options.duration*n,0,1,this.options.duration):n,this.now=(this.end-this.start)*r+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),t&&t.set?t.set(this):f.propHooks._default.set(this),this}};f.prototype.init.prototype=f.prototype;f.propHooks={_default:{get:function(n){var t;return null==n.elem[n.prop]||n.elem.style&&null!=n.elem.style[n.prop]?(t=i.css(n.elem,n.prop,""),t&&"auto"!==t?t:0):n.elem[n.prop]},set:function(n){i.fx.step[n.prop]?i.fx.step[n.prop](n):n.elem.style&&(null!=n.elem.style[i.cssProps[n.prop]]||i.cssHooks[n.prop])?i.style(n.elem,n.prop,n.now+n.unit):n.elem[n.prop]=n.now}}};f.propHooks.scrollTop=f.propHooks.scrollLeft={set:function(n){n.elem.nodeType&&n.elem.parentNode&&(n.elem[n.prop]=n.now)}};i.each(["toggle","show","hide"],function(n,t){var r=i.fn[t];i.fn[t]=function(n,i,u){return null==n||"boolean"==typeof n?r.apply(this,arguments):this.animate(pt(t,!0),n,i,u)}});i.fn.extend({fadeTo:function(n,t,i,r){return this.filter(ut).css("opacity",0).show().end().animate({opacity:t},n,i,r)},animate:function(n,t,r,u){var o=i.isEmptyObject(n),e=i.speed(t,r,u),f=function(){var t=rf(this,i.extend({},n),e);f.finish=function(){t.stop(!0)};(o||i._data(this,"finish"))&&t.stop(!0)};return f.finish=f,o||e.queue===!1?this.each(f):this.queue(e.queue,f)},stop:function(n,r,u){var f=function(n){var t=n.stop;delete n.stop;t(u)};return"string"!=typeof n&&(u=r,r=n,n=t),r&&n!==!1&&this.queue(n||"fx",[]),this.each(function(){var o=!0,t=null!=n&&n+"queueHooks",e=i.timers,r=i._data(this);if(t)r[t]&&r[t].stop&&f(r[t]);else for(t in r)r[t]&&r[t].stop&&po.test(t)&&f(r[t]);for(t=e.length;t--;)e[t].elem!==this||null!=n&&e[t].queue!==n||(e[t].anim.stop(u),o=!1,e.splice(t,1));(o||!u)&&i.dequeue(this,n)})},finish:function(n){return n!==!1&&(n=n||"fx"),this.each(function(){var t,f=i._data(this),r=f[n+"queue"],e=f[n+"queueHooks"],u=i.timers,o=r?r.length:0;for(f.finish=!0,i.queue(this,n,[]),e&&e.cur&&e.cur.finish&&e.cur.finish.call(this),t=u.length;t--;)u[t].elem===this&&u[t].queue===n&&(u[t].anim.stop(!0),u.splice(t,1));for(t=0;o>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete f.finish})}});i.each({slideDown:pt("show"),slideUp:pt("hide"),slideToggle:pt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(n,t){i.fn[n]=function(n,i,r){return this.animate(t,n,i,r)}});i.speed=function(n,t,r){var u=n&&"object"==typeof n?i.extend({},n):{complete:r||!r&&t||i.isFunction(n)&&n,duration:n,easing:r&&t||t&&!i.isFunction(t)&&t};return u.duration=i.fx.off?0:"number"==typeof u.duration?u.duration:u.duration in i.fx.speeds?i.fx.speeds[u.duration]:i.fx.speeds._default,(null==u.queue||u.queue===!0)&&(u.queue="fx"),u.old=u.complete,u.complete=function(){i.isFunction(u.old)&&u.old.call(this);u.queue&&i.dequeue(this,u.queue)},u};i.easing={linear:function(n){return n},swing:function(n){return.5-Math.cos(n*Math.PI)/2}};i.timers=[];i.fx=f.prototype.init;i.fx.tick=function(){var u,n=i.timers,r=0;for(tt=i.now();n.length>r;r++)u=n[r],u()||n[r]!==u||n.splice(r--,1);n.length||i.fx.stop();tt=t};i.fx.timer=function(n){n()&&i.timers.push(n)&&i.fx.start()};i.fx.interval=13;i.fx.start=function(){vt||(vt=setInterval(i.fx.tick,i.fx.interval))};i.fx.stop=function(){clearInterval(vt);vt=null};i.fx.speeds={slow:600,fast:200,_default:400};i.fx.step={};i.expr&&i.expr.filters&&(i.expr.filters.animated=function(n){return i.grep(i.timers,function(t){return n===t.elem}).length});i.fn.offset=function(n){if(arguments.length)return n===t?this:this.each(function(t){i.offset.setOffset(this,n,t)});var r,e,f={top:0,left:0},u=this[0],s=u&&u.ownerDocument;if(s)return r=s.documentElement,i.contains(r,u)?(typeof u.getBoundingClientRect!==o&&(f=u.getBoundingClientRect()),e=uf(s),{top:f.top+(e.pageYOffset||r.scrollTop)-(r.clientTop||0),left:f.left+(e.pageXOffset||r.scrollLeft)-(r.clientLeft||0)}):f};i.offset={setOffset:function(n,t,r){var f=i.css(n,"position");"static"===f&&(n.style.position="relative");var e=i(n),o=e.offset(),l=i.css(n,"top"),a=i.css(n,"left"),v=("absolute"===f||"fixed"===f)&&i.inArray("auto",[l,a])>-1,u={},s={},h,c;v?(s=e.position(),h=s.top,c=s.left):(h=parseFloat(l)||0,c=parseFloat(a)||0);i.isFunction(t)&&(t=t.call(n,r,o));null!=t.top&&(u.top=t.top-o.top+h);null!=t.left&&(u.left=t.left-o.left+c);"using"in t?t.using.call(n,u):e.css(u)}};i.fn.extend({position:function(){if(this[0]){var n,r,t={top:0,left:0},u=this[0];return"fixed"===i.css(u,"position")?r=u.getBoundingClientRect():(n=this.offsetParent(),r=this.offset(),i.nodeName(n[0],"html")||(t=n.offset()),t.top+=i.css(n[0],"borderTopWidth",!0),t.left+=i.css(n[0],"borderLeftWidth",!0)),{top:r.top-t.top-i.css(u,"marginTop",!0),left:r.left-t.left-i.css(u,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var n=this.offsetParent||r.documentElement;n&&!i.nodeName(n,"html")&&"static"===i.css(n,"position");)n=n.offsetParent;return n||r.documentElement})}});i.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(n,r){var u=/Y/.test(r);i.fn[n]=function(f){return i.access(this,function(n,f,e){var o=uf(n);return e===t?o?r in o?o[r]:o.document.documentElement[f]:n[f]:(o?o.scrollTo(u?i(o).scrollLeft():e,u?e:i(o).scrollTop()):n[f]=e,t)},n,f,arguments.length,null)}});i.each({Height:"height",Width:"width"},function(n,r){i.each({padding:"inner"+n,content:r,"":"outer"+n},function(u,f){i.fn[f]=function(f,e){var o=arguments.length&&(u||"boolean"!=typeof f),s=u||(f===!0||e===!0?"margin":"border");return i.access(this,function(r,u,f){var e;return i.isWindow(r)?r.document.documentElement["client"+n]:9===r.nodeType?(e=r.documentElement,Math.max(r.body["scroll"+n],e["scroll"+n],r.body["offset"+n],e["offset"+n],e["client"+n])):f===t?i.css(r,u,s):i.style(r,u,f,s)},r,o?f:t,o,null)}})});n.jQuery=n.$=i;"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return i})})(window);!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=n(require("jquery")):n(jQuery)}(function(n){n.extend(n.fn,{validate:function(t){if(!this.length)return void(t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var i=n.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new n.validator(t,this[0]),n.data(this[0],"validator",i),i.settings.onsubmit&&(this.on("click.validate",":submit",function(t){i.submitButton=t.currentTarget;n(this).hasClass("cancel")&&(i.cancelSubmit=!0);void 0!==n(this).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.on("submit.validate",function(t){function r(){var r,u;return i.submitButton&&(i.settings.submitHandler||i.formSubmitted)&&(r=n("<input type='hidden'/>").attr("name",i.submitButton.name).val(n(i.submitButton).val()).appendTo(i.currentForm)),!i.settings.submitHandler||(u=i.settings.submitHandler.call(i,i.currentForm,t),r&&r.remove(),void 0!==u&&u)}return i.settings.debug&&t.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,r()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):r():(i.focusInvalid(),!1)})),i)},valid:function(){var t,i,r;return n(this[0]).is("form")?t=this.validate().form():(r=[],t=!0,i=n(this[0].form).validate(),this.each(function(){t=i.element(this)&&t;t||(r=r.concat(i.errorList))}),i.errorList=r),t},rules:function(t,i){var e,s,f,u,o,h,r=this[0];if(null!=r&&(!r.form&&r.hasAttribute("contenteditable")&&(r.form=this.closest("form")[0],r.name=this.attr("name")),null!=r.form)){if(t)switch(e=n.data(r.form,"validator").settings,s=e.rules,f=n.validator.staticRules(r),t){case"add":n.extend(f,n.validator.normalizeRule(i));delete f.messages;s[r.name]=f;i.messages&&(e.messages[r.name]=n.extend(e.messages[r.name],i.messages));break;case"remove":return i?(h={},n.each(i.split(/\s/),function(n,t){h[t]=f[t];delete f[t]}),h):(delete s[r.name],f)}return u=n.validator.normalizeRules(n.extend({},n.validator.classRules(r),n.validator.attributeRules(r),n.validator.dataRules(r),n.validator.staticRules(r)),r),u.required&&(o=u.required,delete u.required,u=n.extend({required:o},u)),u.remote&&(o=u.remote,delete u.remote,u=n.extend(u,{remote:o})),u}}});n.extend(n.expr.pseudos||n.expr[":"],{blank:function(t){return!n.trim(""+n(t).val())},filled:function(t){var i=n(t).val();return null!==i&&!!n.trim(""+i)},unchecked:function(t){return!n(t).prop("checked")}});n.validator=function(t,i){this.settings=n.extend(!0,{},n.validator.defaults,t);this.currentForm=i;this.init()};n.validator.format=function(t,i){return 1===arguments.length?function(){var i=n.makeArray(arguments);return i.unshift(t),n.validator.format.apply(this,i)}:void 0===i?t:(arguments.length>2&&i.constructor!==Array&&(i=n.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),n.each(i,function(n,i){t=t.replace(new RegExp("\\{"+n+"\\}","g"),function(){return i})}),t)};n.extend(n.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:n([]),errorLabelContainer:n([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(n){this.lastActive=n;this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,n,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(n)))},onfocusout:function(n){!this.checkable(n)&&(n.name in this.submitted||!this.optional(n))&&this.element(n)},onkeyup:function(t,i){9===i.which&&""===this.elementValue(t)||n.inArray(i.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])!==-1||(t.name in this.submitted||t.name in this.invalid)&&this.element(t)},onclick:function(n){n.name in this.submitted?this.element(n):n.parentNode.name in this.submitted&&this.element(n.parentNode)},highlight:function(t,i,r){"radio"===t.type?this.findByName(t.name).addClass(i).removeClass(r):n(t).addClass(i).removeClass(r)},unhighlight:function(t,i,r){"radio"===t.type?this.findByName(t.name).removeClass(i).addClass(r):n(t).removeClass(i).addClass(r)}},setDefaults:function(t){n.extend(n.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:n.validator.format("Please enter no more than {0} characters."),minlength:n.validator.format("Please enter at least {0} characters."),rangelength:n.validator.format("Please enter a value between {0} and {1} characters long."),range:n.validator.format("Please enter a value between {0} and {1}."),max:n.validator.format("Please enter a value less than or equal to {0}."),min:n.validator.format("Please enter a value greater than or equal to {0}."),step:n.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function i(t){!this.form&&this.hasAttribute("contenteditable")&&(this.form=n(this).closest("form")[0],this.name=n(this).attr("name"));var r=n.data(this.form,"validator"),u="on"+t.type.replace(/^validate/,""),i=r.settings;i[u]&&!n(this).is(i.ignore)&&i[u].call(r,this,t)}this.labelContainer=n(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||n(this.currentForm);this.containers=n(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var t,r=this.groups={};n.each(this.settings.groups,function(t,i){"string"==typeof i&&(i=i.split(/\s/));n.each(i,function(n,i){r[i]=t})});t=this.settings.rules;n.each(t,function(i,r){t[i]=n.validator.normalizeRule(r)});n(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",i).on("click.validate","select, option, [type='radio'], [type='checkbox']",i);this.settings.invalidHandler&&n(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),n.extend(this.submitted,this.errorMap),this.invalid=n.extend({},this.errorMap),this.valid()||n(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var n=0,t=this.currentElements=this.elements();t[n];n++)this.check(t[n]);return this.valid()},element:function(t){var e,o,i=this.clean(t),r=this.validationTargetFor(i),u=this,f=!0;return void 0===r?delete this.invalid[i.name]:(this.prepareElement(r),this.currentElements=n(r),o=this.groups[r.name],o&&n.each(this.groups,function(n,t){t===o&&n!==r.name&&(i=u.validationTargetFor(u.clean(u.findByName(n))),i&&i.name in u.invalid&&(u.currentElements.push(i),f=u.check(i)&&f))}),e=this.check(r)!==!1,f=f&&e,this.invalid[r.name]=e?!1:!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n(t).attr("aria-invalid",!e)),f},showErrors:function(t){if(t){var i=this;n.extend(this.errorMap,t);this.errorList=n.map(this.errorMap,function(n,t){return{message:n,element:i.findByName(t)[0]}});this.successList=n.grep(this.successList,function(n){return!(n.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){n.fn.resetForm&&n(this.currentForm).resetForm();this.invalid={};this.submitted={};this.prepareForm();this.hideErrors();var t=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(t)},resetElements:function(n){var t;if(this.settings.unhighlight)for(t=0;n[t];t++)this.settings.unhighlight.call(this,n[t],this.settings.errorClass,""),this.findByName(n[t].name).removeClass(this.settings.validClass);else n.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(n){var t,i=0;for(t in n)void 0!==n[t]&&null!==n[t]&&n[t]!==!1&&i++;return i},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(n){n.not(this.containers).text("");this.addWrapper(n).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{n(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&1===n.grep(this.errorList,function(n){return n.element.name===t.name}).length&&t},elements:function(){var t=this,i={};return n(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var r=this.name||n(this).attr("name");return!r&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=n(this).closest("form")[0],this.name=r),!(r in i||!t.objectLength(n(this).rules()))&&(i[r]=!0,!0)})},clean:function(t){return n(t)[0]},errors:function(){var t=this.settings.errorClass.split(" ").join(".");return n(this.settings.errorElement+"."+t,this.errorContext)},resetInternals:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=n([]);this.toHide=n([])},reset:function(){this.resetInternals();this.currentElements=n([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(n){this.reset();this.toHide=this.errorsFor(n)},elementValue:function(t){var i,r,f=n(t),u=t.type;return"radio"===u||"checkbox"===u?this.findByName(t.name).filter(":checked").val():"number"===u&&"undefined"!=typeof t.validity?t.validity.badInput?"NaN":f.val():(i=t.hasAttribute("contenteditable")?f.text():f.val(),"file"===u?"C:\\fakepath\\"===i.substr(0,12)?i.substr(12):(r=i.lastIndexOf("/"),r>=0?i.substr(r+1):(r=i.lastIndexOf("\\"),r>=0?i.substr(r+1):i)):"string"==typeof i?i.replace(/\r/g,""):i)},check:function(t){t=this.validationTargetFor(this.clean(t));var u,f,r,e,i=n(t).rules(),c=n.map(i,function(n,t){return t}).length,h=!1,o=this.elementValue(t);if("function"==typeof i.normalizer?e=i.normalizer:"function"==typeof this.settings.normalizer&&(e=this.settings.normalizer),e){if(o=e.call(t,o),"string"!=typeof o)throw new TypeError("The normalizer should return a string value.");delete i.normalizer}for(f in i){r={method:f,parameters:i[f]};try{if(u=n.validator.methods[f].call(this,o,t,r.parameters),"dependency-mismatch"===u&&1===c){h=!0;continue}if(h=!1,"pending"===u)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!u)return this.formatAndAdd(t,r),!1}catch(s){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+r.method+"' method.",s),s instanceof TypeError&&(s.message+=".  Exception occurred when checking element "+t.id+", check the '"+r.method+"' method."),s;}}if(!h)return this.objectLength(i)&&this.successList.push(t),!0},customDataMessage:function(t,i){return n(t).data("msg"+i.charAt(0).toUpperCase()+i.substring(1).toLowerCase())||n(t).data("msg")},customMessage:function(n,t){var i=this.settings.messages[n];return i&&(i.constructor===String?i:i[t])},findDefined:function(){for(var n=0;n<arguments.length;n++)if(void 0!==arguments[n])return arguments[n]},defaultMessage:function(t,i){"string"==typeof i&&(i={method:i});var r=this.findDefined(this.customMessage(t.name,i.method),this.customDataMessage(t,i.method),!this.settings.ignoreTitle&&t.title||void 0,n.validator.messages[i.method],"<strong>Warning: No message defined for "+t.name+"<\/strong>"),u=/\$?\{(\d+)\}/g;return"function"==typeof r?r=r.call(this,i.parameters,t):u.test(r)&&(r=n.validator.format(r.replace(u,"{$1}"),i.parameters)),r},formatAndAdd:function(n,t){var i=this.defaultMessage(n,t);this.errorList.push({message:i,element:n,method:t.method});this.errorMap[n.name]=i;this.submitted[n.name]=i},addWrapper:function(n){return this.settings.wrapper&&(n=n.add(n.parent(this.settings.wrapper))),n},defaultShowErrors:function(){for(var i,t,n=0;this.errorList[n];n++)t=this.errorList[n],this.settings.highlight&&this.settings.highlight.call(this,t.element,this.settings.errorClass,this.settings.validClass),this.showLabel(t.element,t.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(n=0;this.successList[n];n++)this.showLabel(this.successList[n]);if(this.settings.unhighlight)for(n=0,i=this.validElements();i[n];n++)this.settings.unhighlight.call(this,i[n],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return n(this.errorList).map(function(){return this.element})},showLabel:function(t,i){var u,s,e,o,r=this.errorsFor(t),h=this.idOrName(t),f=n(t).attr("aria-describedby");r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(i)):(r=n("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(i||""),u=r,this.settings.wrapper&&(u=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(u):this.settings.errorPlacement?this.settings.errorPlacement.call(this,u,n(t)):u.insertAfter(t),r.is("label")?r.attr("for",h):0===r.parents("label[for='"+this.escapeCssMeta(h)+"']").length&&(e=r.attr("id"),f?f.match(new RegExp("\\b"+this.escapeCssMeta(e)+"\\b"))||(f+=" "+e):f=e,n(t).attr("aria-describedby",f),s=this.groups[t.name],s&&(o=this,n.each(o.groups,function(t,i){i===s&&n("[name='"+o.escapeCssMeta(t)+"']",o.currentForm).attr("aria-describedby",r.attr("id"))}))));!i&&this.settings.success&&(r.text(""),"string"==typeof this.settings.success?r.addClass(this.settings.success):this.settings.success(r,t));this.toShow=this.toShow.add(r)},errorsFor:function(t){var r=this.escapeCssMeta(this.idOrName(t)),u=n(t).attr("aria-describedby"),i="label[for='"+r+"'], label[for='"+r+"'] *";return u&&(i=i+", #"+this.escapeCssMeta(u).replace(/\s+/g,", #")),this.errors().filter(i)},escapeCssMeta:function(n){return n.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(n){return this.groups[n.name]||(this.checkable(n)?n.name:n.id||n.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name)),n(t).not(this.settings.ignore)[0]},checkable:function(n){return/radio|checkbox/i.test(n.type)},findByName:function(t){return n(this.currentForm).find("[name='"+this.escapeCssMeta(t)+"']")},getLength:function(t,i){switch(i.nodeName.toLowerCase()){case"select":return n("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return t.length},depend:function(n,t){return!this.dependTypes[typeof n]||this.dependTypes[typeof n](n,t)},dependTypes:{boolean:function(n){return n},string:function(t,i){return!!n(t,i.form).length},"function":function(n,t){return n(t)}},optional:function(t){var i=this.elementValue(t);return!n.validator.methods.required.call(this,i,t)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,n(t).addClass(this.settings.pendingClass),this.pending[t.name]=!0)},stopRequest:function(t,i){this.pendingRequest--;this.pendingRequest<0&&(this.pendingRequest=0);delete this.pending[t.name];n(t).removeClass(this.settings.pendingClass);i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(n(this.currentForm).submit(),this.submitButton&&n("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(n(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t,i){return i="string"==typeof i&&i||"remote",n.data(t,"previousValue")||n.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,{method:i})})},destroy:function(){this.resetForm();n(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,i){t.constructor===String?this.classRuleSettings[t]=i:n.extend(this.classRuleSettings,t)},classRules:function(t){var i={},r=n(t).attr("class");return r&&n.each(r.split(" "),function(){this in n.validator.classRuleSettings&&n.extend(i,n.validator.classRuleSettings[this])}),i},normalizeAttributeRule:function(n,t,i,r){/min|max|step/.test(i)&&(null===t||/number|range|text/.test(t))&&(r=Number(r),isNaN(r)&&(r=void 0));r||0===r?n[i]=r:t===i&&"range"!==t&&(n[i]=!0)},attributeRules:function(t){var r,i,u={},f=n(t),e=t.getAttribute("type");for(r in n.validator.methods)"required"===r?(i=t.getAttribute(r),""===i&&(i=!0),i=!!i):i=f.attr(r),this.normalizeAttributeRule(u,e,r,i);return u.maxlength&&/-1|2147483647|524288/.test(u.maxlength)&&delete u.maxlength,u},dataRules:function(t){var i,r,u={},f=n(t),e=t.getAttribute("type");for(i in n.validator.methods)r=f.data("rule"+i.charAt(0).toUpperCase()+i.substring(1).toLowerCase()),this.normalizeAttributeRule(u,e,i,r);return u},staticRules:function(t){var i={},r=n.data(t.form,"validator");return r.settings.rules&&(i=n.validator.normalizeRule(r.settings.rules[t.name])||{}),i},normalizeRules:function(t,i){return n.each(t,function(r,u){if(u===!1)return void delete t[r];if(u.param||u.depends){var f=!0;switch(typeof u.depends){case"string":f=!!n(u.depends,i.form).length;break;case"function":f=u.depends.call(i,i)}f?t[r]=void 0===u.param||u.param:(n.data(i.form,"validator").resetElements(n(i)),delete t[r])}}),n.each(t,function(r,u){t[r]=n.isFunction(u)&&"normalizer"!==r?u(i):u}),n.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),n.each(["rangelength","range"],function(){var i;t[this]&&(n.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:"string"==typeof t[this]&&(i=t[this].replace(/[\[\]]/g,"").split(/[\s,]+/),t[this]=[Number(i[0]),Number(i[1])]))}),n.validator.autoCreateRanges&&(null!=t.min&&null!=t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),null!=t.minlength&&null!=t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if("string"==typeof t){var i={};n.each(t.split(/\s/),function(){i[this]=!0});t=i}return t},addMethod:function(t,i,r){n.validator.methods[t]=i;n.validator.messages[t]=void 0!==r?r:n.validator.messages[t];i.length<3&&n.validator.addClassRules(t,n.validator.normalizeRule(t))},methods:{required:function(t,i,r){if(!this.depend(r,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var u=n(i).val();return u&&u.length>0}return this.checkable(i)?this.getLength(t,i)>0:t.length>0},email:function(n,t){return this.optional(t)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(n)},url:function(n,t){return this.optional(t)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(n)},date:function(n,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(n).toString())},dateISO:function(n,t){return this.optional(t)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(n)},number:function(n,t){return this.optional(t)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(n)},digits:function(n,t){return this.optional(t)||/^\d+$/.test(n)},minlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(t,i);return this.optional(i)||u>=r},maxlength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(t,i);return this.optional(i)||u<=r},rangelength:function(t,i,r){var u=n.isArray(t)?t.length:this.getLength(t,i);return this.optional(i)||u>=r[0]&&u<=r[1]},min:function(n,t,i){return this.optional(t)||n>=i},max:function(n,t,i){return this.optional(t)||n<=i},range:function(n,t,i){return this.optional(t)||n>=i[0]&&n<=i[1]},step:function(t,i,r){var u,f=n(i).attr("type"),h="Step attribute on input type "+f+" is not supported.",c=new RegExp("\\b"+f+"\\b"),l=f&&!c.test("text,number,range"),e=function(n){var t=(""+n).match(/(?:\.(\d+))?$/);return t&&t[1]?t[1].length:0},o=function(n){return Math.round(n*Math.pow(10,u))},s=!0;if(l)throw new Error(h);return u=e(r),(e(t)>u||o(t)%o(r)!=0)&&(s=!1),this.optional(i)||s},equalTo:function(t,i,r){var u=n(r);return this.settings.onfocusout&&u.not(".validate-equalTo-blur").length&&u.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){n(i).valid()}),t===u.val()},remote:function(t,i,r,u){if(this.optional(i))return"dependency-mismatch";u="string"==typeof u&&u||"remote";var f,o,s,e=this.previousValue(i,u);return this.settings.messages[i.name]||(this.settings.messages[i.name]={}),e.originalMessage=e.originalMessage||this.settings.messages[i.name][u],this.settings.messages[i.name][u]=e.message,r="string"==typeof r&&{url:r}||r,s=n.param(n.extend({data:t},r.data)),e.old===s?e.valid:(e.old=s,f=this,this.startRequest(i),o={},o[i.name]=t,n.ajax(n.extend(!0,{mode:"abort",port:"validate"+i.name,dataType:"json",data:o,context:f.currentForm,success:function(n){var r,s,h,o=n===!0||"true"===n;f.settings.messages[i.name][u]=e.originalMessage;o?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(i),f.formSubmitted=h,f.successList.push(i),f.invalid[i.name]=!1,f.showErrors()):(r={},s=n||f.defaultMessage(i,{method:u,parameters:t}),r[i.name]=e.message=s,f.invalid[i.name]=!0,f.showErrors(r));e.valid=o;f.stopRequest(i,o)}},r)),"pending")}}});var i,t={};return n.ajaxPrefilter?n.ajaxPrefilter(function(n,i,r){var u=n.port;"abort"===n.mode&&(t[u]&&t[u].abort(),t[u]=r)}):(i=n.ajax,n.ajax=function(r){var f=("mode"in r?r:n.ajaxSettings).mode,u=("port"in r?r:n.ajaxSettings).port;return"abort"===f?(t[u]&&t[u].abort(),t[u]=i.apply(this,arguments),t[u]):i.apply(this,arguments)}),n}),function(n){function i(n,t,i){n.rules[t]=i;n.message&&(n.messages[t]=n.message)}function h(n){return n.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(n){return n.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function e(n){return n.substr(0,n.lastIndexOf(".")+1)}function o(n,t){return n.indexOf("*.")===0&&(n=n.replace("*.",t)),n}function c(t,i){var r=n(this).find("[data-valmsg-for='"+f(i[0].name)+"']"),u=r.attr("data-valmsg-replace"),e=u?n.parseJSON(u)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error");t.data("unobtrusiveContainer",r);e?(r.empty(),t.removeClass("input-validation-error").appendTo(r)):t.hide()}function l(t,i){var u=n(this).find("[data-valmsg-summary=true]"),r=u.find("ul");r&&r.length&&i.errorList.length&&(r.empty(),u.addClass("validation-summary-errors").removeClass("validation-summary-valid"),n.each(i.errorList,function(){n("<li />").html(this.message).appendTo(r)}))}function a(t){var i=t.data("unobtrusiveContainer"),r=i.attr("data-valmsg-replace"),u=r?n.parseJSON(r):null;i&&(i.addClass("field-validation-valid").removeClass("field-validation-error"),t.removeData("unobtrusiveContainer"),u&&i.empty())}function v(){var t=n(this),i="__jquery_unobtrusive_validation_form_reset";if(!t.data(i)){t.data(i,!0);try{t.data("validator").resetForm()}finally{t.removeData(i)}t.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");t.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function s(t){var i=n(t),f=i.data(u),s=n.proxy(v,t),e=r.unobtrusive.options||{},o=function(i,r){var u=e[i];u&&n.isFunction(u)&&u.apply(t,r)};return f||(f={options:{errorClass:e.errorClass||"input-validation-error",errorElement:e.errorElement||"span",errorPlacement:function(){c.apply(t,arguments);o("errorPlacement",arguments)},invalidHandler:function(){l.apply(t,arguments);o("invalidHandler",arguments)},messages:{},rules:{},success:function(){a.apply(t,arguments);o("success",arguments)}},attachValidation:function(){i.off("reset."+u,s).on("reset."+u,s).validate(this.options)},validate:function(){return i.validate(),i.valid()}},i.data(u,f)),f}var r=n.validator,t,u="unobtrusiveValidation";r.unobtrusive={adapters:[],parseElement:function(t,i){var u=n(t),f=u.parents("form")[0],r,e,o;f&&(r=s(f),r.options.rules[t.name]=e={},r.options.messages[t.name]=o={},n.each(this.adapters,function(){var i="data-val-"+this.name,r=u.attr(i),s={};r!==undefined&&(i+="-",n.each(this.params,function(){s[this]=u.attr(i+this)}),this.adapt({element:t,form:f,message:r,params:s,rules:e,messages:o}))}),n.extend(e,{__dummy__:!0}),i||r.attachValidation())},parse:function(t){var i=n(t),u=i.parents().addBack().filter("form").add(i.find("form")).has("[data-val=true]");i.find("[data-val=true]").each(function(){r.unobtrusive.parseElement(this,!0)});u.each(function(){var n=s(this);n&&n.attachValidation()})}};t=r.unobtrusive.adapters;t.add=function(n,t,i){return i||(i=t,t=[]),this.push({name:n,params:t,adapt:i}),this};t.addBool=function(n,t){return this.add(n,function(r){i(r,t||n,!0)})};t.addMinMax=function(n,t,r,u,f,e){return this.add(n,[f||"min",e||"max"],function(n){var f=n.params.min,e=n.params.max;f&&e?i(n,u,[f,e]):f?i(n,t,f):e&&i(n,r,e)})};t.addSingleVal=function(n,t,r){return this.add(n,[t||"val"],function(u){i(u,r||n,u.params[t])})};r.addMethod("__dummy__",function(){return!0});r.addMethod("regex",function(n,t,i){var r;return this.optional(t)?!0:(r=new RegExp(i).exec(n),r&&r.index===0&&r[0].length===n.length)});r.addMethod("nonalphamin",function(n,t,i){var r;return i&&(r=n.match(/\W/g),r=r&&r.length>=i),r});r.methods.extension?(t.addSingleVal("accept","mimtype"),t.addSingleVal("extension","extension")):t.addSingleVal("extension","extension","accept");t.addSingleVal("regex","pattern");t.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");t.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");t.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength");t.add("equalto",["other"],function(t){var r=e(t.element.name),u=t.params.other,s=o(u,r),h=n(t.form).find(":input").filter("[name='"+f(s)+"']")[0];i(t,"equalTo",h)});t.add("required",function(n){(n.element.tagName.toUpperCase()!=="INPUT"||n.element.type.toUpperCase()!=="CHECKBOX")&&i(n,"required",!0)});t.add("remote",["url","type","additionalfields"],function(t){var r={url:t.params.url,type:t.params.type||"GET",data:{}},u=e(t.element.name);n.each(h(t.params.additionalfields||t.element.name),function(i,e){var s=o(e,u);r.data[s]=function(){var i=n(t.form).find(":input").filter("[name='"+f(s)+"']");return i.is(":checkbox")?i.filter(":checked").val()||i.filter(":hidden").val()||"":i.is(":radio")?i.filter(":checked").val()||"":i.val()}});i(t,"remote",r)});t.add("password",["min","nonalphamin","regex"],function(n){n.params.min&&i(n,"minlength",n.params.min);n.params.nonalphamin&&i(n,"nonalphamin",n.params.nonalphamin);n.params.regex&&i(n,"regex",n.params.regex)});n(function(){r.unobtrusive.parse(document)})}(jQuery),function(n,t,i){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?module.exports=n(require("jquery")):n(t||i)}(function(n){"use strict";var i=function(t,i,r){var u={invalid:[],getCaret:function(){try{var n,i=0,e=t.get(0),f=document.selection,r=e.selectionStart;return f&&navigator.appVersion.indexOf("MSIE 10")===-1?(n=f.createRange(),n.moveStart("character",-u.val().length),i=n.text.length):(r||r==="0")&&(i=r),i}catch(o){}},setCaret:function(n){try{if(t.is(":focus")){var i,r=t.get(0);r.setSelectionRange?r.setSelectionRange(n,n):(i=r.createTextRange(),i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",n),i.select())}}catch(u){}},events:function(){t.on("keydown.mask",function(n){t.data("mask-keycode",n.keyCode||n.which);t.data("mask-previus-value",t.val());t.data("mask-previus-caret-pos",u.getCaret());u.maskDigitPosMapOld=u.maskDigitPosMap}).on(n.jMaskGlobals.useInput?"input.mask":"keyup.mask",u.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){t.keydown().keyup()},100)}).on("change.mask",function(){t.data("changed",!0)}).on("blur.mask",function(){e===u.val()||t.data("changed")||t.trigger("change");t.data("changed",!1)}).on("blur.mask",function(){e=u.val()}).on("focus.mask",function(t){r.selectOnFocus===!0&&n(t.target).select()}).on("focusout.mask",function(){r.clearIfNotMatch&&!o.test(u.val())&&u.val("")})},getRegexMask:function(){for(var u=[],r,e,h,s,t,o,n=0;n<i.length;n++)r=f.translation[i.charAt(n)],r?(e=r.pattern.toString().replace(/.{1}$|^.{1}/g,""),h=r.optional,s=r.recursive,s?(u.push(i.charAt(n)),t={digit:i.charAt(n),pattern:e}):u.push(!h&&!s?e:e+"?")):u.push(i.charAt(n).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));return o=u.join(""),t&&(o=o.replace(new RegExp("("+t.digit+"(.*"+t.digit+")?)"),"($1)?").replace(new RegExp(t.digit,"g"),t.pattern)),new RegExp(o)},destroyEvents:function(){t.off(["input","keydown","keyup","paste","drop","blur","focusout",""].join(".mask "))},val:function(n){var u=t.is("input"),i=u?"val":"text",r;return arguments.length>0?(t[i]()!==n&&t[i](n),r=t):r=t[i](),r},calculateCaretPosition:function(){var o=t.data("mask-previus-value")||"",s=u.getMasked(),n=u.getCaret(),v;if(o!==s){for(var r=t.data("mask-previus-caret-pos")||0,h=s.length,c=o.length,l=0,a=0,f=0,e=0,i=0,i=n;i<h;i++){if(!u.maskDigitPosMap[i])break;a++}for(i=n-1;i>=0;i--){if(!u.maskDigitPosMap[i])break;l++}for(i=n-1;i>=0;i--)u.maskDigitPosMap[i]&&f++;for(i=r-1;i>=0;i--)u.maskDigitPosMapOld[i]&&e++;n>c?n=h*10:r>=n&&r!==c?u.maskDigitPosMapOld[n]||(v=n,n-=e-f,n-=l,u.maskDigitPosMap[n]&&(n=v)):n>r&&(n+=f-e,n+=a)}return n},behaviour:function(i){var r,e,o;return i=i||window.event,u.invalid=[],r=t.data("mask-keycode"),n.inArray(r,f.byPassKeys)===-1?(e=u.getMasked(),o=u.getCaret(),setTimeout(function(){u.setCaret(u.calculateCaretPosition())},n.jMaskGlobals.keyStrokeCompensation),u.val(e),u.setCaret(o),u.callbacks(i)):void 0},getMasked:function(n,t){var c=[],rt=t===undefined?u.val():t+"",e=0,y=i.length,o=0,p=rt.length,s=1,w="push",l=-1,k=0,d=[],a,g,nt,tt,it;for(r.reverse?(w="unshift",s=-1,a=0,e=y-1,o=p-1,g=function(){return e>-1&&o>-1}):(a=y-1,g=function(){return e<y&&o<p});g();){var b=i.charAt(e),v=rt.charAt(o),h=f.translation[b];h?(v.match(h.pattern)?(c[w](v),h.recursive&&(l===-1?l=e:e===a&&e!==l&&(e=l-s),a===l&&(e-=s)),e+=s):v===nt?(k--,nt=undefined):h.optional?(e+=s,o-=s):h.fallback?(c[w](h.fallback),e+=s,o-=s):u.invalid.push({p:o,v:v,e:h.pattern}),o+=s):(n||c[w](b),v===b?(d.push(o),o+=s):(nt=b,d.push(o+k),k++),e+=s)}return tt=i.charAt(a),y!==p+1||f.translation[tt]||c.push(tt),it=c.join(""),u.mapMaskdigitPositions(it,d,p),it},mapMaskdigitPositions:function(n,t,i){var e=r.reverse?n.length-i:0,f;for(u.maskDigitPosMap={},f=0;f<t.length;f++)u.maskDigitPosMap[t[f]+e]=1},callbacks:function(n){var f=u.val(),h=f!==e,s=[f,n,t,r],o=function(n,t,i){typeof r[n]=="function"&&t&&r[n].apply(this,i)};o("onChange",h===!0,s);o("onKeyPress",h===!0,s);o("onComplete",f.length===i.length,s);o("onInvalid",u.invalid.length>0,[f,n,t,u.invalid,r])}},f,e,o;t=n(t);f=this;e=u.val();i=typeof i=="function"?i(u.val(),undefined,t,r):i;f.mask=i;f.options=r;f.remove=function(){var n=u.getCaret();return f.options.placeholder&&t.removeAttr("placeholder"),t.data("mask-maxlength")&&t.removeAttr("maxlength"),u.destroyEvents(),u.val(f.getCleanVal()),u.setCaret(n),t};f.getCleanVal=function(){return u.getMasked(!0)};f.getMaskedVal=function(n){return u.getMasked(!1,n)};f.init=function(e){var s,h,c,l;if(e=e||!1,r=r||{},f.clearIfNotMatch=n.jMaskGlobals.clearIfNotMatch,f.byPassKeys=n.jMaskGlobals.byPassKeys,f.translation=n.extend({},n.jMaskGlobals.translation,r.translation),f=n.extend(!0,{},f,r),o=u.getRegexMask(),e)u.events(),u.val(u.getMasked());else{for(r.placeholder&&t.attr("placeholder",r.placeholder),t.data("mask")&&t.attr("autocomplete","off"),s=0,h=!0;s<i.length;s++)if(c=f.translation[i.charAt(s)],c&&c.recursive){h=!1;break}h&&t.attr("maxlength",i.length).data("mask-maxlength",!0);u.destroyEvents();u.events();l=u.getCaret();u.val(u.getMasked());u.setCaret(l)}};f.init(!t.is("input"))},t;n.maskWatchers={};var u=function(){var t=n(this),u={},f="data-mask-",e=t.attr("data-mask");return t.attr(f+"reverse")&&(u.reverse=!0),t.attr(f+"clearifnotmatch")&&(u.clearIfNotMatch=!0),t.attr(f+"selectonfocus")==="true"&&(u.selectOnFocus=!0),r(t,e,u)?t.data("mask",new i(this,e,u)):void 0},r=function(t,i,r){r=r||{};var u=n(t).data("mask"),f=JSON.stringify,e=n(t).val()||n(t).text();try{return typeof i=="function"&&(i=i(e)),typeof u!="object"||f(u.options)!==f(r)||u.mask!==i}catch(o){}},f=function(n){var t=document.createElement("div"),i;return n="on"+n,i=n in t,i||(t.setAttribute(n,"return;"),i=typeof t[n]=="function"),t=null,i};n.fn.mask=function(t,u){u=u||{};var f=this.selector,e=n.jMaskGlobals,s=e.watchInterval,h=u.watchInputs||e.watchInputs,o=function(){if(r(this,t,u))return n(this).data("mask",new i(this,t,u))};return n(this).each(o),f&&f!==""&&h&&(clearInterval(n.maskWatchers[f]),n.maskWatchers[f]=setInterval(function(){n(document).find(f).each(o)},s)),this};n.fn.masked=function(n){return this.data("mask").getMaskedVal(n)};n.fn.unmask=function(){return clearInterval(n.maskWatchers[this.selector]),delete n.maskWatchers[this.selector],this.each(function(){var t=n(this).data("mask");t&&t.remove().removeData("mask")})};n.fn.cleanVal=function(){return this.data("mask").getCleanVal()};n.applyDataMask=function(t){t=t||n.jMaskGlobals.maskElements;var i=t instanceof n?t:n(t);i.filter(n.jMaskGlobals.dataMaskAttr).each(u)};t={maskElements:"input,td,span,div",dataMaskAttr:"*[data-mask]",dataMask:!0,watchInterval:300,watchInputs:!0,keyStrokeCompensation:10,useInput:!/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent)&&f("input"),watchDataMask:!1,byPassKeys:[9,16,17,18,36,37,38,39,40,91],translation:{"0":{pattern:/\d/},"9":{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},S:{pattern:/[a-zA-Z]/}}};n.jMaskGlobals=n.jMaskGlobals||{};t=n.jMaskGlobals=n.extend(!0,{},t,n.jMaskGlobals);t.dataMask&&n.applyDataMask();setInterval(function(){n.jMaskGlobals.watchDataMask&&n.applyDataMask()},t.watchInterval)},window.jQuery,window.Zepto);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("tiles"):jQuery(document).ready(function(){g_ugFunctions.registerTheme("tiles")})