CQ.WCM=CQ.WCM||{}; CQ.WCM.List=CQ.WCM.List||function(){var self={};var currentState=null;var _extractObject=function(queryString){var params=queryString.split("\x26");var paramObj={};for(var idx=0;idx=2)paramObj[paramInfo[0]]=paramInfo[1]}return paramObj};var _combineQueryStrings=function(queryString1,queryString2){var paramObj1=_extractObject(queryString1);var paramObj2=_extractObject(queryString2);for(var param in paramObj2)paramObj1[param]=paramObj2[param]; var combinedQueryString="";for(var param in paramObj1){if(combinedQueryString!="")combinedQueryString+="\x26";combinedQueryString+=param+"\x3d"+paramObj1[param]}return combinedQueryString};self.linkClick=function(element,listId){var goToLink=element.href;var urlRegex=/https?:\/\/[^\\/]*(.*)/gi;var matches=urlRegex.exec(goToLink);var queryString="";if(matches&&matches.length>0){var linkPath=matches[1];var queryIdx=linkPath.indexOf("?");if(queryIdx>=0)queryString=linkPath.substring(queryIdx+1)}var xhr= new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200&&xhr.responseText!=""){var targetList=document.getElementById(listId);if(targetList){if(!window.history.state)window.history.replaceState({listId:listId,content:targetList.outerHTML},null,window.location.href);if(currentState&¤tState.listId!=listId){currentState["extraListId"]=listId;currentState["extraContent"]=targetList.outerHTML;window.history.replaceState(currentState,null,window.location.href)}targetList.outerHTML= xhr.responseText;var newTargetList=document.getElementById(listId);var firstListItem=newTargetList.getElementsByTagName("li")[0];var anchors=firstListItem.getElementsByTagName("a");if(anchors.length===0){firstListItem.setAttribute("tabindex","0");firstListItem.focus()}else anchors[0].focus();var stateContent=xhr.responseText;var currentUrl=window.location.href;var currentQueryString="";var queryIdx=currentUrl.indexOf("?");if(queryIdx>=0){currentQueryString=currentUrl.substring(queryIdx+1);currentUrl= currentUrl.substring(0,queryIdx)}var useQueryString=_combineQueryStrings(currentQueryString,queryString);currentState={listId:listId,content:stateContent};window.history.pushState(currentState,null,currentUrl+"?"+useQueryString)}}};xhr.open("GET",goToLink,true);xhr.send();return false};var _updateList=function(listId,content){var targetList=document.getElementById(listId);if(targetList)targetList.outerHTML=content};self.handlePopStateListNavigation=function(event){if(event.state){_updateList(event.state.listId, event.state.content);if(event.state.extraListId)_updateList(event.state.extraListId,event.state.extraContent)}};self.bindHistoryPopStateEvent=function(){if(window.addEventListener)window.addEventListener("popstate",CQ.WCM.List.handlePopStateListNavigation);else if(window.attachEvent)window.attachEvent("popstate",CQ.WCM.List.handlePopStateListNavigation)};return self}();CQ.WCM.List.bindHistoryPopStateEvent();