/************************************************************************************ * jquery.themepunch.essential.js - jQuery Plugin for esg Portfolio Slider * @version: 2.1.0 (06.07.2016) * @requires jQuery v1.7 or later (tested on 1.9) * @author ThemePunch ************************************************************************************/ //! ++++++++++++++++++++++++++++++++++++++ !function(jQuery,undefined){function checkBottomPos(e,t){var a=e.container.offset().top+e.container.height()+(e.contPadTop+e.contPadBottom)-jQuery(document).scrollTop(),o=jQuery(window).height(),r=jQuery(document).height();(e.lastBottomCompare!=a&&o>=a||t&&o>=a||r===o&&o>a)&&(e.lastBottomCompare=a,e.lmbut&&1!=e.lmbut.data("loading")&&(e.lmbut.data("loading",1),loadMoreItems(e)))}function createCookie(e,t,a){var o;if(a){var r=new Date;r.setTime(r.getTime()+24*a*60*60*1e3),o="; expires="+r.toGMTString()}else o="";document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+o+"; path=/"}function readCookie(e){for(var t=encodeURIComponent(e)+"=",a=document.cookie.split(";"),o=0;o0){var i=r.data("fid"),s=r.data("filter");o>0&&(s+=".cat-searchresult");for(var n=e.find("."+s).length,l=0;l0'),countToTop(r,n)}}),jQuery(t.filterGroupClass+".esg-filter-wrapper.eg-search-wrapper .eg-justfilteredtosearch").removeClass("eg-justfilteredtosearch")}function countToTop(e,t){function a(e,t){o.html(Math.round(e.target[t]))}var o=e.find(".eg-el-amount"),r={value:parseInt(o.text(),0)};punchgs.TweenLite.to(r,2,{value:t,onUpdate:a,onUpdateParams:["{self}","value"],ease:punchgs.Power3.easeInOut})}function buildLoader(e,t,a){return t.esgloader!=undefined&&t.esgloader.length>0?!1:(e.append('
'),esgloader=e.find(".esg-loader"),("spinner1"==t.spinner||"spinner2"==t.spinner)&&esgloader.css({backgroundColor:t.spinnerColor}),("spinner3"==t.spinner||"spinner4"==t.spinner)&&e.find(".bounce1, .bounce2, .bounce3, .dot1, .dot2").css({backgroundColor:t.spinnerColor}),a||punchgs.TweenLite.to(e,.3,{minHeight:"100px",zIndex:0}),esgloader)}function setKeyToNull(e,t){jQuery.each(e.loadMoreItems,function(a,o){o[0]==t&&(e.loadMoreItems[a][0]=-1,e.loadMoreItems[a][2]="already loaded")})}function loadMoreEmpty(e){for(var t=!0,a=0;a0){e.lmbut.length>0&&(punchgs.TweenLite.to(e.lmbut,.4,{autoAlpha:.2}),e.lmbut.data("loading",1));var i={action:e.loadMoreAjaxAction,client_action:"load_more_items",token:e.loadMoreAjaxToken,data:o,gridid:e.gridID};jQuery.ajax({type:"post",url:e.loadMoreAjaxUrl,dataType:"json",data:i}).success(function(a,o,i){if(a.success){var s=jQuery(a.data);jQuery(e.filterGroupClass+".esg-filter-wrapper.eg-search-wrapper .eg-forcefilter").length>0&&s.addClass("cat-searchresult"),e.container.find("ul").first().append(s),checkAvailableFilters(t,e),prepareItemsInGrid(e,!0),setItemsOnPages(e),setTimeout(function(){e.animDelay="off",organiseGrid(e,"Ajax Loaded"),prepareSortingAndOrders(t),loadMoreEmpty(e)?e.lmbut.remove():(e.lmtxt=e.loadMoreTxt+" ("+r+")","off"==e.loadMoreNr&&(e.lmtxt=e.loadMoreTxt),0==r?e.lmbut.html(e.loadMoreEndTxt):e.lmbut.html(e.lmtxt),e.lmbut.length>0&&(punchgs.TweenLite.to(e.lmbut,.4,{autoAlpha:1,overwrite:"all"}),e.lmbut.data("loading",0))),setTimeout(function(){e.animDelay="on"},500)},10)}}).error(function(t,a,o){e.lmbut.html("FAILURE: "+a)})}else loadMoreEmpty(e)?(e.lmbut.remove(),"scroll"===e.loadMoreType&&e.esgloader.remove()):e.lmbut.data("loading",0).html(e.loadMoreEndTxt)}function killOldCustomAjaxContent(e){var t=e.data("lastposttype"),a=e.data("oldajaxsource"),o=e.data("oldajaxtype"),r=e.data("oldajaxvideoaspect"),i=e.data("oldselector");if(t!=undefined&&""!=t)try{jQuery.each(jQuery.fn.tpessential.defaults.ajaxTypes,function(s,n){n!=undefined&&n.type!=undefined&&n.type==t&&n.killfunc!=undefined&&setTimeout(function(){n.killfunc.call(this,{id:a,type:o,aspectratio:r,selector:i})&&e.empty()},250)})}catch(s){console.log(s)}e.data("lastposttype","")}function addAjaxNavigagtion(e,t){function a(e){var t=new Array;return jQuery.each(e,function(e,a){jQuery(a).closest(".itemtoshow.isvisiblenow").length>0&&t.push(a)}),t}var o=" eg-acp-"+e.ajaxClosePosition;o=o+" eg-acp-"+e.ajaxCloseStyle,o=o+" eg-acp-"+e.ajaxCloseType,loc="eg-icon-left-open-1",roc="eg-icon-right-open-1",xoc='',"type1"==e.ajaxCloseType&&(loc="eg-icon-left-open-big",roc="eg-icon-right-open-big",e.ajaxCloseTxt="",xoc="X"),("true"==e.ajaxCloseInner||1==e.ajaxCloseInner)&&(o+=" eg-acp-inner");var r='
';switch("tr"==e.ajaxClosePosition||"br"==e.ajaxClosePosition?("on"==e.ajaxNavButton&&(r=r+'
'),"on"==e.ajaxCloseButton&&(r=r+'
'+xoc+e.ajaxCloseTxt+"
")):("on"==e.ajaxCloseButton&&(r=r+'
'+xoc+e.ajaxCloseTxt+"
"),"on"==e.ajaxNavButton&&(r=r+'
')),r+="
",e.ajaxClosePosition){case"tl":case"tr":case"t":t.prepend(r);break;case"bl":case"br":case"b":t.append(r)}t.find(".eg-ajax-closer").click(function(){showHideAjaxContainer(t,!1,null,null,.25,!0)}),t.find(".eg-ajax-right").click(function(){var e=t.data("container").find(".lastclickedajax").closest("li"),o=e.nextAll().find(".eg-ajax-a-button"),r=e.prevAll().find(".eg-ajax-a-button");o=a(o),r=a(r),o.length>0?o[0].click():r[0].click()}),t.find(".eg-ajax-left").click(function(){var e=t.data("container").find(".lastclickedajax").closest("li"),o=e.nextAll().find(".eg-ajax-a-button"),r=e.prevAll().find(".eg-ajax-a-button");o=a(o),r=a(r),r.length>0?r[r.length-1].click():o[o.length-1].click()})}function showHideAjaxContainer(e,t,a,o,r,i){r=r==undefined?.25:r;var s=e.data("container").data("opt"),n=e.data("lastheight")!=undefined?e.data("lastheight"):"100px";t?(r+=1.2,addAjaxNavigagtion(s,e),punchgs.TweenLite.set(e,{height:"auto"}),punchgs.TweenLite.set(e.parent(),{minHeight:0,maxHeight:"none",height:"auto",overwrite:"all"}),punchgs.TweenLite.from(e,r,{height:n,ease:punchgs.Power3.easeInOut,onStart:function(){punchgs.TweenLite.to(e,r,{autoAlpha:1,ease:punchgs.Power3.easeOut})},onComplete:function(){e.data("lastheight",e.height()),jQuery(window).trigger("resize.essg"),0==e.find(".eg-ajax-closer-wrapper").length&&addAjaxNavigagtion(s,e)}}),"off"!=s.ajaxScrollToOnLoad&&jQuery("html, body").animate({scrollTop:e.offset().top-o},{queue:!1,speed:.5})):(i&&(killOldCustomAjaxContent(e),n="0px"),punchgs.TweenLite.to(e.parent(),r,{height:n,ease:punchgs.Power2.easeInOut,onStart:function(){punchgs.TweenLite.to(e,r,{autoAlpha:0,ease:punchgs.Power3.easeOut})},onComplete:function(){setTimeout(function(){i&&e.html("")},300)}}))}function removeLoader(e){e.closest(".eg-ajaxanimwrapper").find(".esg-loader").remove()}function ajaxCallBack(opt,a){if(opt.ajaxCallback==undefined||""==opt.ajaxCallback||opt.ajaxCallback.length<3)return!1;var splitter=opt.ajaxCallback.split(")"),splitter=splitter[0].split("("),callback=splitter[0],arguments=splitter.length>1&&""!=splitter[1]?splitter[1]+",":"",obj=new Object;try{obj.containerid="#"+opt.ajaxContentTarget,obj.postsource=a.data("ajaxsource"),obj.posttype=a.data("ajaxtype"),"on"==opt.ajaxCallbackArgument?eval(callback+"("+arguments+"obj)"):eval(callback+"("+arguments+")")}catch(e){console.log("Callback Error"),console.log(e)}}function loadMoreContent(e,t,a){e.find(".lastclickedajax").removeClass("lastclickedajax"),a.addClass("lastclickedajax");var o=jQuery("#"+t.ajaxContentTarget).find(".eg-ajax-target").eq(0),r=a.data("ajaxsource"),i=a.data("ajaxtype"),s=a.data("ajaxvideoaspect");if(o.data("container",e),s="16:9"==s?"widevideo":"normalvideo",showHideAjaxContainer(o,!1),o.length>0)switch(t.ajaxJsUrl!=undefined&&""!=t.ajaxJsUrl&&t.ajaxJsUrl.length>3&&jQuery.getScript(t.ajaxJsUrl).done(function(e,a){t.ajaxJsUrl=""}).fail(function(e,a,o){console.log("Loading Error on Ajax jQuery File. Please doublecheck if JS File and Path exist:"+t.ajaxJSUrl),t.ajaxJsUrl=""}),t.ajaxCssUrl!=undefined&&""!=t.ajaxCssUrl&&t.ajaxCssUrl.length>3&&(jQuery("").appendTo("head").attr({type:"text/css",rel:"stylesheet"}).attr("href",t.ajaxCssUrl),""==t.ajaxCssUrl),buildLoader(o.closest(".eg-ajaxanimwrapper"),t),o.data("ajaxload")!=undefined&&o.data("ajaxload").abort(),killOldCustomAjaxContent(o),i){case"postid":var n={action:t.loadMoreAjaxAction,client_action:"load_more_content",token:t.loadMoreAjaxToken,postid:r};setTimeout(function(){o.data("ajaxload",jQuery.ajax({type:"post",url:t.loadMoreAjaxUrl,dataType:"json",data:n})),o.data("ajaxload").success(function(e,r,i){e.success&&(jQuery(o).html(e.data),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),removeLoader(o),ajaxCallBack(t,a))}),o.data("ajaxload").error(function(e,t,a){"abort"!=t&&(jQuery(o).append("

FAILURE: "+t+"

"),removeLoader(o))})},300);break;case"youtubeid":setTimeout(function(){o.html('
'),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},300);break;case"vimeoid":setTimeout(function(){o.html('
'),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},300);break;case"wistiaid":setTimeout(function(){o.html('
'),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},300);break;case"html5vid":r=r.split("|"),setTimeout(function(){o.html(''),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},300);break;case"soundcloud":case"soundcloudid":setTimeout(function(){o.html(''),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},300);break;case"imageurl":setTimeout(function(){var e=new Image;e.onload=function(){var e=jQuery(this);o.html(""),e.css({width:"100%",height:"auto"}),o.append(jQuery(this)),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset),ajaxCallBack(t,a)},e.onerror=function(e){o.html("Error"),removeLoader(o),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset)},e.src=r},300);break;default:jQuery.each(jQuery.fn.tpessential.defaults.ajaxTypes,function(e,a){a.openAnimationSpeed==undefined&&(a.openAnimationSpeed=0),a!=undefined&&a.type!=undefined&&a.type==i&&setTimeout(function(){o.data("lastposttype",i),o.data("oldajaxsource",r),o.data("oldajaxtype",i),o.data("oldajaxvideoaspect",s),o.data("oldselector","#"+t.ajaxContentTarget+" .eg-ajax-target"),showHideAjaxContainer(o,!0,t.ajaxScrollToOnLoad,t.ajaxScrollToOffset,0),o.html(a.func.call(this,{id:r,type:i,aspectratio:s})),removeLoader(o)},300)})}}function resetFiltersFromCookies(e,t,a){if("on"==e.cookies.filter){var o=a!==undefined?a:readCookie("grid_"+e.girdID+"_filters");if(o!==undefined&&null!==o&&o.length>0){var r=0;jQuery.each(o.split(","),function(a,o){o!==undefined&&-1!==o&&"-1"!==o&&jQuery(e.filterGroupClass+".esg-filterbutton,"+e.filterGroupClass+" .esg-filterbutton").each(function(){jQuery(this).data("fid")!=o&&parseInt(jQuery(this).data("fid"),0)!==parseInt(o,0)||jQuery(this).hasClass("esg-pagination-button")||(t?jQuery(this).click():jQuery(this).addClass("selected"),r++)})}),r>0&&jQuery(e.filterGroupClass+".esg-filterbutton.esg-allfilter,"+e.filterGroupClass+" .esg-filterbutton.esg-allfilter").removeClass("selected")}}}function resetPaginationFromCookies(e,t){if("on"===e.cookies.pagination){var a=t!==undefined?t:readCookie("grid_"+e.girdID+"_pagination");a!==undefined&&null!==a&&a.length>0&&jQuery(e.filterGroupClass+".esg-filterbutton.esg-pagination-button,"+e.filterGroupClass+" .esg-filterbutton.esg-pagination-button").each(function(){parseInt(jQuery(this).data("page"),0)!==parseInt(a,0)||jQuery(this).hasClass("selected")||jQuery(this).click()})}}function resetSearchFromCookies(e){if("on"===e.cookies.search){var t=readCookie("grid_"+e.gridID+"_search");t!==undefined&&null!=t&&t.length>0&&(jQuery(e.filterGroupClass+".eg-search-wrapper .eg-search-input").val(t).trigger("change"),e.cookies.searchjusttriggered=!0)}}function mainPreparing(e,t){function a(){if(1==t.lastsearchtimer)return!1;t.lastsearchtimer=1,buildLoader(jQuery(t.filterGroupClass+".eg-search-wrapper"),{spinner:"spinner3",spinnerColor:"#fff"},!0),punchgs.TweenLite.fromTo(jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader"),.3,{autoAlpha:0},{autoAlpha:1,ease:punchgs.Power3.easeInOut});var a=jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input"),o=a.val(),r=jQuery(t.filterGroupClass+".eg-search-wrapper.esg-filter-wrapper .hiddensearchfield");if(a.attr("disabled","true"),o.length>0){a.trigger("searchstarting");var i={search:o,id:t.gridID},s={action:t.loadMoreAjaxAction,client_action:"get_grid_search_ids",token:t.loadMoreAjaxToken,data:i};jQuery.ajax({type:"post",url:t.loadMoreAjaxUrl,dataType:"json",data:s}).success(function(a,i,s){if("on"===t.cookies.search&&createCookie("grid_"+t.gridID+"_search",o,t.cookies.timetosave*(1/60/60)),t.cookies.searchjusttriggered===!0){var n=readCookie("grid_"+t.girdID+"_pagination"),l=readCookie("grid_"+t.girdID+"_filters");setTimeout(function(){resetFiltersFromCookies(t,!0,l),resetPaginationFromCookies(t,n)},200),t.cookies.searchjusttriggered=!1}setTimeout(function(){t.lastsearchtimer=0,jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").attr("disabled",!1),punchgs.TweenLite.to(jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader"),.5,{autoAlpha:1,ease:punchgs.Power3.easeInOut,onComplete:function(){jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader").remove()}}),jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").trigger("searchended")},1e3);var u=new Array;a&&jQuery.each(a,function(e,t){t!=undefined&&jQuery.isNumeric(t)&&u.push(t)}),e.find(".cat-searchresult").removeClass("cat-searchresult");var d=0;jQuery.each(t.loadMoreItems,function(e,t){t[2]="notsearched",jQuery.each(u,function(e,a){return parseInt(t[0],0)===parseInt(a,0)&&-1!=parseInt(t[0],0)?(t[2]="cat-searchresult",d++,!1):void 0})}),jQuery.each(u,function(t,a){e.find(".eg-post-id-"+a).addClass("cat-searchresult")}),r.addClass("eg-forcefilter").addClass("eg-justfilteredtosearch"),jQuery(t.filterGroupClass+".esg-filter-wrapper .esg-allfilter").trigger("click")}).error(function(e,a,o){console.log("FAILURE: "+a),setTimeout(function(){t.lastsearchtimer=0,jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").attr("disabled",!1),punchgs.TweenLite.to(jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader"),.5,{autoAlpha:1,ease:punchgs.Power3.easeInOut,onComplete:function(){jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader").remove()}}),jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").trigger("searchended")},1e3)})}else{jQuery.each(t.loadMoreItems,function(e,t){t[2]="notsearched"}),e.find(".cat-searchresult").removeClass("cat-searchresult");var r=jQuery(t.filterGroupClass+".eg-search-wrapper.esg-filter-wrapper .hiddensearchfield");r.removeClass("eg-forcefilter").addClass("eg-justfilteredtosearch"),"on"===t.cookies.search&&createCookie("grid_"+t.gridID+"_search","",-1),jQuery(t.filterGroupClass+".esg-filter-wrapper .esg-allfilter").trigger("click"),setTimeout(function(){t.lastsearchtimer=0,jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").attr("disabled",!1),punchgs.TweenLite.to(jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader"),.5,{autoAlpha:1,ease:punchgs.Power3.easeInOut,onComplete:function(){jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader").remove()}}),jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").trigger("searchended")},1e3)}}resetFiltersFromCookies(t);var o=e.find(".eg-leftright-container"),r=getBestFitColumn(t,jQuery(window).width(),"id");if(t.column=r.column,t.columnindex=r.index,t.mmHeight=r.mmHeight,prepareItemsInGrid(t),organiseGrid(t,"MainPreparing"),jQuery(t.filterGroupClass+".eg-search-wrapper").length>0){var i=t.filterGroupClass.replace(".",""),s="Search Result",n=jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-submit"),l=jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-clean");jQuery(t.filterGroupClass+".esg-filter-wrapper.eg-search-wrapper").append('
'+s+"
"),t.lastsearchtimer=0,n.click(a),jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").on("change",a),l.click(function(){"on"===t.cookies.search&&createCookie("grid_"+t.gridID+"_search","",-1),jQuery.each(t.loadMoreItems,function(e,t){t[2]="notsearched"}),e.find(".cat-searchresult").removeClass("cat-searchresult");var a=jQuery(t.filterGroupClass+".eg-search-wrapper.esg-filter-wrapper .hiddensearchfield");jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").val(""),a.removeClass("eg-forcefilter").addClass("eg-justfilteredtosearch"),jQuery(t.filterGroupClass+".esg-filter-wrapper .esg-allfilter").trigger("click"),setTimeout(function(){t.lastsearchtimer=0,jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").attr("disabled",!1),punchgs.TweenLite.to(jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader"),.5,{autoAlpha:1,ease:punchgs.Power3.easeInOut,onComplete:function(){jQuery(t.filterGroupClass+".eg-search-wrapper").find(".esg-loader").remove()}}),jQuery(t.filterGroupClass+".eg-search-wrapper .eg-search-input").trigger("searchended")},1e3)})}addCountSuffix(e,t),jQuery(t.filterGroupClass+".esg-filter-wrapper,"+t.filterGroupClass+" .esg-filter-wrapper").each(function(e){var a=jQuery(this);a.hasClass("dropdownstyle")&&(a.find(".esg-filter-checked").each(function(){jQuery(this).prependTo(jQuery(this).parent())}),is_mobile()?a.find(".esg-selected-filterbutton").click(function(){var e=a.find(".esg-selected-filterbutton");e.hasClass("hoveredfilter")?(e.removeClass("hoveredfilter"),a.find(".esg-dropdown-wrapper").stop().hide()):(e.addClass("hoveredfilter"),a.find(".esg-dropdown-wrapper").stop().show())}):"click"==t.showDropFilter?(a.click(function(){var e=jQuery(this).closest(".esg-filter-wrapper");e.find(".esg-selected-filterbutton").addClass("hoveredfilter"),e.find(".esg-dropdown-wrapper").stop().show()}),a.on("mouseleave",function(){var e=jQuery(this).closest(".esg-filter-wrapper");e.find(".esg-selected-filterbutton").removeClass("hoveredfilter"),e.find(".esg-dropdown-wrapper").stop().hide()})):a.hover(function(){var e=jQuery(this).closest(".esg-filter-wrapper");e.find(".esg-selected-filterbutton").addClass("hoveredfilter"),e.find(".esg-dropdown-wrapper").stop().show()},function(){var e=jQuery(this).closest(".esg-filter-wrapper");e.find(".esg-selected-filterbutton").removeClass("hoveredfilter"),e.find(".esg-dropdown-wrapper").stop().hide()}))}),is_mobile()&&jQuery(document).on("click touchstart",function(e){var a=jQuery(e.target).closest(".esg-filter-wrapper");0==a.length&&(t.container.find(".hoveredfilter").removeClass("hoveredfilter"),t.container.find(".esg-dropdown-wrapper").stop().hide())}),t.container.find(".esg-filters").each(function(e){punchgs.TweenLite.set(this,{zIndex:70-e})}),t.container.find(".esg-filter-wrapper.dropdownstyle").each(function(e){punchgs.TweenLite.set(this,{zIndex:1570-e})}),jQuery("body").on("click",t.filterGroupClass+".esg-left,"+t.filterGroupClass+" .esg-left",function(){t=getOptions(e),t.oldpage=t.currentpage,t.currentpage--,t.currentpage<0&&(t.currentpage=t.realmaxpage-1);var a=getBestFitColumn(t,jQuery(window).width(),"id");t.column=a.column,t.columnindex=a.index,t.mmHeight=a.mmHeight,setItemsOnPages(t),organiseGrid(t,"LeftNavigation"),setOptions(e,t),stopAllVideos(!0)}),jQuery("body").on("click",t.filterGroupClass+".esg-right,"+t.filterGroupClass+" .esg-right",function(){t=getOptions(e),t.oldpage=t.currentpage,t.currentpage++,t.currentpage>=t.realmaxpage&&(t.currentpage=0);var a=getBestFitColumn(t,jQuery(window).width(),"id");t.column=a.column,t.columnindex=a.index,t.mmHeight=a.mmHeight,setItemsOnPages(t),organiseGrid(t,"RightNavigation"),setOptions(e,t),stopAllVideos(!0)}),jQuery(t.filterGroupClass+".esg-filterbutton, "+t.filterGroupClass+" .esg-filterbutton").each(function(){jQuery(this).hasClass("esg-pagination-button")||jQuery(this).click(function(){var t=getOptions(e);stopAllVideos(!0);var a=jQuery(this);a.hasClass("esg-pagination-button")||(jQuery(t.filterGroupClass+".esg-allfilter, "+t.filterGroupClass+" .esg-allfilter").removeClass("selected"),a.hasClass("esg-allfilter")&&jQuery(t.filterGroupClass+".esg-filterbutton, "+t.filterGroupClass+" .esg-filterbutton").each(function(){jQuery(this).removeClass("selected")})),a.closest(".esg-filters").hasClass("esg-singlefilters")||"single"==t.filterType?(jQuery(t.filterGroupClass+".esg-filterbutton, "+t.filterGroupClass+" .esg-filterbutton").each(function(){jQuery(this).removeClass("selected")}),a.addClass("selected")):a.hasClass("selected")?a.removeClass("selected"):a.addClass("selected");var o=jQuery(t.filterGroupClass+".esg-filter-wrapper .hiddensearchfield");o.hasClass("eg-forcefilter")&&o.addClass("selected");var r=0,i="";if(jQuery(t.filterGroupClass+".esg-filterbutton.selected,"+t.filterGroupClass+" .esg-filterbutton.selected").each(function(){jQuery(this).hasClass("selected")&&!jQuery(this).hasClass("esg-pagination-button")&&(r++,i=0===r?jQuery(this).data("fid"):i+","+jQuery(this).data("fid"))}),"on"===t.cookies.filter&&t.cookies.searchjusttriggered!==!0&&createCookie("grid_"+t.girdID+"_filters",i,t.cookies.timetosave*(1/60/60)),0==r&&jQuery(t.filterGroupClass+".esg-allfilter,"+t.filterGroupClass+" .esg-allfilter").addClass("selected"),t.filterchanged=!0,t.currentpage=0,1==t.maxpage?(jQuery(t.filterGroupClass+".navigationbuttons,"+t.filterGroupClass+" .navigationbuttons").css({display:"none"}),jQuery(t.filterGroupClass+".esg-pagination,"+t.filterGroupClass+" .esg-pagination").css({display:"none"})):(jQuery(t.filterGroupClass+".navigationbuttons,"+t.filterGroupClass+" .navigationbuttons").css({display:"inline-block"}),jQuery(t.filterGroupClass+".esg-pagination,"+t.filterGroupClass+" .esg-pagination").css({display:"inline-block"})),t.lmbut!=undefined&&t.lmbut.length>0){var s=checkMoreToLoad(t).length;s>0?"off"==t.loadMoreNr?t.lmbut.html(t.loadMoreTxt):t.lmbut.html(t.loadMoreTxt+" ("+s+")"):t.lmbut.data("loading",0).html(t.loadMoreEndTxt)}setItemsOnPages(t),organiseGrid(t,"filtergroup"),setOptions(e,t)})});var u;jQuery(window).on("resize.essg",function(){if(clearTimeout(u),"on"==t.forceFullWidth||"on"==t.forceFullScreen){var a=e.parent().parent().find(".esg-relative-placeholder").offset().left;e.closest(".esg-container-fullscreen-forcer").css({left:0-a,width:jQuery(window).width()})}else e.closest(".esg-container-fullscreen-forcer").css({left:0,width:"auto"});if(o.length>0){var r=o.outerWidth(!0);punchgs.TweenLite.set(e.find(".esg-overflowtrick"),{width:e.width()-r,overwrite:"all"})}var i=getBestFitColumn(t,jQuery(window).width(),"id");t.column=i.column,t.columnindex=i.index,t.mmHeight=i.mmHeight,setOptions(e,t),u=setTimeout(function(){t=getOptions(e),setItemsOnPages(t),organiseGrid(t,"resize"),setOptions(e,t)},200)}),e.on("itemsinposition",function(){var e=jQuery(this),t=getOptions(e);clearTimeout(t.iteminspositiontimer),t.iteminspositiontimer=setTimeout(function(){var a=e.find(".eg-leftright-container");if(clearTimeout(e.data("callednow")),t.maxheight>0&&t.maxheight<9999999999){t.inanimation=!1;var o=e.find(".esg-overflowtrick").first();h=t.mainul,a=e.find(".eg-leftright-container");var r=parseInt(o.css("paddingTop"),0);r=r==undefined?0:r,r=null==r?0:r;var i=parseInt(o.css("paddingBottom"),0);i=i==undefined?0:i,i=null==i?0:i;var s=t.maxheight+t.overflowoffset+r+i;if("on"==t.forceFullScreen){var n=jQuery(window).height();if(t.fullScreenOffsetContainer!=undefined)try{var l=t.fullScreenOffsetContainer.split(",");jQuery.each(l,function(e,a){n-=jQuery(a).outerHeight(!0),n0&&punchgs.TweenLite.set(a,{minHeight:s,ease:punchgs.Power3.easeInOut});var c=jQuery(t.filterGroupClass+".esg-navbutton-solo-left,"+t.filterGroupClass+" .esg-navbutton-solo-left"),p=jQuery(t.filterGroupClass+".esg-navbutton-solo-right,"+t.filterGroupClass+" .esg-navbutton-solo-right");c.length>0&&c.css({marginTop:0-c.height()/2}),p.length>0&&p.css({marginTop:0-p.height()/2})}else if(0==t.maxheight){var o=e.find(".esg-overflowtrick").first(),h=e.find("ul").first();punchgs.TweenLite.to(h,1,{force3D:"auto",height:0,ease:punchgs.Power3.easeInOut,clearProps:"transform"}),punchgs.TweenLite.to(o,1,{force3D:!0,height:0,ease:punchgs.Power3.easeInOut,clearProps:"transform"})}e.data("callednow",setTimeout(function(){e.find(".itemtoshow.isvisiblenow").each(function(){hideUnderElems(jQuery(this))})},250)),t.firstLoadFinnished===undefined&&(e.trigger("essential_grid_ready_to_use"),resetSearchFromCookies(t),resetPaginationFromCookies(t),t.firstLoadFinnished=!0)},50)}),prepareSortingAndOrders(e),prepareSortingClicks(e)}function prepareSortingAndOrders(e){var t=getOptions(e);e.find(".tp-esg-item").each(function(){var e=new Date(jQuery(this).data("date"));jQuery(this).data("date",e.getTime()/1e3)}),jQuery(t.filterGroupClass+".esg-sortbutton-order,"+t.filterGroupClass+" .esg-sortbutton-order").each(function(){var e=jQuery(this);e.removeClass("tp-desc").addClass("tp-asc"),e.data("dir","asc")})}function prepareSortingClicks(e){opt=getOptions(e);var t;jQuery(opt.filterGroupClass+".esg-sortbutton-wrapper .esg-sortbutton-order,"+opt.filterGroupClass+" .esg-sortbutton-wrapper .esg-sortbutton-order").click(function(){var a=jQuery(this);a.hasClass("tp-desc")?(a.removeClass("tp-desc").addClass("tp-asc"),a.data("dir","asc")):(a.removeClass("tp-asc").addClass("tp-desc"),a.data("dir","desc"));var o=a.data("dir");stopAllVideos(!0,!0),jQuery(opt.filterGroupClass+".esg-sorting-select,"+opt.filterGroupClass+" .esg-sorting-select").each(function(){var a=jQuery(this).val();clearTimeout(t),e.find(".tp-esg-item").tsort({data:a,forceStrings:"false",order:o}),t=setTimeout(function(){opt=getOptions(e),setItemsOnPages(opt),organiseGrid(opt,"preparSorting"),setOptions(e,opt)},200)})}),jQuery(opt.filterGroupClass+".esg-sorting-select,"+opt.filterGroupClass+" .esg-sorting-select").each(function(){var a=jQuery(this);a.change(function(){var o=jQuery(this).closest(".esg-sortbutton-wrapper").find(".esg-sortbutton-order"),r=a.val(),i=a.find("option:selected").text(),s=o.data("dir");stopAllVideos(!0,!0),clearTimeout(t),a.parent().parent().find(".sortby_data").text(i);var n=e.find(".tp-esg-item").tsort({data:r,forceStrings:"false",order:s});n!==undefined&&(opt=getOptions(e),setItemsOnPages(opt),organiseGrid(opt,"OnSorting"),setOptions(e,opt))})})}function fixCenteredCoverElement(e,t,a){if(t==undefined&&(t=e.find(".esg-entry-cover")),a==undefined&&(a=e.find(".esg-entry-media")),t&&a){var o=a.outerHeight();punchgs.TweenLite.set(t,{height:o});var r=e.find(".esg-cc");punchgs.TweenLite.set(r,{top:(o-r.height())/2})}}function getBestFitColumn(e,t,a){var o=t,r=0,i=9999,s=0,n=e.column,l=(e.column,e.column),u=0,d=0;e.responsiveEntries!=undefined&&e.responsiveEntries.length>0&&jQuery.each(e.responsiveEntries,function(e,t){var a=t.width!=undefined?t.width:0,c=t.amount!=undefined?t.amount:0;i>a&&(i=a,n=c,d=e),a>s&&(s=a,lamount=c),a>r&&o>=a&&(r=a,l=c,u=e)}),i>t&&(l=n,u=d);var c=new Object;return c.index=u,c.column=l,c.mmHeight=e.responsiveEntries[c.index].mmheight,"id"==a?c:l}function getOptions(e){return e.data("opt")}function setOptions(e,t){e.data("opt",t)}function checkMediaListeners(e){e.find("iframe").each(function(e){var t=jQuery(this);t.attr("src").toLowerCase().indexOf("youtube")>0?prepareYT(t):t.attr("src").toLowerCase().indexOf("vimeo")>0?prepareVimeo(t):t.attr("src").toLowerCase().indexOf("wistia")>0?prepareWs(t):t.attr("src").toLowerCase().indexOf("soundcloud")>0&&prepareSoundCloud(t)}),e.find("video").each(function(e){prepareVideo(jQuery(this))})}function waitMediaListeners(e){var t=e.find("iframe").first(),a=e.find("video").first(),o=t.length>0&&t.attr("src").toLowerCase().indexOf("youtube")>0?"y":t.length>0&&t.attr("src").toLowerCase().indexOf("vimeo")>0?"v":t.length>0&&t.attr("src").toLowerCase().indexOf("wistia")>0?"w":t.length>0&&t.attr("src").toLowerCase().indexOf("soundcloud")>0?"s":a.length>0&&a.length>=1?"h":"",r=setInterval(function(){ e.find("iframe").each(function(e){(""===o||"y"===o&&prepareYT(t)||"v"===o&&prepareVimeo(t)||"w"===o&&prepareWs(t)||"s"===o&&prepareSoundCloud(t)||"h"===o&&prepareVideo(t))&&clearInterval(r)})},50)}function directionPrepare(e,t,a,o,r){var i=new Object;switch(e){case 0:i.x=0,i.y="in"==t?0-o:10+o,i.y=r&&"in"==t?i.y-5:i.y;break;case 1:i.y=0,i.x="in"==t?a:-10-a,i.x=r&&"in"==t?i.x+5:i.x;break;case 2:i.y="in"==t?o:-10-o,i.x=0,i.y=r&&"in"==t?i.y+5:i.y;break;case 3:i.y=0,i.x="in"==t?0-a:10+a,i.x=r&&"in"==t?i.x-5:i.x}return i}function getDir(e,t){var a=e.width(),o=e.height(),r=(t.x-e.offset().left-a/2)*(a>o?o/a:1),i=(t.y-e.offset().top-o/2)*(o>a?a/o:1),s=Math.round((Math.atan2(i,r)*(180/Math.PI)+180)/90+3)%4;return s}function hideUnderElems(e){e.find(".eg-handlehideunder").each(function(){var t=jQuery(this),a=t.data("hideunder"),o=t.data("hideunderheight"),r=t.data("hidetype");t.data("knowndisplay")==undefined&&t.data("knowndisplay",t.css("display")),e.width()a.height()+40||0==e||0!=a.data("bh")&&a.data("bh")!=undefined&&t.position().top+t.height()>parseInt(a.data("bh"),0)+40){(a.data("bh")==undefined||0==a.data("bh"))&&a.data("bh",a.height()),(o.data("bh")==undefined||0==o.data("bh"))&&o.data("bh",o.height());var r=a.data("bh"),i=o.data("bh");0!=e?(a.data("alreadyinoff",!1),punchgs.TweenLite.to(a,.2,{height:r+e}),punchgs.TweenLite.to(o,.2,{height:i+e})):a.data("alreadyinoff")||(a.data("alreadyinoff",!0),punchgs.TweenLite.to(a,.3,{height:r,ease:punchgs.Power3.easeIn,onComplete:function(){a.data("bh",0),o.data("bh",0),a.data("alreadyinoff",!1)}}),punchgs.TweenLite.to(o,.3,{height:i,ease:punchgs.Power3.easeIn,onComplete:function(){a.data("bh",0),o.data("bh",0),a.data("alreadyinoff",!1)}}))}}function itemHoverAnim(e,t,a,o){if(1!=e.data("simplevideo")&&checkMediaListeners(e),e.find(".isplaying, .isinpause").length>0)return!1;clearTimeout(e.data("hovertimer"));var r=a.mainhoverdelay;"set"==t&&(r=0),e.data("hovertimer",setTimeout(function(){e.data("animstarted",1),punchgs.TweenLite.set(e,{z:.01,x:0,y:0,rotationX:0,rotationY:0,rotationZ:0}),e.addClass("esg-hovered");var r=e.find(".esg-entry-cover");if(punchgs.TweenLite.set(r,{transformStyle:"flat"}),"set"!=t&&fixCenteredCoverElement(e,r),e.find(".esg-entry-content").length>0&&"set"!=t&&"even"==a.layout){var i=e.data("pt"),s=e.data("pb"),n=e.data("pl"),l=e.data("pr"),u=e.data("bt"),d=e.data("bb"),c=e.data("bl"),p=e.data("br");if(e.data("hhh",e.outerHeight()),e.data("www",e.outerWidth()),punchgs.TweenLite.set(e.find(".esg-entry-content"),{display:"block"}),punchgs.TweenLite.set(e,{z:.1,zIndex:50,x:0-(n+l+p+c)/2,y:0-(i+s+u+d)/2,height:"auto",width:e.data("www")+n+l+c+p}),"on"==a.evenGridMasonrySkinPusher){var h=e.height()-e.data("hhh");offsetParrents(h,e)}e.css({paddingTop:i+"px",paddingLeft:n+"px",paddingRight:l+"px",paddingBottom:l+"px"}),e.css({borderTopWidth:u+"px",borderBottomWidth:d+"px",borderLeftWidth:c+"px",borderRightWidth:p+"px"}),1!=a.inanimation&&punchgs.TweenLite.set(e.closest(".esg-overflowtrick"),{overflow:"visible",overwrite:"all"})}jQuery.each(esgAnimmatrix,function(a,r){e.find(r[0]).each(function(){var a=jQuery(this),i=a.data("delay")!=undefined?a.data("delay"):0;animfrom=r[2],animto=r[3],animto.delay=i,animto.overwrite="all",animfrom.overwrite="all",animto.transformStyle="flat",animto.force3D=!0;var s=0,n=r[0].indexOf("out")>-1;a.hasClass("esg-entry-media")||n||(animto.clearProps="transform"),n&&(animfrom.clearProps="transform"),animto.z=.001,animfrom.transformPerspective==undefined&&(animfrom.transformPerspective=1e3),a.hasClass("esg-overlay")&&(animfrom.z==undefined&&(animfrom.z=-.002),animto.z=-1e-4);var l=a;if(a.hasClass("esg-entry-media")&&a.find(".esg-media-video").length>0)return!0;var u=punchgs.TweenLite.killTweensOf(l,!1);if("set"==t){var u=punchgs.TweenLite.set(l,animfrom);punchgs.TweenLite.set(e.find(".esg-entry-cover"),{visibility:"visible"}),n&&u.eventCallback("onComplete",resetTransforms,[l])}else switch(r[0]){case".esg-shifttotop":animto.y=0-e.find(".esg-bc.eec").last().height();var u=punchgs.TweenLite.fromTo(a,.5,{y:0},{y:animto.y});break;case".esg-slide":var d=directionPrepare(o,"in",e.width(),e.height()),c=new Object,p=new Object;jQuery.extend(c,animfrom),jQuery.extend(p,animto),c.css.x=d.x,c.css.y=d.y;var u=punchgs.TweenLite.fromTo(l,r[1],c,p,s);break;case".esg-slideout":var d=directionPrepare(o,"out",e.width(),e.height()),c=new Object,p=new Object;jQuery.extend(c,animfrom),jQuery.extend(p,animto),p.x=d.x,p.y=d.y,p.clearProps="";var u=punchgs.TweenLite.fromTo(l,r[1],c,p,s);break;default:var u=punchgs.TweenLite.fromTo(l,r[1],animfrom,animto,s)}})})},r))}function videoClickEvent(e,t,a,o){e.css({transform:"none","-moz-transform":"none","-webkit-transform":"none"}),e.closest(".esg-overflowtrick").css({transform:"none","-moz-transform":"none","-webkit-transform":"none"}),e.closest("ul").css({transform:"none","-moz-transform":"none","-webkit-transform":"none"}),o||e.find(".esg-media-video").each(function(){var t=jQuery(this),a=e.find(".esg-entry-media");if(t.data("youtube")!=undefined&&0==e.find(".esg-youtube-frame").length){var o="https://www.youtube.com/embed/"+t.data("youtube")+"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0";a.append('')}if(t.data("vimeo")!=undefined&&0==e.find(".esg-vimeo-frame").length){var r="https://player.vimeo.com/video/"+t.data("vimeo")+"?title=0&byline=0&html5=1&portrait=0&api=1;";a.append('')}if(t.data("wistia")!=undefined&&0==e.find(".esg-wistia-frame").length){var i="https://fast.wistia.net/embed/iframe/"+t.data("wistia")+"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0";a.append('')}if(t.data("soundcloud")!=undefined&&0==e.find(".esg-soundcloud-frame").length){var s="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+t.data("soundcloud")+"&auto_play=false&hide_related=false&visual=true&show_artwork=true";a.append('')}t.data("mp4")==undefined&&t.data("webm")==undefined&&t.data("ogv")==undefined||0!=e.find(".esg-video-frame").length||(a.append('