function validateEmail(n){var t=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(n)}window.app=function(){function l(n,t){var f=n.indexOf("?")==-1?"?":"&",r=[],i,u;for(i in t)r.push(i+"="+t[i]);return u=r.join("&"),n+f+u}function u(){return(typeof i=="undefined"||i==="")&&$.get(constant.appRoot+"templates/commentlisttemplate.mustache",function(n){i=n}),i}function r(t){switch(t){case constant.postListTemplateType.a:return(typeof n.a=="undefined"||n.a==="")&&$.get(constant.appRoot+"templates/postlistatemplate.mustache",function(t){n.a=t}),n.a;case constant.postListTemplateType.c:return(typeof n.c=="undefined"||n.c==="")&&$.get(constant.appRoot+"templates/postlistctemplate.mustache",function(t){n.c=t}),n.c;case constant.postListTemplateType.d:return(typeof n.d=="undefined"||n.d==="")&&$.get(constant.appRoot+"templates/postlistdtemplate.mustache",function(t){n.d=t}),n.d;case constant.postListTemplateType.e:return(typeof n.e=="undefined"||n.e==="")&&$.get(constant.appRoot+"templates/postlistetemplate.mustache",function(t){n.e=t}),n.e;case constant.postListTemplateType.f:return(typeof n.f=="undefined"||n.f==="")&&$.get(constant.appRoot+"templates/postlistftemplate.mustache",function(t){n.f=t}),n.f;case constant.postListTemplateType.g:return(typeof n.g=="undefined"||n.g==="")&&$.get(constant.appRoot+"templates/postlistgtemplate.mustache",function(t){n.g=t}),n.g;case constant.postListTemplateType.h:return(typeof n.h=="undefined"||n.h==="")&&$.get(constant.appRoot+"templates/postlisthtemplate.mustache",function(t){n.h=t}),n.h;case constant.postListTemplateType.search:return(typeof n.search=="undefined"||n.search==="")&&$.get(constant.appRoot+"templates/searchlisttemplate.mustache",function(t){n.search=t}),n.search;case constant.postListTemplateType.blog:return(typeof n.blog=="undefined"||n.blog==="")&&$.get(constant.appRoot+"templates/blogpostlisttemplate.mustache",function(t){n.blog=t}),n.blog;case constant.postListTemplateType.gridProduct:return(typeof n.gridProduct=="undefined"||n.gridProduct==="")&&$.get(constant.appRoot+"templates/productgridtemplate.mustache",function(t){n.gridProduct=t}),n.gridProduct;case constant.postListTemplateType.gridPhoto:return(typeof n.gridPhoto=="undefined"||n.gridPhoto==="")&&$.get(constant.appRoot+"templates/photogallerygridtemplate.mustache",function(t){n.gridPhoto=t}),n.gridPhoto;case constant.postListTemplateType.news:return(typeof n.news=="undefined"||n.news==="")&&$.get(constant.appRoot+"templates/postlistwebtemplate.mustache",function(t){n.news=t}),n.news;case constant.postListTemplateType.article:return(typeof n.article=="undefined"||n.article==="")&&$.get(constant.appRoot+"templates/postlistwebtemplate.mustache",function(t){n.article=t}),n.article;case constant.postListTemplateType.research:return(typeof n.research=="undefined"||n.research==="")&&$.get(constant.appRoot+"templates/researchlisttemplate.mustache",function(t){n.research=t}),n.research;case constant.postListTemplateType.authorArticle:return(typeof n.authorArticle=="undefined"||n.authorArticle==="")&&$.get(constant.appRoot+"templates/postlistauthortemplate.mustache",function(t){n.authorArticle=t}),n.authorArticle;case constant.postListTemplateType.b:default:return(typeof n.b=="undefined"||n.b==="")&&$.get(constant.appRoot+"templates/postlistbtemplate.mustache",function(t){n.b=t}),n.b}}function f(n,t){var i=r(n);return Mustache.to_html(i,t)}function a(n){var t=u();return Mustache.to_html(t,n)}function v(n){return'<p class="font-resize"><strong style="font-size:11px;">Font Size<\/strong><br/><a style="font-size:14px;margin-left:10px;" href="javascript:window.app.makeFontSmall(\''+n+'\');">A<\/a><a style="font-size:18px;margin-left:10px;" href="javascript:window.app.makeFontMedium(\''+n+'\');">A<\/a><a style="font-size:22px;margin-left:10px;" href="javascript:window.app.makeFontLarge(\''+n+"');\">A<\/a><\/p>"}function w(n,t){return n.toLowerCase()=="united states"||n.toLowerCase()=="canada"?n.toLowerCase()=="united states"?d(t):n.toLowerCase()=="canada"?g(t):!0:!0}function h(n,t){return n.toLowerCase()=="united states"||n.toLowerCase()=="canada"||n==""?tt(t):!0}function b(n,t){return n.toLowerCase()=="united states"||n.toLowerCase()=="canada"?n.toLowerCase()=="united states"?it(t):n.toLowerCase()=="canada"?rt(t):!0:!0}function k(n,t){return n.toLowerCase()=="united states"||n.toLowerCase()=="canada"?nt(t,n):t?!1:!0}function c(n){if(n){var t=n.match(/^[A-Za-z\s]+$/);return t?!0:!1}return!1}function d(n){if(n){var t=n.match(/^(\d{5}|\d{9})$/);return t?!0:!1}return!1}function g(n){if(n){var t=n.match(/^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}\s+[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$/);return t?!0:!1}return!1}function nt(n,t){return t.toLowerCase()=="united states"?n?jQuery.inArray(n,y)!==-1?!0:!1:!1:t.toLowerCase()=="canada"?n?jQuery.inArray(n,p)!==-1?!0:!1:!1:!0}function tt(n){if(n){var t=n.match(/^\d{10}$/);return t?!0:!1}return!1}function it(n){if(n){var t=n.match(/^[A-Za-z]{2}$/);return t?!0:!1}return!1}function rt(n){if(n){var t=n.match(/^[A-Za-z]{2}$/);return t?!0:!1}return!1}function ut(n,t){n.addClass("on"),t.addClass("on")}function e(n,t){n.removeClass("on"),t.removeClass("on")}var n={a:"",b:"",c:"",d:"",e:"",f:"",g:"",h:"",search:"",blog:"",gridProduct:"",gridPhoto:"",news:"",article:"",research:"",authorArticle:""},i="",o=[],t="",s=1,ft,y=["AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","AS","AA","AE","AP","CZ","CM","FM","GU","MH","MP","PW","PI","PR","TT","VI"],p=["AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT"];return{getGaqAccount:function(){return constant.gaqAccount},getGaqDomainName:function(){return constant.gaqDomainName},logError:function(n,t,i){if(n.length&&i>0){var r={Message:n||"",LineNumber:i,Url:t||window.location,Referrer:document.referrer||"",UserAgent:navigator.userAgent};$.ajax({type:"POST",url:constant.appRoot+"error/log",data:r,dataType:"json"})}},downloadWhitepaper:function(){var n=$(this),i=n.parents(".detail[data-role=page]"),r=n.parents(".ui-btn").find(".ui-btn-text"),f=n.parents(".post-leadfield"),u,t;$.cookie("LeadID")==null?window.location.href="http://www."+constant.gaqDomainName+"/whitepaper/"+i.data("postId"):u=$.cookie("LeadID"),t={whitepaperID:i.data("postId"),leadID:u},$.ajax({url:constant.apiUrl+"whitepaper/file/"+t.whitepaperID+"/"+t.leadID+"?apiKey="+constant.apiKey,crossDomain:!0,beforeSend:function(){n.attr("disabled","disabled"),r.text("Submitting...")},success:function(n){var t="."+constant.gaqDomainName;document.cookie="LeadID=; domain="+t+"; expires="+new Date(0).toUTCString()+"; path=/",$.cookie("LeadID",n.LeadID,{expires:constant.cookieWhitepaperExpireDays,domain:t,path:"/"}),window.location.href="http://www."+constant.gaqDomainName+"/whitepaper/downloadlist?wpid="+n.ID+"&fileid="+n.WhitepaperFiles[0].ID},error:function(){alert("There was an error. File could not be downloaded.")},complete:function(){n.removeAttr("disabled"),r.text(n.text())}})},postLead:function(){var r=$(this),s=r.parents(".detail[data-role=page]"),u=r.parents(".ui-btn").find(".ui-btn-text"),i=r.parents(".post-leadfield"),et=i.parents(".post-leadfield-box").find(".download-whitepaper"),l=i.find(".post-leadfield-firstName"),a=i.find(".post-leadfield-lastName"),v=i.find(".post-leadfield-jobTitle"),y=i.find(".post-leadfield-company"),f=i.find(".post-leadfield-phone"),p=i.find(".post-leadfield-email"),d=i.find(".post-leadfield-address"),g=i.find(".post-leadfield-address2"),nt=i.find(".post-leadfield-city"),tt=i.find(".post-leadfield-zip"),it=i.find("#state option:selected"),rt=i.find("#country option:selected"),e=i.find("#businessTypeSelect option:selected"),o=i.find("#jobTitleSelect option:selected"),ut=i.find("#numVehiclesSelect option:selected"),ot=i.find(".post-leadfield-advertiser"),st=i.find(".post-leadfield-tags"),ht=i.find(".post-leadfield-ipaddress"),ct=i.find(".post-leadfield-whitepapertitle"),lt=i.find(".post-leadfield-channelname"),ft=i.find(".post-leadfield-numVehicles"),n={postid:s.data("postId"),firstName:l.val(),lastName:a.val(),email:p.val(),businessTypeSelect:e.val(),businessTypeSelectText:e.text(),jobTitleSelect:o.val(),jobTitleSelectText:o.text(),numVehiclesSelectText:ut.text(),title:v.val(),company:y.val(),phone:f.val(),address:d.val(),address2:g.val(),city:nt.val(),zip:tt.val(),phone:f.val(),state:it.val(),country:rt.val(),numVehicles:ft.val()},t;if(!n.postid||!n.firstName||!n.lastName||!n.businessTypeSelect||!n.jobTitleSelect||!n.numVehicles||!n.title||!n.phone||!n.address||!n.city||!n.zip||!n.state||!n.country){alert("Please enter all fields.");return}if(!n.email.match(constant.regexEmail)){alert("Please enter valid email address.");return}if(!c(n.firstName)){alert("First Name should contain alphabetic characters only.");return}if(!c(n.lastName)){alert("Last Name should contain alphabetic characters only.");return}if(n.country){if(n.state){if(!k(n.country,n.state)){alert("State/Province does not match selected country.");return}if(!b(n.country,n.state)){alert("State/Province field should be two letter abbreviation.");return}}if((n.country.toLowerCase()=="united states"||n.country.toLowerCase()=="canada")&&!n.state){alert("Please select a state/province.");return}if(n.zip&&!w(n.country,n.zip)){if(n.country.toLowerCase()=="united states"){alert("Domestic zip codes should be 5 numeric characters (ex: 01302). If zip codes include +4, it should be 9 numeric characters with no space and no dash (ex: 013021023).");return}if(n.country.toLowerCase()=="canada"){alert("Canadian zip codes should have a space between 3rd and 4th position. (ex: A1A 2B2)<\/li>");return}}if(n.phone&&!h(n.country,n.phone)){alert("Domestic and Canadian phone numbers should be 10-digit numeric only.<\/li>");return}if(n.fax&&!h(n.country,n.fax)){alert("Domestic and Canadian fax numbers should be 10-digit numeric only.<\/li>");return}}t={},t["[0].Key"]="firstName",t["[0].Value"]=n.firstName,t["[1].Key"]="lastName",t["[1].Value"]=n.lastName,t["[2].Key"]="email",t["[2].Value"]=n.email,t["[3].Key"]="state",t["[3].Value"]=n.state,t["[4].Key"]="country",t["[4].Value"]=n.country,t["[5].Key"]="programType",t["[5].Value"]=n.programType,t["[6].Key"]="programTypeOther",t["[6].Value"]=n.programTypeOther,t["[7].Key"]="businesstypeselect",t["[7].Value"]=n.businesstypeselect,t["[8].Key"]="jobtitleselect",t["[8].Value"]=n.jobtitleselect,t["[9].Key"]="jobTitle",t["[9].Value"]=n.jobTitle,t["[10].Key"]="company",t["[10].Value"]=n.company,t["[11].Key"]="address",t["[11].Value"]=n.address,t["[12].Key"]="address2",t["[12].Value"]=n.address2,t["[13].Key"]="city",t["[13].Value"]=n.city,t["[14].Key"]="zip",t["[14].Value"]=n.zip,t["[15].Key"]="phone",t["[15].Value"]=n.phone,t["[16].Key"]="fax",t["[16].Value"]=n.fax,t["[17].Key"]="numVehicles",t["[17].Value"]=n.numVehicles,$.ajax({url:constant.apiUrl+"whitepaper/lead/"+n.postid+"?apiKey="+constant.apiKey,type:"POST",dataType:"json",data:t,crossDomain:!0,beforeSend:function(){r.attr("disabled","disabled"),u.text("Submitting...")},success:function(n){var t="."+constant.gaqDomainName;document.cookie="LeadID=; domain="+t+"; expires="+new Date(0).toUTCString()+"; path=/",$.cookie("LeadID",n.LeadID,{expires:constant.cookieWhitepaperExpireDays,domain:t,path:"/"}),window.location.href="http://www."+constant.gaqDomainName+"/whitepaper/downloadlist?wpid="+n.F_WhitepaperID},error:function(){alert("There was an error. Data could not be posted.")},complete:function(){r.removeAttr("disabled"),u.text(r.text())}})},loadMoreWhitepapers:function(n){n.stopImmediatePropagation(),n.preventDefault;var t=$(this),e=t.find(".ui-btn-inner .ui-icon"),h=t.parents(".posts-section"),c=h.find("div.posts"),v=t.data("channel")?"&f_channel="+t.data("channel"):"",o=t.data("templateType"),i=t.data("pageNumber"),l=t.data("pageSize"),s=t.attr("href"),u=t.data("trackUrl"),a=constant.apiUrl+"whitepaper?apiKey="+constant.apiKey+"&pagenumber="+i+"&pagesize="+l;return $.ajax({url:a,crossDomain:!0,beforeSend:function(){r(o),t.attr("disabled","disabled"),e.addClass("spinning")},success:function(n){var e=f(o,n),r,h,l;e?(c.append(e),$.support.pushState&&window.history.pushState({page:i},document.title,s),r=i+1,t.data("pageNumber",r),h=s.replace("/page/"+i,"/page/"+r),t.attr("href",h),l=u.replace("/page/"+i,"/page/"+r),t.data("trackUrl",l),window.app.reloadGoogleAnalytics(u),window.app.reloadPiwik(u)):t.hide()},error:function(){alert("There was an error loading more.")},complete:function(){t.removeAttr("disabled"),e.removeClass("spinning")}}),!1},postLike:function(){var n=$(this),i=$(".post-like-count"),r=n.parents(".detail[data-role=page]"),t={contenttype:r.data("contentType"),postid:r.data("postId")},u=parseInt(i.html()),f=constant.cookieLikeKey+t.contenttype+t.postid;if($.cookie(f)!=null||n.hasClass("liked")){n[0].text=="Like"?n.text("Like").addClass("liked"):n.text("Helpful!").addClass("liked");return}$.ajax({url:constant.apiUrl+"post/likecount?apiKey="+constant.apiKey,type:"POST",dataType:"json",data:t,crossDomain:!0,beforeSend:function(){n.attr("disabled","disabled"),n[0].text=="Like"?n.text("Like").addClass("liked"):n.text("Helpful!").addClass("liked"),u++,i.html(u)},success:function(){$.cookie(f,1,{expires:constant.cookieLikeExpireDays})},error:function(){alert("There was an error")},complete:function(){n.removeAttr("disabled")}})},postExpandShare:function(){$("#bottomShare").show()},postComment:function(){var t=$(this),r=t.parents(".detail[data-role=page]"),f=t.parents(".ui-btn").find(".ui-btn-text"),c=t.parents(".comments-section").find(".comments.ui-listview"),i=t.parents(".post-comment"),s=i.find(".post-comment-name"),h=i.find(".post-comment-email"),e=i.find(".post-comment-comment"),n={contenttype:r.data("contentType"),postid:r.data("postId"),author:s.val(),authoremail:h.val(),text:e.val()},o;if(($.cookie(constant.cookieCommentKeyUserName)==null||$.cookie(constant.cookieCommentKeyUserEmail)==null)&&(o=grecaptcha.getResponse(),o.length==0)){alert("Please validate that you are human.");return}if(!n.contenttype||!n.postid||!n.author||!n.authoremail||!n.text){alert("Please enter name, email and comment.");return}if(!n.authoremail.match(constant.regexEmail)){alert("Please enter valid email address.");return}$.cookie(constant.cookieCommentKeyUserName,n.author,{expires:constant.cookieCommentExpireDays}),$.cookie(constant.cookieCommentKeyUserEmail,n.authoremail,{expires:constant.cookieCommentExpireDays}),$.ajax({url:constant.apiUrl+"comment?apiKey="+constant.apiKey,type:"POST",dataType:"json",data:n,crossDomain:!0,beforeSend:function(){u(),t.attr("disabled","disabled"),f.text("Submitting...")},success:function(){e.val(""),alert("Thank you for joining the discussion. Your comment is pending approval.")},error:function(){alert("There was an error. Comment could not be posted.")},complete:function(){t.removeAttr("disabled"),f.text(t.text())}})},loadAllComments:function(){var n=$(this),t=n.parents(".ui-btn").find(".ui-btn-text"),f=n.parents("li.ui-li"),i=n.parents("ul.comments"),r=n.parents(".detail[data-role=page]"),e=r.data("contentType"),o=r.data("postId"),s=constant.apiUrl+"comment?apiKey="+constant.apiKey+"&contenttype="+e+"&id="+o;$.ajax({url:s,crossDomain:!0,beforeSend:function(){u(),n.attr("disabled","disabled"),t.text("Loading...")},success:function(n){var t=a(n);i.html(t),i.find("span.date").each(function(n,t){$(t).text($.format.date($(t).text()+"-08:00","M/d/yyyy h:mm:ss a"))}),f.remove()},error:function(){alert("There was an error loading comments.")},complete:function(){n.removeAttr("disabled"),t.text(n.text())}})},appendShaftToRightColumn:function(n,t,i){var l,u,s,h,c,y;if(document.getElementsByClassName("right").length!=0&&!window.constant.hideAds){t||(t=1);var f="ad-shaft-"+t,h="sticky-ad-block-"+t,o=$("#header").height()+30,a=600,e=$(".left div.pagebreak"),r;if(t==1&&e.length>0?(r=$(e[0]).offset().top-$(".right").height(),r<a&&e.length>1&&($(e[0]).addClass("skip"),r=$(e[1]).offset().top-$(".right").height())):r=t>1&&e.length>1?$(e[1]).offset().top-$(".right").height():$(".left").height()-$(".right").height(),r<a&&(r=0),t==1){if(u=document.createElement("div"),u.setAttribute("id",f),u.setAttribute("class","ad-shaft"),u.innerHTML="<div class='ad-shaft-bottom'><\/div>",r>0&&(u.style.height=r+"px"),l=document.getElementsByClassName("right")[0],l.innerHTML=l.innerHTML+u.outerHTML,n){c="<div id='"+h+"' class='sticky-ad-block'"+(i?" style='height:"+i+";'":"")+">"+n+"<\/div>",u=document.getElementById(f),u.innerHTML=u.innerHTML+c;var p=$("#"+f).waypoint(function(n){n=="down"?$(this.element).find(".sticky-ad-block").addClass("ad-stuck").css("top",o):$(this.element).find(".sticky-ad-block").removeClass("ad-stuck").removeClass("ad-unstuck")},{offset:o}),v=o+$("#"+h).height(),w=$("#"+f+" .ad-shaft-bottom").waypoint(function(n){var t=$(this.element).siblings(".sticky-ad-block");n=="down"?t.hasClass("ad-stuck")&&t.removeClass("ad-stuck").addClass("ad-unstuck"):t.hasClass("ad-unstuck")&&t.removeClass("ad-unstuck").addClass("ad-stuck")},{offset:v})}}else s=$("<div><\/div>").attr("id",f).addClass("ad-shaft"),s.append("<div class='ad-shaft-bottom'><\/div>"),$(".right").append(s),r>0&&s.css("height",r),n&&(h="sticky-ad-block-"+t,c=$("<div><\/div>").attr("id",h).addClass("sticky-ad-block").append(n),i&&c.css("height",i),s.append(c),y=$("#"+f).waypoint(function(n){n=="down"?$(this.element).find(".sticky-ad-block").addClass("ad-stuck").css("top",o):$(this.element).find(".sticky-ad-block").removeClass("ad-stuck").removeClass("ad-unstuck")},{offset:o}),window.app.callbackForIframeAdLoad=function(){var n=o+$("#"+h).height(),t=$("#"+f+" .ad-shaft-bottom").waypoint(function(n){var t=$(this.element).siblings(".sticky-ad-block");n=="down"?t.hasClass("ad-stuck")&&t.removeClass("ad-stuck").addClass("ad-unstuck"):t.hasClass("ad-unstuck")&&t.removeClass("ad-unstuck").addClass("ad-stuck")},{offset:n})})}},pagebreakAds:function(n,i){var u,r,f,e;if(!($.inArray(n,o)>=0)){if(o.push(n),s++,u=l(window.location.pathname+window.location.search,{page:s}),window.app.reloadGoogleAnalytics(u),window.app.reloadPiwik(u),$(i).hasClass("skip")){$(i).remove();return}r=$.inArray(t,constant.dynamicAds)+1,r>=constant.dynamicAds.length&&(r=0),t=constant.dynamicAds[r],f=window.app.getScreenContext();switch(f){case"mobile":case"tablet":e='<div class="banner-300x250-list"><iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe><\/div>',$(i).replaceWith(e),window.app.callbackForIframeAdLoad&&(window.app.callbackForIframeAdLoad(),window.app.callbackForIframeAdLoad=null);break;default:window.app.appendShaftToRightColumn('<iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe>',r+2),$(i).remove()}}},loadMorePosts:function(n){if(n.stopImmediatePropagation(),n.preventDefault,$(this).attr("disabled")=="disabled")return!1;var i=$(this),it=i.find(".ui-btn-inner .ui-icon"),h=i.parents(".posts-section"),c=h.find(".posts"),l=i.data("channel")?"&f_channel="+i.data("channel"):"",a=i.data("contentType")?"&f_contenttype="+i.data("contentType"):"",v=i.data("excludeType")?"&fe_type="+i.data("excludeType"):"",y=i.data("excludeId")?"&fe_posts="+i.data("excludeId"):"",p=i.data("blogId")?"&f_blogid="+i.data("blogId"):"",w=i.data("tags")?"&f_tags="+i.data("tags"):"",b=i.data("excludeTagNames")?"&fe_tags="+i.data("excludeTagNames"):"",k=i.data("sort")?"&sort="+i.data("sort"):"",d=i.data("limitDaysPostDate")?"&limitdays_postdate="+i.data("limitDaysPostDate"):"",g=i.data("limitDaysDateViewed")?"&limitdays_dateviewed="+i.data("limitDaysDateViewed"):"",o=i.data("templateType"),u=i.data("pageNumber"),nt=i.data("pageSize"),s=i.attr("href"),e=i.data("trackUrl"),tt=constant.apiUrl+"post?apiKey="+constant.apiKey+l+a+v+y+p+w+b+k+d+g+"&pagenumber="+u+"&pagesize="+nt;return $.ajax({url:tt,crossDomain:!0,beforeSend:function(){r(o),i.attr("disabled","disabled"),i.text("Loading...")},success:function(n){var y=f(o,n),r,l,p,w,b,h,a,v;if(y){r=$(y),l=$.inArray(t,constant.dynamicAds)+1,l>=constant.dynamicAds.length&&(l=0),t=constant.dynamicAds[l],p=window.app.getScreenContext();switch(p){case"mobile":case"tablet":w='<div class="banner-300x250-list"><iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe><\/div>',r=$("<div>"+y+"<\/div>"),r.children(".story-list").eq(1).after($(w)),r=r.unwrap()}if(c.append(r),b=$(".posts-load-more").waypoint(function(n){n=="down"&&$(this.element).trigger("click"),this.destroy()},{offset:$(window).height()+500,triggerOnce:!0}),!window.constant.hideAds)switch(p){case"mobile":case"tablet":window.app.callbackForIframeAdLoad&&(window.app.callbackForIframeAdLoad(),window.app.callbackForIframeAdLoad=null);break;default:window.app.appendShaftToRightColumn('<iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe>',u)}$.support.pushState&&window.history.pushState({page:u},document.title,s),h=u+1,i.data("pageNumber",h),a=s.replace("/page/"+u,"/page/"+h),a=a.replace("?page="+u,"?page="+h),i.attr("href",a),e&&(v=e.replace("/page/"+u,"/page/"+h),v=v.replace("?page="+u,"?page="+h),i.data("trackUrl",v),window.app.reloadGoogleAnalytics(e),window.app.reloadPiwik(e))}else i.hide()},error:function(){alert("There was an error loading more.")},complete:function(){i.removeAttr("disabled"),i.text("Load More")}}),!1},loadMoreSearchPosts:function(n){if(n.stopImmediatePropagation(),n.preventDefault,$(this).attr("disabled")=="disabled")return!1;var i=$(this),o=i.find(".ui-btn-inner .ui-icon"),c=i.parents("#search-results"),l=c.find(".search-posts"),a=i.data("excludeType")?"&fe_type="+i.data("excludeType"):"",v=i.data("dateRange")?"&daterange="+i.data("dateRange"):"",y=i.data("sort")?"&sort="+i.data("sort"):"",p=i.data("category")?"&f_category="+i.data("category"):"",w=i.data("type")?"&f_type="+i.data("type"):"",b=i.data("tag")?"&f_tag="+i.data("tag"):"",k=i.data("author")?"&f_author="+i.data("author"):"",d=i.data("searchKeyword")?"&q="+i.data("searchKeyword"):"",s=i.data("templateType"),u=i.data("pageNumber"),g=i.data("pageSize"),h=i.attr("href"),e=i.data("trackUrl"),nt=constant.apiUrl+"search?apiKey="+constant.apiKey+a+p+w+b+k+v+y+d+"&pagenumber="+u+"&pagesize="+g;return $.ajax({url:nt,crossDomain:!0,beforeSend:function(){r(s),i.attr("disabled","disabled"),o.addClass("spinning")},success:function(n){var o=f(s,n),r,c,v,y,b,a,p,w;if(o){r=$(o),c=$.inArray(t,constant.dynamicAds)+1,c>=constant.dynamicAds.length&&(c=0),t=constant.dynamicAds[c],v=window.app.getScreenContext();switch(v){case"mobile":case"tablet":y='<div class="banner-300x250-list"><iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe><\/div>',r=$("<div>"+o+"<\/div>"),r.children(".story-list").eq(1).after($(y)),r=r.unwrap()}if(l.append(o),b=$(".search-posts-load-more").waypoint(function(n){n=="down"&&$(this.element).trigger("click"),this.destroy()},{offset:$(window).height()+500,triggerOnce:!0}),!window.constant.hideAds)switch(v){case"mobile":case"tablet":window.app.callbackForIframeAdLoad&&(window.app.callbackForIframeAdLoad(),window.app.callbackForIframeAdLoad=null);break;default:window.app.appendShaftToRightColumn('<iframe class="ad-'+t+'" src="/ad/'+constant.adPageName+"/"+t+'" frameborder="0" border="0" scrolling="no" seamless="seamless" style="width: 100%; height: 0;"><\/iframe>',u)}$.support.pushState&&window.history.pushState({page:u},document.title,h),a=u+1,i.data("pageNumber",a),p=h.replace("&page="+u,"&page="+a),i.attr("href",p),e&&(w=e.replace("&page="+u,"&page="+a),i.data("trackUrl",w),window.app.reloadGoogleAnalytics(e),window.app.reloadPiwik(e))}else i.hide()},error:function(){alert("There was an error loading more.")},complete:function(){i.removeAttr("disabled"),o.removeClass("spinning")}}),!1},enewsSignup:function(){var i=$(this),n=i.parents(".enews-signup").find(".enews-signup-email").val(),t=constant.emailPreferenceUrl_Textbox.replace(/&amp;+/g,"&");n&&($.cookie(constant.cookieCommentKeyUserEmail,n,{expires:constant.cookieCommentExpireDays}),t+="&em="+n),window.open(t,"_blank")},reloadGoogleAnalytics:function(n,t,i){t&&ga("set","dimension1",t+""),i&&ga("set","dimension2",i),n?ga("send","pageview",{page:n}):ga("send","pageview"),setTimeout("ga('send', 'event', '10_seconds', 'read')",1e4)},reloadPiwik:function(n){n?_paq.push(["trackPageView",n]):_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),_paq.push(["setCookieDomain",constant.paqCookieDomain])},reloadAddThis:function(n){var t=n.find(".social-tools"),i;t.length&&(window.addthis&&(window.addthis=null),i={data_ga_property:constant.gaqAccount,data_ga_social:!0},$.getScript("http://s7.addthis.com/js/300/addthis_widget.js#pubid="+constant.addThisPubId))},makeFontSmall:function(n){$("#"+n+" section.content").removeClass("medium").removeClass("large")},makeFontMedium:function(n){$("#"+n+" section.content").removeClass("large").addClass("medium")},makeFontLarge:function(n){$("#"+n+" section.content").removeClass("medium").addClass("large")},reloadFontTools:function(n){var r=n.attr("id"),t=n.find("section.content .story"),i;t.length&&t.find(".font-resize").length===0&&(i=v(r),t.children("p img").first().length>0?t.children("p img").first().parents("p:first").after(i):t.children("p").first().before(i))},reloadNavMore:function(n){var t=n.find(".navbar-more"),i=n.find(".navbar-more-box");e(t,i),t.unbind("click").click(function(){t.hasClass("on")?e(t,i):ut(t,i)}),$(document).mouseup(function(n){t.has(n.target).length===0&&e(t,i)})},prefillNameAndEmail:function(n){$.cookie(constant.cookieCommentKeyUserName)!=null&&$.cookie(constant.cookieCommentKeyUserEmail)!=null&&n.find("#commentRecaptcha").css("display","none"),n.find(".post-comment-name").val($.cookie(constant.cookieCommentKeyUserName)),n.find(".post-comment-email").val($.cookie(constant.cookieCommentKeyUserEmail)),n.find(".enews-signup-email").val($.cookie(constant.cookieCommentKeyUserEmail))},showAdIframe:function(n,t){$(".ad-"+n).height(t).parent().show(),window.app.callbackForIframeAdLoad&&(window.app.callbackForIframeAdLoad(),window.app.callbackForIframeAdLoad=null)},updateAdIframeHeight:function(n,t){$(".ad-"+n).height(t)},getScreenContext:function(){var i=constant.mobileBreakpoint,r=constant.tabletBreakpoint,n,t=document.documentElement.clientWidth;return n=t<=i?"mobile":t>i&&t<=r?"tablet":"desktop"},adPositions:function(){var n=window.app.getScreenContext();return adConfig[n].positions.join(",")},repositionAds:function(){var i,n,t,r;if(typeof adConfig!="undefined"&&(i=window.app.getScreenContext(),n=adConfig[i].layout,n))for(t=0;t<n.length;t++)document.getElementById("ad_"+n[t].replaceTarget)!=null&&document.getElementById("ad_"+n[t].replacement)!=null&&(r=document.getElementById("ad_"+n[t].replaceTarget),r.innerHTML=document.getElementById("ad_"+n[t].replacement).innerHTML,document.getElementById("ad_"+n[t].replacement).innerHTML="")},trackEventGA:function(n,t,i){ga("send","event",n,t,i),console.log("testing click tag: "+n+" "+t+" "+i)},showPopupNav:function(){$("html, body").scrollTop(0),$("#header").css("position","absolute");var t=$("<div id='menu-popover-bg'><\/div>"),i=$("<a id='menu-popover-close' href='javascript:void(0);'>Close<\/a>"),n=$("<div id='menu-popover'><\/div>"),r=$("<ul><\/ul>").append($("#main-nav").clone().find("li:not(.nav-more)")),u=$("<ul><\/ul>").append($("#more-nav").clone().find("li")),f=$("#top-social-media").clone().removeAttr("id").addClass("social-media");return n.append(r).append(u).append(f),$("body").append(t).append(n).append(i),$("div[data-role='page']").css("position","fixed"),!1},hidePopupNav:function(){return $("div[data-role='page']").css("position",""),$("html, body").scrollTop(0),$("#header").css("position","fixed"),$("#menu-popover").remove(),$("#menu-popover-close").remove(),$("#menu-popover-bg").remove(),!1},hideAllSubNav:function(n){var i=$(".sorting-nav"),t=$(".sorting-nav .swiper-wrapper .swiper-slide.has-sub ul.sub-nav"),r=$(".sorting-nav .swiper-wrapper .swiper-slide.has-sub a.show-sub");n?t.is(n.target)||i.has(n.target).length!==0||r.is(n.target)||t.slideUp("fast"):t.slideUp("fast")},showPopupSubNav:function(n){$("html, body").scrollTop(0);var u=$("<div id='subnav-popover-bg'><\/div>"),f=$("<a id='subnav-popover-close' href='javascript:void(0);'>Close<\/a>"),i=$("<div id='subnav-popover'><\/div>"),r=$(n.target).parents(".has-sub"),e=$("<h2><\/h2>").append(r.attr("title")),t=$("<ul><\/ul>");return $(this).attr("title")?t.append($("<li><\/li>").append($(this).attr("title"))):t.append($("<li><\/li>").append($(this).text())),t.append(r.find("ul.sub-nav").clone().find("li")),i.append(e).append(t),$("body").append(u).append(i).append(f),$("div[data-role='page']").css("position","fixed"),!1},hidePopupSubNav:function(){return $("div[data-role='page']").css("position",""),$("html, body").scrollTop(0),$("#subnav-popover").remove(),$("#subnav-popover-close").remove(),$("#subnav-popover-bg").remove(),!1}}}(),window.slider={},window.onerror=function(n,t,i){window.app.logError(n,t,i)},$(document).bind("mobileinit",function(){$.mobile.page.prototype.options.keepNative="select, input, label, button, textarea"}),$(document).bind("ready",function(){var n,i,t,r,u,f,e,o;$.mobile.ajaxEnabled=!1,$.mobile.pushStateEnabled=!1,$.mobile.defaultPageTransition="none",$(".ui-loader").hide(),n=$(document);n.on("click",".post-comment-submit",window.app.postComment);n.on("click",".comments-load-all",window.app.loadAllComments);n.on("click",".posts-load-more",window.app.loadMorePosts);n.on("click",".search-posts-load-more",window.app.loadMoreSearchPosts);n.on("click",".enews-signup-submit",window.app.enewsSignup);n.on("click",".post-like-increment",window.app.postLike);n.on("click",".post-bottom-share",window.app.postExpandShare);n.on("click","#menu",window.app.showPopupNav);n.on("click","#menu-popover-close",window.app.hidePopupNav);n.on("click",".sorting-nav .swiper-wrapper .swiper-slide.has-sub a.show-sub-popover",window.app.showPopupSubNav);n.on("click","#subnav-popover-close",window.app.hidePopupSubNav);n.on("click",".post-leadfield-submit",window.app.postLead);n.on("click",".btn-download-whitepaper",window.app.downloadWhitepaper);n.on("click",".whitepapers-load-more",window.app.loadMoreWhitepapers);if(i=250,t=!1,n.scroll(function(){var r;n.scrollTop()>i?t||(t=!0,$("#popular-topics").hide(),$("#main-nav").detach().insertAfter($("#header .logo")),$("#top-social-media").detach().insertBefore($("#header #search")),$("#nav").hide(),$("#header").addClass("fixed"),$("#nav-more").addClass("fixed"),$("body > .tt-menu").css({position:"fixed"}),r=$(".typeahead").offset(),r.top=60,$("body > .tt-menu").css(r)):n.scrollTop()==0&&($("#nav-more").removeClass("fixed"),$("#header").removeClass("fixed"),$("#nav").show(),$("#main-nav").detach().appendTo($("#nav .wrapper")),$("#top-social-media").detach().appendTo($("#nav .wrapper")),$("#popular-topics").show(),t=!1,$("body > .tt-menu").css({position:"fixed"}),r=$(".typeahead").offset(),r.top+=$(".typeahead").outerHeight(),$("body > .tt-menu").css(r))}),$("#main-nav li.nav-more, #nav-more").hover(function(){$("#nav-more").stop().show(0,function(){$("#main-nav li.nav-more a").addClass("selected")})},function(){$("#nav-more").delay(1e3).queue(function(n){$("#nav-more").hide(0,function(){$("#main-nav li.nav-more a").removeClass("selected")}),n()})}),!window.constant.hideAds){r=window.app.getScreenContext();switch(r){case"mobile":case"tablet":break;default:u=$(".stickyAd").css("height"),f=$(".stickyAd").html(),$(".stickyAd").remove(),window.app.appendShaftToRightColumn(f,1,u)}}pagebreakTriggered=[],storyPageNumber=1,e=$(window).height()+500,o=$(".left div.pagebreak").waypoint(function(n){this.destroy(),n=="down"&&window.app.pagebreakAds(this.key,this.element)},{offset:e})});$(document).on("pageshow","[data-role=page]",function(n,t){var i=$(this),e;t.prevPage.attr("id")&&i.find("script").each(function(){eval($(this).html())});var u=window.location.hash.replace("#",""),f=i.data("trackPageView"),r=f?f:u?u:window.location.pathname+window.location.search;i.hasClass("detail")&&r!="/"?window.app.reloadGoogleAnalytics(r,i.data("pubDate"),i.data("author")):window.app.reloadGoogleAnalytics(r),window.app.reloadPiwik(r),window.app.reloadFontTools(i),window.app.reloadNavMore(i),window.app.prefillNameAndEmail(i),$("html").hasClass("ie8")||(typeof Swiper!="undefined"&&(e=new Swiper(".sorting-nav.swiper-container",{slidesPerView:"auto",spaceBetween:40,preventClicks:!1})),$(".sorting-nav .swiper-wrapper .swiper-slide.has-sub a.show-sub").click(function(){var n=$(this).parents(".has-sub").find("ul.sub-nav");n.slideToggle("fast")}),$(document).mouseup(window.app.hideAllSubNav),window.app.hideAllSubNav())});$(document).on("click","#tag-list a",function(){window.app.trackEventGA("button","story-tag",$(this).data("tag"))});$(document).on("pageshow","#page-home",function(){var t=$(this),n;addToHomescreen(),$("html").hasClass("ie8")||typeof Swiper!="undefined"&&(n=new Swiper("#top-slider.swiper-container",{centeredSlides:!0,slidesPerView:"auto",spaceBetween:10,autoplay:3500,autoplayDisableOnInteraction:!1,pagination:".swiper-pagination",paginationClickable:!0,preventClicks:!1}))});$(document).on("change","#SelectedYear",function(){var n=$(this).val();return n&&(window.location="/magazine/past-issues?year="+n),!1});$(document).ready(function(){app.repositionAds();$(".typeahead").typeahead(null,{displayKey:"value",source:acitems.ttAdapter(),minLength:3}).on("typeahead:select",function(){$("#searchform").submit()}).on("typeahead:render",function(){$(".tt-menu").appendTo("body"),$("body > .tt-menu").css({position:"fixed"});var u=$(".typeahead").offset();u.top=60,$("body > .tt-menu").css(u),$("body > .tt-menu").css("zIndex","6000")})});var acitems=new Bloodhound({datumTokenizer:function(n){return Bloodhound.tokenizers.whitespace(n.value)},queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:constant.apiUrl+"tag?apikey=xyz&keyword=",replace:function(n,t){return n+t},filter:function(n){return $.map(n.Items,function(n){return{value:n.Name}})}}});acitems.initialize()