function ExecuteInitialSearch(n){currentBufferNumber++;_spPageContextInfo.systemUserKey!=null?(isAnonymous=!1,n==!1&&SetUrlParameters(),ExecuteInitialSearchClient(),ModifyUrlParameters(n)):(isAnonymous=!0,jQ("#MSOZoneCell_WebPartWPQ2").children().removeClass("ms-hide"),n==!1&&SetUrlParameters(),ExecuteInitialSearchServer(),ModifyUrlParameters(n))}function ExecuteBufferSearch(){currentBufferNumber++;isAnonymous==!1?ExecuteInitialSearchClient():ExecuteInitialSearchServer();ModifyUrlParameters(!1)}function ExecuteInitialSearchServer(){var t=window.location.pathname;t=t.toLowerCase();var u=t.substring(t.lastIndexOf("/")+1),i=!1,r=!0,n={};n.mode="server";n.Keyword=Keyword;n.KeywordExact=KeywordExact;n.KeywordAny=KeywordAny;n.KeywordNot=KeywordNot;n.page=u;n.pagenumber=PageIndex-1;n.pagesize=PageSize;n.buffernumber=currentBufferNumber;n.isAnonymous=!0;n.strSortOption=Sort;n.strShowMembershipOnly=Membership;n.strFreeContentOnly=FreeContentOnly;n.strRefinementOption=Refiners;n.strRefinementFilter=RefinementFilters;n.strContentTypeFilter=ContentTypeFilters;n.strResultSources=ResultSource;n.strDateRange=DateRange;n.strAdvDateRange=AdvDateRange;jQ.ajax({type:"POST",url:"/_layouts/15/ECRI.Core/SearchService.svc/ExecuteSearchServer",contentType:"application/json; charset=utf-8;",data:JSON.stringify(n),dataType:"text",success:function(n){var o=jQ.parseJSON(n).ExecuteSearchServerResult,s,h,t,c,l,f,e,u;for(searchParms=jQ.parseJSON(n).parms,searchServerOutput=jQ.parseJSON(n).searchServerOutput,refiners=searchServerOutput.RefinerRows,headerLabel=searchServerOutput.headerLabel,showingResultsLabel=searchServerOutput.showingResultsLabel,filterByLabel=searchServerOutput.filterByLabel,advDateRangeOption=searchServerOutput.advDateRangeOption,mySiteHostUrl=searchServerOutput.mySiteHostUrl,strRefinementOptionUpdated=searchServerOutput.strRefinementOptionUpdated,s=searchServerOutput.countsAllECRI,h=searchServerOutput.countsFreeContent,PageSize!=searchParms.PageSize&&(PageSize=searchParms.PageSize,i=!0),t=jQ("#DateRangeOptions option:selected").val(),t==null&&(t=""),t!=searchParms.DateRangeOption&&(UpdateRefinementFiltersDate(searchParms.DateRangeOption),i=!0),Sort!=searchParms.SortOption&&(Sort=searchParms.SortOption,i=!0),i&&ModifyUrlParameters(!0),debugModeAllowed=!1,searchParms!=null&&searchParms.DebugModeAllowed==!0&&(debugModeAllowed=!0),Refiners!=strRefinementOptionUpdated&&(Refiners=strRefinementOptionUpdated,ModifyUrlParameters(!0)),headerLabel.indexOf("remove-begin-quote")!=-1||Keyword==null||Keyword=="*"||Keyword==""||Keyword.toLowerCase()=="%2a"?jQ(".search-header-term-begin-quote").css("display","none"):jQ(".search-header-term-begin-quote").css("display","inline"),DisplaySearchResultsHeader(headerLabel,showingResultsLabel,filterByLabel,r),c="("+FormatSearchNumber(s)+")",jQ(".search-refiner-options-public-count").html(c),l="("+FormatSearchNumber(h)+")",jQ(".search-refiner-options-free-count").html(l),resultsCount=jQ.parseJSON(n).resultsCount,resultsTotalCountEstimated=jQ.parseJSON(n).resultsTotalCountEstimated,resultsTotalCountRounded=jQ.parseJSON(n).resultsTotalCountRounded,pageCount=Math.ceil(resultsTotalCountEstimated/PageSize),resultsTableAll=o,rowBufferMaxCurrent=resultsCount-1,rowBufferMaxTotal+=resultsCount,f=resultsCount,PageSize0&&(f=searchParms.PromotedRows.length),currentBufferNumber==1&&f>0)for(u=0;u0)){t.length==1&&(resultsTable=t[0]);t.length==2&&(resultsTable=t[0],e=t[1]);t.length==3&&(resultsTable=t[1],e=t[2]);resultsCount=Math.max(f,resultsTable.ResultRows.length);resultsTotalCountEstimated=Math.max(f,resultsTable.TotalRows);resultsTotalCountRounded=Math.max(f,CalculateTotalRows(resultsTable.TotalRows));pageCount=Math.ceil(resultsTotalCountEstimated/PageSize);resultsTableAll=resultsTable.ResultRows;rowBufferMaxCurrent=resultsCount-1;rowBufferMaxTotal+=resultsCount;u=0;resultsTable.ResultRows.length>0&&jQ.each(resultsTable.ResultRows,function(){if(r<_ROWBUFFERINIT_&&!c.hasOwnProperty(this.Path.toLowerCase())){var n={};n.Positon=r;n.IsPromoted=!1;n.THEdate=FormatSearchDate(this.ECRIMasterDate);n.Title=this.Title;n.ItemAccess="Denied";n.IsPostProcessed=!1;n.Path=this.Path;n.ParentLink=this.ParentLink;n.ECRISharing=this.ECRISharing;n.CategoryCode="";n.CategoryName="";n.ComponentName="";n.ComponentAKA="";n.ECRIComponentURL=this.ECRIComponentURL;n.ECRIsearchSummary=this.ECRIsearchSummary;n.ECRIMasterDate=this.ECRIMasterDate;n.ECRIsearchSummaryImage=this.ECRIsearchSummaryImage;h[u]=n;u++;r++}});rowBufferLast+=r-1;var s=[],l=0;t.length>1&&e.ResultRows.length>0&&jQ.each(e.ResultRows,function(){var n={};n.RefinementName=this.RefinementName;n.RefinementToken=this.RefinementToken;n.RefinementKey=this.RefinerName+":"+this.RefinementName;n.DisplayName=this.DisplayName;n.RefinerName=this.RefinerName;n.RefinementCount=this.RefinementCount;this.RefinerName!="ECRIComponentURL"&&(s[l]=n,l++)});o=UpdateFilterByLabelClient(s,searchParms);a=UpdateHeaderLabelClient(searchParms.ShowingResultsLabel);v=UpdateShowingLabelClient(searchParms.ShowingResultsLabel,resultsTotalCountRounded,resultsCount);DisplaySearchResultsHeader(a,v,o,searchParms.isAnonymous);InitResultsPostProcessing(h,s,pageCount,searchParms.isAnonymous,o)}}function onSearchSuccessFull(){var t=null,n,i,r;resultsFull.m_value&&resultsFull.m_value.ResultTables&&(n=resultsFull.m_value.ResultTables,n.length>0&&(n.length==1&&(resultsTable=n[0]),n.length==2&&(resultsTable=n[0],t=n[1]),n.length==3&&(resultsTable=n[1],t=n[2]),i=[],r=0,t!=null&&t.ResultRows.length>0&&jQ.each(t.ResultRows,function(){var n={};n.RefinementName=this.RefinementName;n.RefinementToken=this.RefinementToken;n.RefinementKey=this.RefinerName+":"+this.RefinementName;n.DisplayName=this.DisplayName;n.RefinerName=this.RefinerName;n.RefinementCount=this.RefinementCount;i[r]=n;r++;this.RefinementName=="alerts"&&this.RefinementCount!=null&&(AlertsCounts=this.RefinementCount);this.RefinementName=="alertstracker"&&this.RefinementCount!=null&&(AlertsTrackerCounts=this.RefinementCount)}),DisplaySearchRefiners(i,searchParms.isAnonymous)))}function GetClientSearchQuery(n,t,i){var u=new Microsoft.SharePoint.Client.Search.Query.KeywordQuery(t),e,o,f,s,r;for(u.set_queryText(i.QueryText),e=_ROWBUFFERSIZE_,i!=null&&i.Page=="myecri.aspx"&&(e=_ROWBUFFERSIZE_MYECRI_),i!=null&&i.PageSize>_DEFAULTPAGESIZE_&&(e=i.PageSize),u.set_rowLimit(e),i.Page=="resourcecenter.aspx"&&u.set_rowLimit(i.PageSize),u.set_startRow(i.StartRow),u.set_trimDuplicates(!1),u.set_enableStemming(!0),u.set_enableQueryRules(!1),o=u.get_selectProperties(),r=0;r0)for(r=0;r0)for(r=0;r0)for(u.set_enableSorting(!0),s=u.get_sortList(),r=0;rNo search results are available.<\/label>";advRefinersComplete=!0;advRefinersRequested=!1;jQ("#gvSearchResults").append(c);jQ("#divPagingBottom").css("display","none");RemoveBufferingSpinner();CloseModalBox();return}e=0;currentBufferNumber>1&&(e=(PageIndex-1)*PageSize);o=resultsArray.length-1;rowBufferCurrent=e;cancelBuffering=!1;h=!0;f==!0&&(h=!1);RefreshSearchResults("replace",e,o,h,!1);rowBufferLast=o+1;rowShowMoreNext=o+1;debugModeAllowed&&debugModeEnabled&&(l=GetPagingStats("paging"),jQ("#searchDebugPagingStats").html(l));resultsTotalCountEstimated>PageSize?f==!1?DisplaySearchPaging(t):DisplaySearchShowMore(t):jQ("#divPagingBottom").css("display","none");CloseModalBox();RefinersPostProcessing(resultsCount,n,i,r);f==!1&&i==!0&&jQ("#MSOZoneCell_WebPartWPQ2").css("display","block");UpdateDebug()}function PostProcessingBuffers(){resultsTotalCountEstimated>_ROWBUFFERINIT_&&(ShowBufferingSpinner(),batchesArray=[],batchCount=0,AddPostProcessingBatches(_ROWBUFFERINIT_,PageSize-1,!0),AddPostProcessingBatches(PageSize,rowBufferMaxCurrent,!1),ExecutePostProcessingBatches())}function AddPostProcessingBatches(n,t,i){var u=[],f=0,o=!1,e,s,r;for(resultsTableAll.length<=t&&(t=resultsTableAll.length-1),e=n;e<=t;e++)u[f]=resultsTableAll[e],f++,s=_ROWBUFFERBATCHSIZE_,searchParms!=null&&searchParms.Page=="myecri.org"&&(s=_ROWBUFFERBATCHSIZE_MYECRI_),f==s?(r={},r.ResultsStringify=JSON.stringify(u),r.Display=i,r.IsLastDisplayBuffer=!1,r.Count=u.length,batchesArray[batchCount]=r,batchCount++,u=[],o=!1,f=0):o=!0;o&&(r={},r.ResultsStringify=JSON.stringify(u),r.Display=i,r.IsLastDisplayBuffer=!1,r.Count=u.length,batchesArray[batchCount]=r,batchCount++)}function ExecutePostProcessingBatches(){var t,n,i;if(batchCount==0||cancelBuffering==!0){RemoveBufferingSpinner();return}for(t=0,n=0;nresultsArray.length){RemoveBufferingSpinner();return}(n==null||n==""||n=="replace")&&jQ("#gvSearchResults").html("");var e=!1,f=!1;jQ.get("/_layouts/15/ECRI.Core/Search/ECRISearchResultsVWP.html?rev=4",function(n){for(var s,l,p,o,v,w,b=n,c=t;c<=i;c++)if(s=resultsArray[c],s!=null){if(o=b.replace(new RegExp("{rowNum}","g"),c+1),l=s.THEdate,s.CategoryName!=null&&s.CategoryName!=""&&(l=l+"  -  "+s.ComponentName),o=o.replace("{THEdate}",l),s.IsPromoted){f=!0;o=o.replace("{SearchResultPromotedDisplay}","display:block; margin-left: -1px;");o=o.replace("{SearchResultRegularDisplay}","display:none;");s.ECRIsearchSummaryImage!=""?(o=o.replace("{ECRIsearchSummaryImagePromoted}",s.ECRIsearchSummaryImage),o=o.replace("{ECRIsearchSummaryImageStatusPromoted}","")):o=o.replace("{ECRIsearchSummaryImageStatusPromoted}","display:none;");var o=o.replace(new RegExp("{CategoryNamePromoted}","g"),s.CategoryName),o=o.replace(new RegExp("{TitlePathPromoted}","g"),s.Path),y=s.Title.replace(new RegExp("'s","g"),"’s"),h=y.replace(new RegExp("'","g"),"");if(h.length>=120&&(h=h.substring(0,120)+" ..."),o=o.replace(new RegExp("{TitlePromoted}","g"),h),s.ComponentAKA!=null&&s.ComponentAKA!=""){var o=o.replace("{ResultAKADisplay}","display:inline;"),o=o.replace("{ResultAKAName}",s.ComponentAKA),a=CalcRefinerAKAWidth(s.ComponentAKA);a="width: "+a+";";o=o.replace("{ResultAKAWidth}",a);e=!0}else var o=o.replace("{ResultAKADisplay}","display:none;"),o=o.replace("{ResultAKAName}",""),o=o.replace("{ResultAKAWidth}","");o=o.replace("{ItemAccessPromoted}",s.ItemAccess);o=o.replace("{ECRIsearchSummaryPromoted}",s.ECRIsearchSummary)}else{f&&(p="
<\/div>",jQ(".search-results-container-table").css("margin-bottom","-6px"),jQ("#gvSearchResults").append(p));f=!1;var o=o.replace("{SearchResultRegularDisplay}","display:block;"),o=o.replace("{SearchResultPromotedDisplay}","display:none;"),o=o.replace("{ResultAKADisplay}","display:none;"),o=o.replace("{ResultAKAName}",""),o=o.replace("{ResultAKAWidth}","");o=s.ECRIsearchSummaryImage!=""?o.replace("{ECRIsearchSummaryImage}",s.ECRIsearchSummaryImage):o.replace("{ECRIsearchSummaryImageStatus}","display:none;").replace("{ECRIsearchSummaryImage}","data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=");var o=o.replace(new RegExp("{TitlePath}","g"),s.Path),y=s.Title.replace(new RegExp("'s","g"),"’s"),h=y.replace(new RegExp("'","g"),"");h.length>=120&&(h=h.substring(0,120)+" ...");o=o.replace(new RegExp("{Title}","g"),h);v="";s.ECRISharing!=null&&s.ECRISharing!=""&&(v="SHARING: "+s.ECRISharing);var o=o.replace(new RegExp("{ECRISharing}","g"),v),o=o.replace("{ItemAccess}",s.ItemAccess),o=o.replace("{ECRIsearchSummary}",s.ECRIsearchSummary)}jQ("#gvSearchResults").append(o)}e&&wireAKA();wireSearchResults();u&&RemoveBufferingSpinner();r==!0&&(w=document.getElementById("ctl00_divHeaderContainer2"),w.scrollIntoView(!0))})}function RefinersPostProcessing(n,t){jQ.ajax({type:"POST",url:"/_layouts/15/ECRI.Core/SearchService.svc/PostProcessSearchRefiners",contentType:"application/json; charset=utf-8;",data:'{"refinerList":'+JSON.stringify(t)+',"refinerListAll":'+JSON.stringify(searchParms.RefinersListAll)+"}",dataType:"text",success:function(n){var t=jQ.parseJSON(n).PostProcessSearchRefinersResult;PostProcessingBuffers();LoadSearchAdvanced(t)},error:function(n){CloseModalBox();var t="SearchService Error - PostProcessSearchRefiners : "+n.statusText;LogError(t)}})}function DisplaySearchResultsHeader(n,t,i,r){var u=window.location.pathname;if(u=u.toLowerCase(),u.indexOf("myecri.aspx")!=-1)return!0;jQ(".search-header-term").html(n);jQ(".search-header-showing-results").html(t);r==!1?(u.indexOf("searchresults.aspx")!=-1?jQ("#divSaveThisSearchQuery").css("display","inline"):jQ("#divSaveThisSearchQuery").css("display","none"),jQ("#divSearchRefinerOptionsMember").css("display","block"),jQ("#divSearchRefinerOptionsPublic").css("display","none")):(jQ("#divSaveThisSearchQuery").css("display","none"),jQ("#divSearchRefinerOptionsMember").css("display","none"),jQ("#divSearchRefinerOptionsPublic").css("display","block"));i==""?jQ("#divShowingFilters").css("display","none"):(jQ("#divShowingFilters").css("display","block"),jQ("#divShowingFilters").html(i))}function DisplaySearchResultsFail(n,t){var u=UpdateShowingLabelClient(t,0,0),i,r;DisplaySearchResultsHeader("Search Results",u,"",n);i=window.location.pathname;i=i.toLowerCase();i.indexOf("myecri.aspx")!=-1&&jQ("#searchresultsHeaderDiv").css("display","none");r="