var plpMainpageCookieHandler={cookieData:{rawCookieString:"",combinedCookieArray:[],unreadPlpItemsArray:[],markedAsCompleteArray:[]},numOfPlpElemsModalTrigger:3,maxNumberOfCookiePlpItems:12,init:function(){$(".Tabs").click(function(e){0==$(this).attr("count")&&e.preventDefault()}),$(".mplp_section_header").click(function(){$(this).hasClass("expanded")?($(this).removeClass("expanded"),$(this).next(".mplp_list_item_container").hide()):($(this).next(".mplp_list_item_container").show(),$(this).addClass("expanded"))}),$(".anonymousUser")&&($("body").on("click",".mplp_m_remove",function(){plpMainpageCookieHandler.updatePlpCookie("remove",$(this).attr("plpid"))}),$("body").on("click",".mplp_m_complete",function(){$("article.read").length?plpMainpageCookieHandler.updatePlpCookie("mark_as_todo",$(this).attr("plpid")):plpMainpageCookieHandler.updatePlpCookie("mark_as_read",$(this).attr("plpid"))})),$(".read").length&&$("a.mplp_m_complete").text("add back to To Do list")},updatePlpCookie:function(e,a){switch(plpMainpageCookieHandler.getCookie("plp_public")||plpMainpageCookieHandler.setCookie("plp_public","[]|[]",365),plpMainpageCookieHandler.readCurrentPlpCookieData(),e){case"add":plpMainpageCookieHandler.setCookie("plp_public",plpMainpageCookieHandler.addItemToCookie(a),365);break;case"mark_as_read":plpMainpageCookieHandler.setCookie("plp_public",plpMainpageCookieHandler.markAsReadInCookie(a),365);break;case"mark_as_todo":plpMainpageCookieHandler.setCookie("plp_public",plpMainpageCookieHandler.markAsToDoInCookie(a),365);break;case"remove":plpMainpageCookieHandler.setCookie("plp_public",plpMainpageCookieHandler.removeFromPlpCookie(a),365)}},readCurrentPlpCookieData:function(){plpMainpageCookieHandler.cookieData.rawCookieString=plpMainpageCookieHandler.getCookie("plp_public"),plpMainpageCookieHandler.cookieData.combinedCookieArray=plpMainpageCookieHandler.cookieData.rawCookieString.split("|"),""!=plpMainpageCookieHandler.cookieData.combinedCookieArray[0]&&(plpMainpageCookieHandler.cookieData.unreadPlpItemsArray=JSON.parse(plpMainpageCookieHandler.cookieData.combinedCookieArray[0])),""!=plpMainpageCookieHandler.cookieData.combinedCookieArray[1]&&(plpMainpageCookieHandler.cookieData.markedAsCompleteArray=JSON.parse(plpMainpageCookieHandler.cookieData.combinedCookieArray[1]))},getCookie:function(e){for(var a=e+"=",o=document.cookie.split(";"),i=0;i<o.length;i++){for(var p=o[i];" "==p.charAt(0);)p=p.substring(1);if(0==p.indexOf(a))return p.substring(a.length,p.length)}return""},setCookie:function(e,a,o){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3);var p="expires="+i.toUTCString();document.cookie=e+"="+a+"; "+p+"; domain=.mindtools.com; path=/"},addItemToCookie:function(e){return-1===plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.indexOf(e)&&0==plpMainpageCookieHandler.maxPlpItemsInCookieReached()&&plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.push(e),plpMainpageCookieHandler.concatenateBothArrays()},maxPlpItemsInCookieReached:function(){return plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.length>plpMainpageCookieHandler.maxNumberOfCookiePlpItems-1||plpMainpageCookieHandler.cookieData.markedAsCompleteArray.length>plpMainpageCookieHandler.maxNumberOfCookiePlpItems-1},concatenateBothArrays:function(){return JSON.stringify(plpMainpageCookieHandler.cookieData.unreadPlpItemsArray)+"|"+JSON.stringify(plpMainpageCookieHandler.cookieData.markedAsCompleteArray)},markAsReadInCookie:function(e){if(-1===plpMainpageCookieHandler.cookieData.markedAsCompleteArray.indexOf(e)){var a=plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.indexOf(e),o=plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.splice(a,1);plpMainpageCookieHandler.cookieData.markedAsCompleteArray.push(o[0])}else{a=plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.indexOf(e);plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.splice(a,1)}return plpMainpageCookieHandler.concatenateBothArrays()},markAsToDoInCookie:function(e){if(-1!==plpMainpageCookieHandler.cookieData.markedAsCompleteArray.indexOf(e)){var a=plpMainpageCookieHandler.cookieData.markedAsCompleteArray.indexOf(e),o=plpMainpageCookieHandler.cookieData.markedAsCompleteArray.splice(a,1);plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.push(o[0])}return plpMainpageCookieHandler.concatenateBothArrays()},removeFromPlpCookie:function(e){if(-1!==plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.indexOf(e)){var a=plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.indexOf(e);plpMainpageCookieHandler.cookieData.unreadPlpItemsArray.splice(a,1)}if(-1!==plpMainpageCookieHandler.cookieData.markedAsCompleteArray.indexOf(e)){a=plpMainpageCookieHandler.cookieData.markedAsCompleteArray.indexOf(e);plpMainpageCookieHandler.cookieData.markedAsCompleteArray.splice(a,1)}return plpMainpageCookieHandler.concatenateBothArrays()}};