function SearchQuestion(){var t=$("#search-go"),n;if(t.button("loading"),$("#search-input").val().length==0){t.button("reset");return}n=document.location.hostname.substr(document.location.hostname.lastIndexOf(".")+1),n=n==="au"?"com.au":"co.nz",$.ajax({url:"/Umbraco/api/apiquestion/Search",type:"POST",data:{question:$("#search-input").val()},beforeSend:function(){$("#result-questions").empty()},success:function(t){$(".search-results").show(),t&&t.length?($(".results").show(),$(".no-results").hide(),$.each(t,function(t,i){console.log(n),(String(i.Url).indexOf(n)!==-1||n==="co.nz"&&String(i.Url).indexOf("com.au")===-1)&&$("#result-questions").append("<li><a href='"+i.Url+"'>"+i.Question+"<\/li>")})):($(".results").hide(),$(".no-results").show())},error:function(){$(".results").hide(),$("#no-results").show()},complete:function(){t.button("reset")}})}var InstagramLoader=function(){var t={},n={userId:"userId",tag:"tag",placeholderClass:".element-social",domain:document.location.hostname.substr(document.location.hostname.lastIndexOf(".")+1)};return t.init=function(t){var i,r;$.extend(n,t),i=$(n.placeholderClass).length,i>0&&(r="/Umbraco/api/apiinstagram/get?userId="+n.userId+"&tag="+n.tag+"&count="+i+"&domain="+n.domain,$.ajax({url:r,beforeSend:function(){for(var r,t=0;t<i;t++)r=$(n.placeholderClass)[t],$(r).spin({lines:9,length:5,width:4,radius:6,color:"#FFF"})},success:function(t){for(var u,r=0;r<i;r++)u=$(n.placeholderClass)[r],t[r]&&$(u).find("img").prop("src",t[r])},complete:function(){for(var r,t=0;t<i;t++)r=$(n.placeholderClass)[t],$(r).find("img").show(),$(r).spin(!1)}}))},t}(InstagramLoader||{}),$container;(function(n){var t;n.fn.shareUrl=function(){function r(n){window.open(n,"share",t)}var i={url:"",image:"",title:"",message:""};return t=i.isMobile?"toolbar=0,status=0":"toolbar=0,status=0,width=600,height=400",this.each(function(){var t=n(this);t.click(function(){var t=n(this).data("action"),u;i.url=n(this).data("url"),i.image=n(this).data("image"),i.title=n(this).data("title"),i.message=n(this).data("message");var f=n(this).data("ga-type"),e=n(this).data("ga-location")||"",o=n(this).data("ga-option")||"";trackEvent(f,e,o),u={twitter:"https://twitter.com/intent/tweet?url="+encodeURIComponent(i.url)+"&text="+encodeURIComponent(i.message)},t=="facebook"?FB.ui({method:"feed",name:i.title,caption:"U By Kotex",description:i.message,link:i.url,picture:i.image},function(){}):r(u[t])})}),this}})(jQuery),function(n){n.fn.verify=function(){this.each(function(){var t=n(this);t.find("a").each(function(){var r=n(this).data("id"),i=n.cookie("votes-"+r);i!==undefined&&(t.addClass("disabled"),n(this).data("helpful").toString()===i&&n(this).addClass("voted"))})})},n.fn.vote=function(t,i){this.each(function(){var u=n(this),r=u.data("id"),f=n.cookie("votes-"+r);u.click(function(e){var s,o;return e.stopPropagation(),u.parent(".vote").addClass("disabled"),f=n.cookie("votes-"+r),s=u.data("helpful"),f===undefined&&(o={NodeId:r,IsHelpful:s},n.ajax({type:"POST",url:t,data:o}).done(function(t){n.cookie("votes-"+r,o.IsHelpful),n("span.helpful-percent[data-id*="+r+"]").text(t),o.IsHelpful===!1&&n("#vote-down").modal({backdrop:"static"}),i()})),!1})})}}(jQuery),$(document).ready(function(){$(".element-video").on("click",function(){$(this).find(".content").is(":visible")&&$(this).find(".content").click()});$(".element-video .content").click(function(){var n=$(this).data("videoid"),t='<iframe src="//www.youtube.com/embed/'+n+'?autoplay=1&amp;autohide=1&amp;showinfo=0&amp;rel=0&amp;wmode=transparent" frameborder=0 allowfullscreen><\/iframe>';$(this).hide(),$(this).next().show().html(t)})}),function(){var t=184,i=184,n;$(document).ready(function(){setTimeout(function(){n()},200)}),$(window).resize(function(){n()}),n=function(){var n;$("html").hasClass("browser-ie8")?$("body").width()>=367?(n=$("#isotope-container"),n.isotope({itemSelector:".element",transformsEnabled:!1,layoutMode:"perfectMasonry",perfectMasonry:{layout:"vertical",liquid:!1,columnWidth:t,rowHeight:i}})):(n=$("#isotope-container"),n.hasClass("isotope")&&n.isotope("destroy")):Modernizr.mq("(min-width: 367px)")?(n=$("#isotope-container"),n.isotope({itemSelector:".element",transformsEnabled:!1,layoutMode:"perfectMasonry",perfectMasonry:{layout:"vertical",liquid:!1,columnWidth:t,rowHeight:i}})):(n=$("#isotope-container"),n.hasClass("isotope")&&n.isotope("destroy"))},$(".element-range").each(function(){var n=$(this).height(),t;if(n>0){if(n>174)var i=n-174,r=Math.ceil(i/184),t=174+r*184;else t=174;$(this).height(t)}})}(),$container=$("#isotope-container"),$container.delegate(".element.element-question","click",function(n){var u,i;if(!$(this).hasClass("large")){$(".article").remove();var r=$(this).data("id"),f=document.location.hostname.substr(document.location.hostname.lastIndexOf(".")+1),t=$(this);return $(".call-to-action").show(),$(".content").show(),$(".element").removeClass("large"),History.enabled&&(n.preventDefault(),u=$(this).attr("href"),i=$(this).data("title"),History.pushState({data:i},i,u)),$.ajax({url:"/umbraco/Surface/QuestionViewSurface/GET?id="+r+"&domain="+f,beforeSend:function(){t.hasClass("has-image")?t.spin({lines:9,length:5,width:4,radius:6,color:"#FFF"}):t.spin({lines:9,length:5,width:4,radius:6,color:"#000"})},success:function(n){t.find(".content").removeClass("active"),t.find(".call-to-action").removeClass("active"),t.find(".content").hide(),t.find(".call-to-action").hide(),t.addClass("large"),t.append("<div class='article'>"+n+"<\/div>");try{$container.isotope("reLayout",function(){}),$("html, body").animate({scrollTop:$(".article").offset().top-20},300)}catch(u){}var i="/Umbraco/api/ApiVote/Post";$(".vote").verify(),$(".vote a").vote(i,function(){$(".vote").verify(),feedbackmodalformreset(r)}),typeof articleCallback=="function"&&articleCallback()},complete:function(){t.spin(!1),t.find("a").click(function(n){n.stopPropagation()});t.find(".close-btn").on("click",function(n){var i,t,r;if(n.preventDefault(),n.stopPropagation(),History.enabled&&(i="U by Kotex",History.pushState({data:i},i,"")),t=$(this).parents(".element"),r=$(this).data("parent-url"),$(t).hasClass("large")){$(t).removeClass("large"),$(t).find(".content").show(),$(t).find(".content").addClass("active"),$(t).find(".call-to-action").addClass("active"),$(t).find(".call-to-action").show(),location.href="#"+r,$(".article").remove();try{$container.isotope("reLayout",function(){}),$("html, body").animate({scrollTop:$(t).offset().top-10},300)}catch(u){}}return!1})}}),!1}return!1});$("#search-go").on("click",function(){SearchQuestion()});$("#search-input").keyup(function(n){$("#Question").val($(this).val()),n.keyCode==13&&SearchQuestion()}),$(document).ready(function(){$(".filters .view-more").click(function(){$(".filters .view-more .fa-plus-square").toggle(),$(".filters .view-more .fa-minus-square").toggle(),$(".filters .more-categories").slideToggle()})})