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

FAILURE: "+t+"

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