function ProductSearchQuery(){this.StatusId=null;this.TypeIds=null;this.Conjugation=0;this.ChannelsExtended=null;this.ExternalID=null;this.Categories=null;this.CrmCategories=null;this.Awards=null;this.Locations=null;this.IsBrochureInStock=null;this.IsInBasket=null;this.HasGeoPosition=null;this.CreatedDate=null;this.AmendedDate=null;this.Keywords=null;this.Name=null;this.MediaTypes=null;this.Estates=null;this.Polygons=null;this.Proximity=null;this.CombinedNameKeyIDs=null;this.Openings=null;this.WidgetID=null;this.Facilities=null;this.FacilityGroups=null;this.MarketLanguages=null;this.Gradings=null;this.CategoryGroups=null;this.SocialMedia=null;this.RelatedToProduct=null;this.Memberships=null;this.MembershipsExtended=null;this.DescriptionLanguages=null;this.Media=null;this.ExternalLinkTypes=null;this.DescriptionAutoTranslateLanguages=null;this.GroupTravel=null;this.BedCount=null;this.RoomCount=null;this.AvailabilityProviders=null}function daysDiff(n,t){return Math.round((t-n)/864e5)}function monthsDiff(n,t){var i;return i=(t.getFullYear()-n.getFullYear())*12,i-=n.getMonth(),i+=t.getMonth(),i<=0?0:i}function LastSearch(){this.Query=new ProductSearchQuery}function getLastSearch(){var t,i;if(!suppressGetLastSearch){if(location.hash===""){suppressGetLastSearch=!0;location.replace("#s");t=function(n,t){this.FilterType=isNaN(n)?1:parseInt(n);this.Options=t instanceof Array?t:null};(SearchContext.Request.Search!=undefined||SearchContext.Request.ProdType!=undefined||SearchContext.Request.InBasket===!0||SearchContext.Request.RelatedToProduct!=undefined)&&(SearchContext.Request.Search!==""&&(queryModel.CombinedNameKeyIDs=SearchContext.Request.Search),SearchContext.Request.ProdType!=undefined&&SearchContext.Request.ProdType!==""&&(queryModel.TypeIds=new t(1,new Array(SearchContext.Request.ProdType))),SearchContext.Request.InBasket===!0&&(queryModel.IsInBasket=!0,queryModel.StatusId=""),SearchContext.Request.RelatedToProduct>0&&(queryModel.RelatedToProduct=SearchContext.Request.RelatedToProduct),searchViewModel.initialiseFromQueryModel(),SearchContext.Request.DisableAutoSearch!==!0&&searchViewModel.runSearch());return}var r=SearchContext.Request.ProdType==="BUSI",u=location.hash.substring(0,3),n=SearchContext.Urls.GetLastSearch+"?isOrganisationSearch="+r;u==="#ss"&&(i=location.hash.substring(4),n=n+"&savedSearchKey="+i);$.ajax({url:n,success:function(n){n!=null&&n!=undefined&&jQuery.trim(n)!=""&&(LoadSearch(n.Query),$("#savedSearchName").val(n.SavedSearchName),$("#savedSearchKey").val(n.SavedSearchKey),n.SavedSearchIsPrivate?setCustomCheckboxChecked($("#savedSearchPrivateCustomCheckbox")):setCustomCheckboxUnchecked($("#savedSearchPrivateCustomCheckbox")),n.SavedSearchKey&&$("#overwriteSavedSearch").show(),n.SavedSearchCanBeOverwritten?(document.getElementById("rdoOverwrite").disabled=!1,document.getElementById("rdoOverwrite").checked=!0):(document.getElementById("rdoOverwrite").disabled=!0,document.getElementById("rdoSaveNew").checked=!0))},error:function(n,t,i){alert("Error: "+t+" "+i)},datatype:"JSON",cache:!1})}}function LoadSearch(n){n!=null&&(queryModel=n);initialisingSearch=!0;searchViewModel.initialiseFromQueryModel();initialisingSearch=!1;RunSearchQuery();searchViewModel.AreFiltersCollapsed(!$(".filters").is(":visible"))}function RunSearchQuery(n,t){if(($("body").trigger("click"),!initialisingSearch)&&(firstLoad||NewMind.Buttons.setButtonStatusSearching(document.getElementById("search-find-button")),currentPage=n==undefined?1:parseInt(n,10),currentPage<1&&(currentPage=1),t==undefined&&(t=pageSize),!(t<15))){if(currentPage>1&&currentPage>Math.ceil(parseInt($("#NumResults").text())/t)){currentPage=Math.ceil(parseInt($("#NumResults").text())/t);return}currentPage!==1?_gaq.push(["_trackEvent","Search (UID: "+SearchContext.CurrentUserKey+")","Get New Page",dumpToString(queryModel),currentPage]):_gaq.push(["_trackEvent","Search (UID: "+SearchContext.CurrentUserKey+")","Initial Search",dumpToString(queryModel)]);var i=queryModel.TypeIds&&queryModel.TypeIds.Options.length===1&&queryModel.TypeIds.Options[0]==="BUSI",r={page:currentPage,pagesize:t,queryAsJson:JSON.stringify(queryModel),isOrganisationSearch:i};firstLoad&&($("#WithResults").show(),$("#WithResults").block({message:'<div style="padding: 10px;"><img src="'+SearchContext.Urls.SpinnerImage+'" /> '+SearchContext.Translations.Loading+"<\/div>",fadeIn:0}),firstLoad=!1);$.ajax({url:SearchContext.Urls.Search,data:JSON.stringify(r),type:"POST",datatype:"JSON",contentType:"application/json",success:function(i){$("#WithResults").unblock();$("#ActionMenu").show();typeof i!="object"&&(window.location=SearchContext.Urls.Login);ApplyConditionalColumns(queryModel);BuildResults(i);setTimeout(function(){NewMind.Buttons.resetButtonStatus(document.getElementById("search-find-button"))},500);var r=i.TotalResults;r<=0||(n>1?($("#PageFirst").removeAttr("disabled"),$("#PageBack").removeAttr("disabled")):($("#PageFirst").attr("disabled","disabled"),$("#PageBack").attr("disabled","disabled")),n==Math.ceil(r/t)?$("#PageForward").attr("disabled","disabled"):$("#PageForward").removeAttr("disabled"),$("table.search-results th.checkboxcell").removeClass("checked"))},error:function(n,t,i){$("#WithResults").unblock();alert("Error: "+t+" "+i);NewMind.Buttons.resetButtonStatus(document.getElementById("search-find-button"))},cache:!1})}}function BuildResults(n){if(lastResultSize=n.TotalResults,lastResultData=n,n.TotalResults<=0){n.TotalResults===0?($("#ActionMenu").show(),SetActionMenuForNoResults(),$("#noResultsText").show(),$("#indexBuildingText").hide()):($("#ActionMenu").hide(),$("#noResultsText").hide(),$("#indexBuildingText").show());$(".NumResults").text("0");$("#NoResults").show();$("#WithResults").hide();$("#Paging").hide();return}var t=n.TotalResults+"";$("#NoResults").hide();$("#WithResults").hide();$("#Paging").hide();$("#results").html($("#resultTemplate").render(n.Results,{editUrl:SearchContext.Urls.EditProduct,viewUrl:SearchContext.Urls.ViewProduct,referer:"&ref=s"}));$(".NumResults").text(t);$(".search-response").show();$("#WithResults").show();$("#ActionMenu").show();SetActionMenuForResults();UpdatePaging(n);$("#Paging").show();n.ExclusivelyBrochures?$("table.search-results").addClass("brochures"):$("table.search-results").removeClass("brochures");n.ShowEarlierLaterOpeningOptions?($("#LaterOpeningPeriod").css("display","block"),$("#EarlierOpeningPeriod").css("display","block")):($("#LaterOpeningPeriod").css("display","none"),$("#EarlierOpeningPeriod").css("display","none"))}function UpdatePaging(n){var i=Math.ceil(n.TotalResults/pageSize),f=function(n){return Clamp(n,1,i)},e=f(currentPage+2),o=f(e-4),r,t;for(e=f(o+4),r=1,t=o;r<=5;){var s=t<=e,h=t==currentPage,u=$("#pagelink-"+r);u.text(t);u[s?"show":"hide"]();u.parent()[h?"addClass":"removeClass"]("active");u[0].setAttribute("data-page-to-link",t);t++;r++}$("#pagelink-first").prop("disabled",currentPage==1);$("#pagelink-first").parent()[currentPage==1?"addClass":"removeClass"]("disabled");$("#pagelink-last").prop("disabled",currentPage==i);$("#pagelink-last").parent()[currentPage==i?"addClass":"removeClass"]("disabled");$("#pagelink-last")[0].setAttribute("data-page-to-link",i)}function Clamp(n,t,i){return n<t?t:n>i?i:n}function ApplyConditionalColumns(n){var t={"multi-product-type-search":!n.TypeIds||!0,"show-opening-date":n.TypeIds&&n.TypeIds.Options.length===1&&n.TypeIds.Options[0]==="EVEN"},r=$("table.search-results");for(var i in t)t.hasOwnProperty(i)&&r[t[i]?"addClass":"removeClass"](i)}function dumpToString(n,t){var r,i;t==undefined&&(t=0);r="";for(i in n)typeof n[i]=="object"?(r+=" ".repeat(t*4)+"["+i+"]\n",r+=dumpToString(n[i],t+1)):r+=" ".repeat(t*4)+i+" - "+n[i]+"\n";return r}function markRowAsApplied(n){n.animate({backgroundColor:"#00587E"},200);n.animate({backgroundColor:"transparent"},200);n.animate({backgroundColor:"#F9F9F9"},200)}function ApplyAction(n,t,i,r){$.ajax({url:n,success:function(n){for(var u=0,f=[],e=0;e<t.length;e++)u=t[e],typeof r=="function"&&r(u),f.indexOf(u)==-1&&f.push(u);f.forEach(function(n){markRowAsApplied($(".row"+n))});typeof i=="function"&&i(n)},error:function(n,t,i){alert("Error: "+t+" "+i)},datatype:"JSON",cache:!1})}function AddToBasket(n,t,i){var r=[];$("#results tr td input:checked").each(function(){r.push($(this).attr("id"))});r.length>0?AddSelectedToBasket(n,t,r):AddAllToBasket(n,i)}function AddAllToBasket(n,t){if(lastResultSize!=0){_gaq.push(["_trackEvent","Search (UID: "+n+" )","Add All To Basket",dumpToString(queryModel)]);var r=t+"?queryAsJson="+encodeURIComponent(JSON.stringify(queryModel)),i=[];$("#results td input").each(function(){i.push($(this).attr("id"))});ApplyAction(r,i,RefreshBasketControl,ShowBasketIcon)}}function AddSelectedToBasket(n,t,i){_gaq.push(["_trackEvent","Search (UID: "+n+")","Add To Basket",i.join(", ")]);var r=t+"?productIds="+encodeURIComponent(JSON.stringify(i));ApplyAction(r,i,RefreshBasketControl,ShowBasketIcon)}function RemoveFromBasket(n,t,i){var r=[];$("#results tr td input:checked").each(function(){r.push($(this).attr("id"))});r.length>0?RemoveSelectedFromBasket(n,t,r):RemoveAllFromBasket(n,i)}function RemoveSelectedFromBasket(n,t,i){_gaq.push(["_trackEvent","Search (UID: "+n+")","Remove From Basket",i.join(", ")]);var r=t+"?productIds="+encodeURIComponent(JSON.stringify(i));ApplyAction(r,i,RefreshBasketControl,HideBasketIcon)}function RemoveAllFromBasket(n,t){if(lastResultSize!=0){_gaq.push(["_trackEvent","Search (UID: "+n+")","Remove All From Basket",dumpToString(queryModel)]);var r=t+"?queryAsJson="+encodeURIComponent(JSON.stringify(queryModel)),i=[];$("#results tr td input").each(function(){i.push($(this).attr("id"))});ApplyAction(r,i,RefreshBasketControl,HideBasketIcon)}}function ShowBasketIcon(n){$(".resBsk"+n).html('<span class="icon basket inbasket"><\/span>');$(".resBsk"+n+" i").hide();$(".resBsk"+n+" i").fadeIn(600)}function HideBasketIcon(n){$(".resBsk"+n).html("");$(".resBsk"+n+" i").hide();$(".resBsk"+n+" i").fadeIn(600)}function LogTelephone(n,t,i,r){if(!$(n).parent().hasClass("disabled")){var u=[];$("#results tr td input:checked").each(function(){u.push($(this).attr("id"))});u.length>0?LogTelephoneSelected(t,i,u):LogTelephoneAll(t,r)}}function LogTelephoneSelected(n,t,i){_gaq.push(["_trackEvent","Search (UID: "+n+")","Register Telephone Provider Event (selected)",i.join(", ")]);var r=t+"?productIds="+encodeURIComponent(JSON.stringify(i));ApplyAction(r,i,alert)}function LogTelephoneAll(n,t){if(lastResultSize!=0){_gaq.push(["_trackEvent","Search (UID: "+n+")","Register Telephone Provider Event (all)",dumpToString(queryModel)]);var r=t+"?queryAsJson="+encodeURIComponent(JSON.stringify(queryModel)),i=[];$("#results tr td input").each(function(){i.push($(this).attr("id"))});ApplyAction(r,i,alert)}}function ApplyBatchAction(n,t,i,r,u,f){var e,o,s,h;if(!$(n).parent().hasClass("disabled"))if(typeof r=="undefined"&&(r=400),typeof u=="undefined"&&(u=320),e=[],$("#results tr td input:checked").each(function(){e.push($(this).attr("id"))}),o=[],queryModel.Memberships!=null&&NewMind.Array.forEach(queryModel.Memberships.Options,function(n){if(n.Key.indexOf("SCHE")>=0){var t=n.Key.split("-");o.push(parseInt(t[1]))}}),e.length>0)_gaq.push(["_trackEvent","Search (UID: "+t+")",i+" (selected)",e.join(", ")]),s=(queryModel.TypeIds||{Options:[]}).Options.reduce(function(n,t){return n.concat(t)},[]),showIframe(this,SearchContext.Translations[i],"/App/Search/ApplyBatchActionSelected?productKeys="+encodeURIComponent(JSON.stringify(e))+"&batchAction="+i+"&productTypeIdsJson="+JSON.stringify(s)+"&membershipSchemeKeys="+encodeURIComponent(JSON.stringify(o)),r,u,!1,null,null,f);else{if(lastResultSize==0)return;h=[];$("#results tr td input").each(function(){h.push($(this).attr("id"))});_gaq.push(["_trackEvent","Search (UID: "+t+")",i+" (all)",dumpToString(queryModel)]);showIframe(this,SearchContext.Translations[i],"/App/Search/ApplyBatchActionAll?queryAsJson="+encodeURIComponent(JSON.stringify(queryModel))+"&batchAction="+i+"&membershipSchemeKeys="+encodeURIComponent(JSON.stringify(o)),r,u,!1,null,null,f)}}function SetBatchActionItemsCountText(n,t){var i,r,f,u,e;n!==null&&n.currentTarget!==null&&(i=$("#results tr td input:checked").length,r=$(n.currentTarget).closest("div.actionmenu"),i>0?(r.find("#all-results-text").hide(),r.find("#selected-items-text").text(i+" "+SearchContext.Translations.SelectedItems)):(r.find("#all-results-text").show(),r.find("#selected-items-text").text("")),f=parseInt($("#NumResults").text(),10)>0,u=2e3,f&&(e=i>0&&i<=u||parseInt($("#NumResults").text(),10)<=u,!e||t?$("li.expensive-batch-action").addClass("disabled"):$("li.expensive-batch-action").removeClass("disabled")))}function SetActionMenuForNoResults(){$("li.batch-action").addClass("disabled")}function SetActionMenuForResults(){$("li.batch-action").removeClass("disabled")}function applyChosen(n,t){if($.fn.chosen)return t=t||document.body,n=n||".auto-apply-chosen select",$(n,t).chosen({disable_search_threshold:8,search_contains:!0,width:"100%",allow_single_deselect:!0})}function destroyChosen(n,t){if($.fn.chosen)return t=t||document.body,n=n||".auto-apply-chosen select",$(n,t).chosen("destroy")}function RefreshBasketControl(){LoadBasketControl()}function LoadBasketControl(){document.getElementById("basketPlaceholder")!=null&&$.ajax({url:"/App/Info/BasketControl",method:"POST"}).done(function(n){document.getElementById("basketPlaceholder").innerHTML=n;NewMind.Dms.bindBasket()})}function ClearBasket(n){$.ajax({url:"/App/Info/Clear"+n+"Basket",method:"POST"}).done(LoadBasketControl)}function ClearProductBasket(){ClearBasket("Product")}function ClearOrganisationBasket(){ClearBasket("Organisation")}function centerModal(){var n,t,i;$(this).css("display","block");n=$(this).find(".modal-dialog");window.parent!=window?(positionElementBasedOnScrollPosition(n),t=n.height()+2*(parseInt(n.css("top").replace("px",""),10)+30),resizeIframeToFitContent(window.frameElement,t),setTimeout(function(){n.off("transitionend")},350)):(i=($(window).height()-n.height())/2,n.css("top",i))}function wireUpDatePickers(){typeof setUserCulture=="function"&&setUserCulture();wireUpDatePickersForSelector($("input.auto-date-picker:visible").not(".k-input"))}function wireUpDatePickersForSelector(n){n.kendoDatePicker({format:kendo.culture().calendar.patterns.d});n.each(function(){var n=$(this),t=n.data("kendoDatePicker");n.data("nm-date-picker",{value:function(n){return t.value(n)},enable:function(n){return t.enable(n)}});n.on("focus",function(){t.open()});n.on("blur",function(){t.close()})})}function getLocaleTime(n,t){return["en-gb","utc"].indexOf((t||"").toLowerCase())!==-1?n.toLocaleTimeString(t,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):n.toLocaleTimeString(undefined,{hour12:!0})}function getLocaleForDate(n){var t=(n.data("override-us-with-gb")||"").toLowerCase()==="true";return t&&navigator.language==="en-US"?"en-GB":navigator.language}function resolveDates(){$(".format-date.unresolved").each(function(){var i=$(this),r=getLocaleForDate(i),n=new Date(parseInt(i.text(),10)),u,t;isNaN(n)||(u=new Date,t="",n.getFullYear()==u.getFullYear()&&n.getMonth()==u.getMonth()&&n.getDate()==u.getDate()?n.toLocaleTimeString?(t=getLocaleTime(n,r),n.toTimeString&&i.prop("title",n.toTimeString())):t=NewMind.CommonTranslations.Today:n.toLocaleDateString?(t=n.toLocaleDateString(r),n.toLocaleDateString&&n.toTimeString&&i.prop("title",n.toLocaleDateString(r)+" "+n.toTimeString(r))):t=n.getFullYear()+"-"+n.getMonth()+"-"+n.getDate(),i.text(typeof t.toLowerCase()=="string"?t.toUpperCase():""),i.removeClass("unresolved"))});$(".format-datetime.unresolved").each(function(){var t=$(this),u=t.hasClass("date-only"),r=getLocaleForDate(t),n=new Date(parseInt(t.text(),10)),i;isNaN(n)||(i="",i=n.toLocaleDateString&&n.toTimeString?n.toLocaleDateString(r)+(u?"":" "+n.toTimeString(r)):n.getFullYear()+"-"+n.getMonth()+"-"+n.getDate(),t.text(i),t.removeClass("unresolved"))})}function formUnloadPrompt(n,t,i){var r="input:visible, textarea:visible",f,e,u;i&&(r=i);f=$(n).find(r).serialize();u=!1;$(n).submit(function(){u=!0});window.onbeforeunload=function(){if(!u)return e=$(n).find(r).serialize(),f!=e?t:void 0}}function resizePmsIframeToFitContent(n){resizeIframeToFitContent(n,350)}function resizeIframeToFitContent(n,t){var i,r;t=t||20;n&&n.contentWindow&&(i=n.contentWindow.document.querySelectorAll(".full-page-height")[0],i===undefined&&(i=n.contentWindow.document.getElementById("page")),i===null&&(i=n.contentWindow.document.getElementById("pagecontainer")),i===null&&$(n).height(20),r=function(){var r,u,f;try{r=0;try{r=$(n.contentWindow.document).height()}catch(e){return}$pageContainer=$(i);$pageContainer.length===1&&(u=parseInt($pageContainer.css("height").replace("px",""),10),u>0&&(r=u));f=Math.max(r,t);n.contentWindow.$&&n.contentWindow.$("html").css("overflow-y","hidden");n.style.height=f+"px"}catch(e){}},setTimeout(r,50),setTimeout(r,100),setTimeout(r,250))}function resizeIframeToFitContentWidth(n){if(n&&n.contentWindow&&n.contentWindow.$){var t=n.contentWindow.document.body;n.contentWindow.$("html").css("overflow-x","hidden");n.style.width=t.offsetWidth+"px"}}function jqGridBuildPaging(n,t){$(n).addClass("text-center");$(n).html('\t\t\t<ul class="pagination">\t\t\t\t<li><a href="#" class="pagelink-first" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-1" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-2" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-3" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-4" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-5" onclick="return false;"><\/a><\/li>\t\t\t\t<li><a href="#" class="pagelink-last" onclick="return false;"><\/a><\/li>\t\t\t<\/ul>\t\t');$("a",n).click(function(){t.trigger("reloadGrid",[{page:this.getAttribute("data-page-to-link")}]);jqGridUpdatePaging(n,t)});jqGridUpdatePaging(n,t)}function jqGridUpdatePaging(n,t){function c(n,t,i){return n<t?t:n>i?i:n}var i=parseInt(t.getGridParam("page"),10),u=parseInt(t.getGridParam("lastpage"),10),o=function(n){return c(n,1,u)},s=o(i+2),h=o(s-4),f,r;for(s=o(h+4),f=1,r=h;f<=5;){var l=r<=s,a=r==i,e=$(".pagelink-"+f,n);e.text(r);e[l?"show":"hide"]();e.parent()[a?"addClass":"removeClass"]("active");e[0].setAttribute("data-page-to-link",r);r++;f++}$(".pagelink-first",n).prop("disabled",i==1);$(".pagelink-first",n).parent()[i==1?"addClass":"removeClass"]("disabled");$(".pagelink-first",n)[0].setAttribute("data-page-to-link",1);$(".pagelink-first",n).text(NewMind.CommonTranslations.First);$(".pagelink-last",n).prop("disabled",i==u);$(".pagelink-last",n).parent()[i==u?"addClass":"removeClass"]("disabled");$(".pagelink-last",n)[0].setAttribute("data-page-to-link",u);$(".pagelink-last",n).text(NewMind.CommonTranslations.Last)}function mergeActionMenus(){var o=$("#pms-main-action-menu"),u=o.find("ul:first"),t=$(),f,i,n,r,e;if(typeof product!="undefined")if(f=$(".pmsDetails"),f.css("display")=="block")t=f;else for(i=document.querySelectorAll(".ajax__tab_panel"),n=0;n<i.length;n++)i[n].style.visibility=="visible"&&(t=$(i[n]));var s=t.find(".mergable-action-menu"),h=t.find("iframe").contents().find(".mergable-action-menu"),c=$(".has-mergable-action-menu").find("iframe").contents().find(".mergable-action-menu");o.find(".tab-specific").remove();r=function(n,t){var e=$(t),r=e.find("a"),f=$(document.createElement("li")),i=$(document.createElement("a"));i.text(r.text());i.attr("href","#");i.attr("style",r.attr("style"));i.attr("class",r.attr("class"));f.attr("style",e.attr("style"));f.attr("class",e.attr("class")).addClass("tab-specific");i.click(function(n){r[0].click();n.preventDefault()});f.append(i);u.prepend(f)};e=$('<li role="presentation" class="divider tab-specific"><\/li>');u.prepend(e);$(s.find("li").get().reverse()).each(r);$(h.find("li").get().reverse()).each(r);$(c.find("li").get().reverse()).each(r);u.children(".tab-specific").filter(function(){return $(this).css("display")!="none"}).length<=1&&e.hide()}function ScrollTo(n){$("html, body").animate({scrollTop:Math.max(n.offset().top-200,0)})}function showCheckboxes(){$(".checkboxcell").removeClass("hidden")}function hideCheckboxes(){$(".checkboxcell").addClass("hidden")}function initDynamicCheckboxes(n){var t,i,r;$(".checkboxcell").each(function(){$(this).attr("tabindex",0)});$(".checkboxcell").unbind("keydown");$(".checkboxcell").keydown(function(n){if(n.which==13)return toggleCustomCheckbox($(this)),!1});t=n?$(".checkboxcell:not(.checked) input[type=checkbox]:checked",$(n)):$(".checkboxcell:not(.checked) input[type=checkbox]:checked");t.closest(".checkboxcell").addClass("checked");t=n?$(".checkboxcell.checked input[type=checkbox]:not(:checked)",$(n)):$(".checkboxcell.checked input[type=checkbox]:not(:checked)");t.closest(".checkboxcell").removeClass("checked");i=n?$(".checkboxcell:not(.disabled) input[type=checkbox]:disabled",$(n)):$(".checkboxcell:not(.disabled) input[type=checkbox]:disabled");i.closest(".checkboxcell").addClass("disabled");r=n?$(".checkboxcell.disabled input[type=checkbox]:not(:disabled)",$(n)):$(".checkboxcell.disabled input[type=checkbox]:not(:disabled)");r.closest(".checkboxcell").removeClass("disabled")}function initGrid(n){combineJQGridTables(n);setupTableCheckboxes(n);fixTableCssClasses(n)}function combineJQGridTables(n){var t=$(n).find("table.ui-jqgrid-htable")[0],i=$(n).find("table.ui-jqgrid-btable")[0];$(i).append($(t).children("thead"));$(t).remove()}function setupTableCheckboxes(n){$(n).find("input[type=checkbox]").each(function(){$(this).closest("th, td").addClass("checkboxcell")});initDynamicCheckboxes(n)}function fixTableCssClasses(n){$(n).find("table:not(.ui-pg-table)").addClass("table table-hover");$(n).children(".ui-widget").removeClass("ui-widget")}function cellClick(){toggleCustomCheckbox($(this));$(this).hasClass("checked")||setCustomCheckboxUnchecked($("th.checkboxcell",$(this).closest("table")))}function headerRowCellClicked(){toggleCustomCheckbox($(this));var n=$(this).closest("table");n.hasClass("ui-jqgrid-htable")&&(n=n.closest(".ui-jqgrid-view").find(".ui-jqgrid-bdiv"));$(this).hasClass("checked")?setCustomCheckboxChecked($(".checkboxcell:not(.disabled)")):setCustomCheckboxUnchecked($(".checkboxcell:not(.disabled)",n))}function setCustomCheckboxChecked(n){n.addClass("checked");$("input[type=checkbox]:not(:disabled)",n).prop("checked",!0)}function setCustomCheckboxUnchecked(n){n.removeClass("checked");$("input[type=checkbox]:not(:disabled)",n).prop("checked",!1)}function toggleCustomCheckbox(n){if(!n.hasClass("disabled")&&!(n.find("input[type=checkbox]:disabled").length>=1)){n.toggleClass("checked");var t=$("input[type=checkbox]",n).prop("checked",n.hasClass("checked"));t.triggerHandler("click");t.triggerHandler("change")}}function supportsDatabinding(){var n=document.createElement("xml"),t;return document.body.appendChild(n),t=!!n.XMLDocument,document.body.removeChild(n),t}function showDatabindingWarningIfUnsupported(n){var i,t,r,u;supportsDatabinding()||(n<10?setTimeout(function(){showDatabindingWarningIfUnsupported(n+1)},100):(i=document.createElement("div"),i.className="full-screen-warning",t=document.createElement("div"),t.className="box",r=document.createElement("h1"),$(r).text(NewMind.CommonTranslations.UnsupportedBrowserTitle),u=document.createElement("div"),$(u).text(NewMind.CommonTranslations.UnsupportedBrowserDatabindingText),t.appendChild(r),t.appendChild(u),i.appendChild(t),document.body.appendChild(i)))}var SearchContext,suppressGetLastSearch,queryModel,_gaq,MD5,Simpleview,NewMind,__oldDoPostBack;jQuery.expr[":"].icontains=jQuery.expr.createPseudo(function(n){return function(t){var i=t.textContent||t.innerText||"";return i.toUpperCase().indexOf(n.toUpperCase())>=0}});jQuery.expr[":"].iequals=jQuery.expr.createPseudo(function(n){return function(t){var i=t.textContent||t.innerText||"";return i.toUpperCase()==n.toUpperCase()}}),function(n){var t=n.fn.find;n.fn.find=function(){try{document===document}catch(n){document=window.document}return t.apply(this,arguments)}}(jQuery);suppressGetLastSearch=!1;queryModel=new ProductSearchQuery;var numFormat=function(n){return Number(n)===n&&n%1!=0?parseFloat(n).toFixed(5):n},dateFormat=function(n){if(n===undefined||n===null)return n;n=n.replace(/[^0-9 +]/g,"");var t=new Date(parseInt(n));return kendo.toString(t,kendo.culture().calendar.patterns.d)},isEmptyOrWhiteSpace=function(n){return!n||!jQuery.trim(String(n))},isIntegerValid=function(n,t,i){var r=Number(n);return r>=t&&r<=i&&/[0-9]+/.test(n)},isLatitudeValid=function(n){var t=Number(n);return t==n&&t>=-90&&t<=90},isLongitudeValid=function(n){var t=Number(n);return t==n&&t>=-180&&t<=180},attachKOfunctions=function(n){var t=function(n,t){var i=NewMind.Array.filter(n,function(n){return n.Key==t});if(i.length>0)return i[0].Value},o=function(n,t,i,r){var f=[],u=NewMind.Array.filter(n,function(n){return NewMind.Array.indexOf(t,n.Item1)>-1});return u.length>0?r?u.length===1?u[0].Item2:u.length+" "+i:(NewMind.Array.forEach(u,function(n){f.push(n.Item2)}),f.join("\n")):""},s=function(n,t,i,r){var f=[],u=NewMind.Array.filter(n,function(n){return NewMind.Array.indexOf(t,n.Key)>-1});return u.length>0?r?u.length===1?u[0].Value:u.length+" "+i:(NewMind.Array.forEach(u,function(n){f.push(n.Value)}),f.join("\n")):""},r=function(n){var i=this;this.FilterId=n.Id;this.OptionsKey=n.MultiOptions;this.OptionsType=n.OptionsThree;this.OptionsIsType=n.OptionsTwo;this.SelectedOptionKey=ko.observable();this.SelectedOptionKey.Summary=function(){var t="",n;return typeof i.OptionsKey!="undefined"&&i.OptionsKey!==null&&(n=NewMind.Array.filter(i.OptionsKey,function(n){return n.Item1==i.SelectedOptionKey()}),n.length>0&&n[0].Item1!==0&&(t=n[0].Item2)),t};this.SelectedOptionType=ko.observable();this.SelectedOptionType.Summary=function(){return typeof i.OptionsType!="undefined"&&i.OptionsType!==null?t(i.OptionsType,i.SelectedOptionType()):""};this.SelectedOptionIsType=ko.observable();this.SelectedOptionIsType.Summary=function(){return typeof i.OptionsIsType!="undefined"&&i.OptionsIsType!==null?t(i.OptionsIsType,i.SelectedOptionIsType()):""};this.TypeVisible=ko.computed(function(){return i.OptionsType!==null});this.IsTypeVisible=ko.computed(function(){return i.OptionsIsType!==null});this.Summary=ko.computed(function(){return i.SelectedOptionKey.Summary()!==""?(i.SelectedOptionKey.Summary()+", "+i.SelectedOptionIsType.Summary()+", "+i.SelectedOptionType.Summary()).replace(/,\s*$/,""):""})},u=function(n){var i=this;this.FilterId=n.Id;this.OptionsKey=n.MultiOptions;this.OptionsListingLevels=n.OptionsThree;this.OptionsIsKey=n.OptionsTwo;this.OptionsDoNotIndex=n.OptionsFour;this.SelectedOptionKey=ko.observable();this.SelectedOptionKey.Summary=function(){var t="",n;return typeof i.OptionsKey!="undefined"&&i.OptionsKey!==null&&(n=NewMind.Array.filter(i.OptionsKey,function(n){return n.Item1==i.SelectedOptionKey()}),n.length>0&&n[0].Item1!==0&&(t=n[0].Item2)),t};this.SelectedListingLevel=ko.observable();this.SelectedListingLevel.Summary=function(){return typeof i.OptionsListingLevels!="undefined"&&i.OptionsListingLevels!==null?t(i.OptionsListingLevels,i.SelectedListingLevel()):""};this.SelectedIsKey=ko.observable();this.SelectedIsKey.Summary=function(){return typeof i.OptionsIsKey!="undefined"&&i.OptionsIsKey!==null?t(i.OptionsIsKey,i.SelectedIsKey()):""};this.SelectedDoNotIndex=ko.observable();this.SelectedDoNotIndex.Summary=function(){return typeof i.OptionsDoNotIndex!="undefined"&&i.OptionsDoNotIndex!==null?t(i.OptionsDoNotIndex,i.SelectedDoNotIndex()):""};this.ListingLevelVisible=ko.computed(function(){return i.OptionsListingLevels!==null});this.IsKeyVisible=ko.computed(function(){return i.OptionsIsKey!==null});this.IsDoNotIndexVisible=ko.computed(function(){var n=NewMind.Array.filter(i.OptionsKey,function(n){return n.Item1==i.SelectedOptionKey()}),t=!1;return n.length>0&&n[0].Item3==="1"&&(t=!0),i.OptionsDoNotIndex!==null&&t});this.Summary=ko.computed(function(){return i.SelectedOptionKey.Summary()!==""?(i.SelectedOptionKey.Summary()+", "+i.SelectedListingLevel.Summary()+", "+i.SelectedIsKey.Summary()+", "+i.SelectedDoNotIndex.Summary()).replace(/,\s*$/,""):""})},f=function(n){var i=this;this.FilterId=n.Id;this.OptionsKey=n.MultiOptions;this.OptionsPaymentStatus=n.OptionsTwo;this.OptionsSaleStatus=n.OptionsThree;this.OptionsSaleType=n.OptionsFour;this.OptionsPaymentMethod=n.OptionsFive;this.OptionsScheme=n.OptionsSix;this.SelectedOptionKey=ko.observable();this.SelectedOptionKey.Summary=function(){var t="",n;return typeof i.OptionsKey!="undefined"&&i.OptionsKey!==null&&i.SelectedOptionKey()!=="0"&&(n=NewMind.Array.filter(i.OptionsKey,function(n){return n.Item1==i.SelectedOptionKey()}),n.length>0&&n[0].Item1!==0&&(t=n[0].Item2)),t};this.SelectedPaymentStatus=ko.observable();this.SelectedPaymentStatus.Summary=function(){return typeof i.OptionsPaymentStatus!="undefined"&&i.OptionsPaymentStatus!==null?t(i.OptionsPaymentStatus,i.SelectedPaymentStatus()):""};this.SelectedSaleStatus=ko.observable();this.SelectedSaleStatus.Summary=function(){return typeof i.OptionsSaleStatus!="undefined"&&i.OptionsSaleStatus!==null?t(i.OptionsSaleStatus,i.SelectedSaleStatus()):""};this.SelectedSaleType=ko.observable();this.SelectedSaleType.Summary=function(){return typeof i.OptionsSaleType!="undefined"&&i.OptionsSaleType!==null?t(i.OptionsSaleType,i.SelectedSaleType()):""};this.SelectedPaymentMethod=ko.observable();this.SelectedPaymentMethod.Summary=function(){return typeof i.OptionsPaymentMethod!="undefined"&&i.OptionsPaymentMethod!==null?t(i.OptionsPaymentMethod,i.SelectedPaymentMethod()):""};this.SelectedScheme=ko.observable();this.SelectedScheme.Summary=function(){return typeof i.OptionsScheme!="undefined"&&i.OptionsScheme!==null?t(i.OptionsScheme,i.SelectedScheme()):""};this.filterByScheme=function(t){var i=ko.utils.arrayFilter(n.MultiOptions,function(n){return n.Item3===t});return NewMind.Array.map(i,function(n){return JSON.parse(JSON.stringify(n))})};this.SchemesWithMemberships=function(){var t=[];return NewMind.Array.forEach(n.OptionsSix,function(n){t.push({Key:n.Key,Value:n.Value,Memberships:i.filterByScheme(n.Key)})}),t}();this.OptionsKeyFiltered=ko.computed(function(){var t=i.SelectedScheme();return typeof t=="undefined"||t==="0"?n.MultiOptions:i.filterByScheme(t)});this.Summary=ko.computed(function(){return i.SelectedOptionKey.Summary()!==""?(i.SelectedOptionKey.Summary()+", "+i.SelectedPaymentStatus.Summary()+", "+i.SelectedSaleStatus.Summary()+", "+i.SelectedSaleType.Summary()+", "+i.SelectedPaymentMethod.Summary()).replace(/,\s*$/,""):""})},h=function(n){var t=this;t.Key=n.Key;t.Value=n.Value},e=function(n){var i=this,a,c,l;this.Filter=n;this.FilterOptions=new ko.observableArray;NewMind.Array.forEach(n.Options,function(n){i.FilterOptions.push(new h(n))});n.Exclusions!=null&&(a=new e(n.Exclusions),this.Exclusions=ko.observable(a));this.addOptionClass=function(){return};n.Id==="ChannelsExtended"||n.Id==="ChannelsExtendedExclusions"||n.Id==="MembershipsExtended"||n.Id==="MembershipsExtendedExclusions"?(this.OptionsName=ko.observable(n.Id),this.SelectedOption=ko.observable(i.FilterOptions()[0].Key),(n.Id==="ChannelsExtended"||n.Id==="ChannelsExtendedExclusions")&&(this.addOptionClass=function(n){n.value==="-1"&&n.classList.add("websiteChannels")})):this.SelectedOption=ko.observable();this.MultiOptionsHasCompositeKey=n.MultiOptionsHasCompositeKey;this.SelectedOption.Summary=function(){if(typeof i.Filter.Options!="undefined"&&i.Filter.Options!==null)return t(i.Filter.Options,i.SelectedOption())};this.SelectedOptionTwo=this.Filter.OptionsTwoDefaultValue!=null?ko.observable(this.Filter.OptionsTwoDefaultValue):ko.observable();this.SelectedOptionTwo.Summary=function(){if(typeof i.Filter.OptionsTwo!="undefined"&&i.Filter.OptionsTwo!==null)return t(i.Filter.OptionsTwo,i.SelectedOptionTwo())};this.SelectedOptionThree=this.Filter.OptionsThreeDefaultValue!=null?ko.observable(this.Filter.OptionsThreeDefaultValue):ko.observable();this.SelectedOptionThree.Summary=function(){if(typeof i.Filter.OptionsThree!="undefined"&&i.Filter.OptionsThree!==null)return t(i.Filter.OptionsThree,i.SelectedOptionThree())};this.SelectedOptionFour=this.Filter.OptionsFourDefaultValue!=null?ko.observable(this.Filter.OptionsFourDefaultValue):ko.observable();this.DateFrom=ko.observable();this.DateFrom.HasValue=ko.computed(function(){return!isEmptyOrWhiteSpace(i.DateFrom())},this);this.DateFrom.IsValid=ko.computed(function(){return!i.DateFrom.HasValue()||kendo.parseDate(i.DateFrom())!=null},this);this.DateTo=ko.observable();this.DateTo.HasValue=ko.computed(function(){return!isEmptyOrWhiteSpace(i.DateTo())},this);this.DateTo.IsValid=ko.computed(function(){return!i.DateTo.HasValue()||kendo.parseDate(i.DateTo())!=null},this);this.RelativeDatesSelected=ko.observable("false");this.TextBoxValue=this.Filter.TextBoxDefaultValue!=null?ko.observable(this.Filter.TextBoxDefaultValue):ko.observable();c=1;l=2e7;this.MinimumValue=ko.observable();this.MinimumValue.HasValue=ko.computed(function(){return!isEmptyOrWhiteSpace(i.MinimumValue())},this);this.MinimumValue.IsValid=ko.computed(function(){return!i.MinimumValue.HasValue()||isIntegerValid(i.MinimumValue(),c,l)},this);this.MaximumValue=ko.observable();this.MaximumValue.HasValue=ko.computed(function(){return!isEmptyOrWhiteSpace(i.MaximumValue())},this);this.MaximumValue.IsValid=ko.computed(function(){return!i.MaximumValue.HasValue()||isIntegerValid(i.MaximumValue(),c,l)},this);this.TextBoxValue.HasValue=ko.computed(function(){return!isEmptyOrWhiteSpace(i.TextBoxValue())},this);this.TextBoxValue.IsValid=ko.computed(function(){if(i.Filter.Id==="Openings"){if(i.RelativeDatesSelected()==="false")return!0;return i.TextBoxValue.HasValue()&&/^[0-9]*$/.test(i.TextBoxValue())}return i.Filter.Id==="Media"?i.TextBoxValue.HasValue()&&!isNaN(i.TextBoxValue()):!0},this);this.TextBoxValueTwo=ko.observable();this.TextBoxValueThree=ko.observable();this.IsPostcodeProximitySelected=ko.computed(function(){return this.SelectedOptionTwo()==="POSTCODE"},this);this.IsMapProximitySelected=ko.computed(function(){return this.SelectedOptionTwo()==="MAPPOINT"},this);this.IsLatLongProximitySelected=ko.computed(function(){return this.SelectedOptionTwo()==="LATLONG"},this);this.IsLatLongProximityValid=ko.computed(function(){return isEmptyOrWhiteSpace(i.TextBoxValueTwo())&&isEmptyOrWhiteSpace(i.TextBoxValueThree())||!isEmptyOrWhiteSpace(i.TextBoxValueTwo())&&!isEmptyOrWhiteSpace(i.TextBoxValueThree())&&isLatitudeValid(i.TextBoxValueTwo())&&isLongitudeValid(i.TextBoxValueThree())},this);this.SelectedOptions=ko.observableArray();this.SelectedOptions.Summary=function(n){n=n||{};var t=n.short||!1;return typeof i.Filter.MultiOptions!="undefined"&&i.Filter.MultiOptions!==null?o(i.Filter.MultiOptions,i.SelectedOptions(),i.Filter.Name,t):typeof i.Filter.Options!="undefined"&&i.Filter.Options!==null?s(i.Filter.Options,i.SelectedOptions(),i.Filter.Name,t):""};this.CompositeSelectedOptions=ko.observableArray([ko.observable(new r(this.Filter))]);this.CompositeSelectedOptions.Summary=function(n){var e,u,t,r,f;if(n=n||{},e=n.short||!1,typeof i.CompositeSelectedOptions()!="undefined"&&(u=i.CompositeSelectedOptions(),u.length>0)){for(t=[],r=0;r<u.length;r++)f=i.CompositeSelectedOptions()[r]().Summary(),f!==""&&t.push(f);if(i.SelectedOption()!=="4"&&t.length>0)return e?t.length===1?t[0]:t.length+" "+i.Filter.Name:t.join(";\n")+";"}return""};this.MembershipCompositeSelectedOptions=ko.observableArray([ko.observable(new f(this.Filter))]);this.MembershipCompositeSelectedOptions.Summary=function(n){var e,u,t,r,f;if(n=n||{},e=n.short||!1,typeof i.MembershipCompositeSelectedOptions()!="undefined"&&(u=i.MembershipCompositeSelectedOptions(),u.length>0)){for(t=[],r=0;r<u.length;r++)f=i.MembershipCompositeSelectedOptions()[r]().Summary(),f!==""&&t.push(f);if(t.length>0)return e?t.length===1?t[0]:t.length+" "+i.Filter.Name:t.join(";\n")+";"}return""};this.ChannelCompositeSelectedOptions=ko.observableArray([ko.observable(new u(this.Filter))]);this.ChannelCompositeSelectedOptions.Summary=function(n){var e,u,t,r,f;if(n=n||{},e=n.short||!1,typeof i.ChannelCompositeSelectedOptions()!="undefined"&&(u=i.ChannelCompositeSelectedOptions(),u.length>0)){for(t=[],r=0;r<u.length;r++)f=i.ChannelCompositeSelectedOptions()[r]().Summary(),f!==""&&t.push(f);if(t.length>0)return e?t.length===1?t[0]:t.length+" "+i.Filter.Name:t.join(";\n")+";"}return""};this.updateDateRanges=function(){var n=new Date,f,u,r,t;i.SelectedOptionTwo()==="0"?n=new Date:i.SelectedOptionTwo()==="1"?n=n.addDays(1):i.SelectedOptionTwo()==="2"?(f=(8-n.getDay())%7,n=n.addDays(f)):i.SelectedOptionTwo()==="3"&&(u=new Date,u.setMonth(n.getMonth()+1),n=new Date(u.getFullYear(),u.getMonth(),1));i.DateFrom(kendo.toString(n,kendo.culture().calendar.patterns.d));r=i.TextBoxValue();t=n;r!==undefined&&r!==""&&(i.SelectedOptionFour()==="0"?t=t.addDays(parseInt(r)):i.SelectedOptionFour()==="1"?t=t.addDays(parseInt(r)*7):i.SelectedOptionFour()==="2"&&t.setMonth(t.getMonth()+parseInt(r)));i.DateTo(kendo.toString(t,kendo.culture().calendar.patterns.d))};this.updateDateTo=function(){isEmptyOrWhiteSpace(i.DateTo())&&i.DateTo(i.DateTo())};this.updateRelativeDates=function(n){firstLoad||i.RelativeDatesSelected(n)};this.addChannelMultiSelectOption=function(){var n=!1,r=[],t;(NewMind.Array.forEach(i.ChannelCompositeSelectedOptions(),function(t){var u=t(),i=t().SelectedOptionKey();i==="0"?n=!0:r.push(i)}),n)||(t=new u(i.Filter),i.ChannelCompositeSelectedOptions.push(ko.observable(t)),destroyChosen("select",".filterContainer"),applyChosen("select",".filterContainer"))};this.addMembershipMultiSelectOption=function(){var n=!1,r=[],t;NewMind.Array.forEach(i.MembershipCompositeSelectedOptions(),function(t){var i=t().SelectedOptionKey();i==="0"?n=!0:r.push(i)});n||(t=new f(i.Filter),i.MembershipCompositeSelectedOptions.push(ko.observable(t)));destroyChosen("select",".filterContainer");applyChosen("select",".filterContainer")};this.addMultiSelectOption=function(){var n=!1,u=[],t;(NewMind.Array.forEach(i.CompositeSelectedOptions(),function(t){var i=t().SelectedOptionKey();i==="0"?n=!0:u.push(i)}),n)||(t=new r(i.Filter),i.CompositeSelectedOptions.push(ko.observable(t)),destroyChosen("select",".filterContainer"),applyChosen("select",".filterContainer"))};this.Proximity_ShowMap=function(){$("#modalSelectProximity").modal();$("#ifrmMap").attr("src",SearchContext.Urls.MapSearch+"?lat="+i.TextBoxValueTwo()+"&long="+i.TextBoxValueThree());$("#modalSelectProximity").one("hidden.bs.modal",function(){var n=$("#ifrmMap").contents(),t=parseFloat($(n).find("#txtLatitude").val()),r=parseFloat($(n).find("#txtLongitude").val());$("#ifrmMap").attr("src","");$("#lat").val(t);$("#long").val(r);$("#modalSelectProximity").modal("hide").trigger("hide");i.TextBoxValueTwo(t);i.TextBoxValueThree(r)})};this.ShowOptions=function(){$("#modalFilterOptions").modal();applyChosen("select",".filterContainer");wireUpDatePickers()};this.HasOptionsSelected=ko.computed(function(){switch(i.Filter.Template){case"CompositeProximity":return i.IsPostcodeProximitySelected()&&!isEmptyOrWhiteSpace(i.TextBoxValue())||!i.IsPostcodeProximitySelected()&&!isEmptyOrWhiteSpace(i.TextBoxValueTwo())&&!isEmptyOrWhiteSpace(i.TextBoxValueThree());case"DateRange":return i.DateFrom.HasValue()||i.DateTo.HasValue();case"DateRangeWithRelativeDates":return i.DateFrom.HasValue()||i.DateTo.HasValue()||!isEmptyOrWhiteSpace(i.TextBoxValue());case"TextBox":case"Hidden":return!isEmptyOrWhiteSpace(i.TextBoxValue());case"SingleSelectWithTextBox":return!isEmptyOrWhiteSpace(i.TextBoxValue());case"TwoSingleSelectsWithTextBox":return!isEmptyOrWhiteSpace(i.TextBoxValue());case"MediaCountMultiSingleSelect":return i.SelectedOption()||i.SelectedOptionTwo()||i.SelectedOptionThree()||!isEmptyOrWhiteSpace(i.TextBoxValue());case"CompositeMultiSelect":return!isEmptyOrWhiteSpace(i.CompositeSelectedOptions.Summary())||i.SelectedOption()==="4";case"MultiSelect":case"MultiSelectSimple":return i.SelectedOptions().length>0||i.SelectedOption()==="4";case"SingleSelect":return i.SelectedOption()!=undefined;case"SingleSelectWithOptionalTextBox":return i.SelectedOption()||i.SelectedOptionTwo()||!isEmptyOrWhiteSpace(i.TextBoxValue());case"MembershipCompositeMultiSelect":return!isEmptyOrWhiteSpace(i.MembershipCompositeSelectedOptions.Summary())||!isEmptyOrWhiteSpace(i.Exclusions().MembershipCompositeSelectedOptions.Summary());case"ChannelCompositeMultiSelect":return!isEmptyOrWhiteSpace(i.ChannelCompositeSelectedOptions.Summary())||!isEmptyOrWhiteSpace(i.Exclusions().ChannelCompositeSelectedOptions.Summary());case"NumericRange":return i.MinimumValue.HasValue()||i.MaximumValue.HasValue();case"NumericRangeWithToggle":return i.SelectedOption()==="false"||i.MinimumValue.HasValue()||i.MaximumValue.HasValue();default:return!0}},this);this.Summary=ko.pureComputed(function(){var e,f,r,u;switch(i.Filter.Template){case"CompositeProximity":return i.HasOptionsSelected()?i.IsLatLongProximitySelected()&&!i.IsLatLongProximityValid()?SearchContext.Translations.CoordinatesNotValid:(e=i.IsPostcodeProximitySelected()?i.TextBoxValue():"("+numFormat(i.TextBoxValueTwo())+", "+numFormat(i.TextBoxValueThree())+")",i.SelectedOption.Summary()+" "+SearchContext.Translations.Proximity_Of+" "+e):"";case"DateRange":return i.HasOptionsSelected()?!i.DateFrom.IsValid()||!i.DateTo.IsValid()?SearchContext.Translations.InvalidDate:i.DateFrom.HasValue()?i.DateTo.HasValue()?i.SelectedOption.Summary()+" "+SearchContext.Translations.DateRange_Between+" "+i.DateFrom()+" "+SearchContext.Translations.DateRange_And+" "+i.DateTo():i.SelectedOption.Summary()+" "+SearchContext.Translations.DateRange_After+" "+i.DateFrom():i.SelectedOption.Summary()+" "+SearchContext.Translations.DateRange_Before+" "+i.DateTo():"";case"TextBox":return i.HasOptionsSelected()?i.TextBoxValue():"";case"Hidden":return!i.HasOptionsSelected()||isNaN(i.TextBoxValue())?"Invalid key":i.Filter.Name+"\n"+i.TextBoxValue();case"SingleSelectWithTextBox":return i.HasOptionsSelected()?i.SelectedOption.Summary()+"\n"+i.TextBoxValue():"";case"TwoSingleSelectsWithTextBox":return i.HasOptionsSelected()?i.SelectedOption.Summary()+" "+i.TextBoxValue()+" "+SearchContext.Translations.In+" "+i.SelectedOptionTwo.Summary():"";case"MediaCountMultiSingleSelect":return i.HasOptionsSelected()?i.SelectedOption.Summary()+" "+i.SelectedOptionTwo.Summary()+" "+i.SelectedOptionThree.Summary()+" "+i.TextBoxValue():"";case"SingleSelectWithOptionalTextBox":return i.HasOptionsSelected()?i.SelectedOption.Summary()+" "+i.SelectedOptionTwo.Summary()+" "+i.TextBoxValue():"";case"CompositeMultiSelect":return i.HasOptionsSelected()?i.SelectedOption.Summary()+"\n"+i.CompositeSelectedOptions.Summary():"";case"MultiSelect":case"MultiSelectSimple":return i.HasOptionsSelected()?i.SelectedOption.Summary()+"\n"+i.SelectedOptions.Summary():"";case"SingleSelect":return i.HasOptionsSelected()?i.SelectedOption.Summary():"";case"NumericRange":case"NumericRangeWithToggle":if(!i.HasOptionsSelected())return"";var t=i.SelectedOption(),n="",o=t==="true"||t===undefined;return(t!==undefined&&(f=i.Filter.Options.filter(function(n){return n.Key===t})[0],f&&(n=f.Value)),!o)?n:(r=i.MinimumValue.HasValue()&&!i.MinimumValue.IsValid(),u=i.MaximumValue.HasValue()&&!i.MaximumValue.IsValid(),r&&!u)?SearchContext.Translations.InvalidMinimumValue:!r&&u?SearchContext.Translations.InvalidMaximumValue:r&&u?SearchContext.Translations.InvalidMinimumAndMaximumValues:i.MinimumValue.HasValue()&&!i.MaximumValue.HasValue()?n+" "+SearchContext.Translations.WithMinimumOf+" "+i.MinimumValue():!i.MinimumValue.HasValue()&&i.MaximumValue.HasValue()?n+" "+SearchContext.Translations.WithMaximumOf+" "+i.MaximumValue():n+" "+SearchContext.Translations.Between+" "+i.MinimumValue()+" "+SearchContext.Translations.And+" "+i.MaximumValue();default:return""}},this);this.HasError=ko.computed(function(){switch(i.Filter.Template){case"CompositeProximity":return i.IsLatLongProximitySelected()&&!i.IsLatLongProximityValid();case"DateRange":return!i.DateFrom.IsValid()||!i.DateTo.IsValid();case"DateRangeWithRelativeDates":return!i.DateFrom.IsValid()||!i.DateTo.IsValid()||!i.TextBoxValue.IsValid();case"NumericRange":return!i.MinimumValue.IsValid()||!i.MaximumValue.IsValid();case"NumericRangeWithToggle":return i.SelectedOption()==="true"&&(!i.MinimumValue.IsValid()||!i.MaximumValue.IsValid());case"Hidden":return isNaN(i.TextBoxValue());default:return!1}},this)},i;n.NewProductLink=function(){window.location=this.SelectedProductType()!==""?SearchContext.Urls.NewProductUrl+"?type="+this.SelectedProductType():SearchContext.Urls.NewProductUrl};n.SelectedFilters=ko.observableArray();n.CurrentSelectedFilter=ko.observable();n.filterByProductType=function(t,i){i.Item3!==null&&ko.applyBindingsToNode(t,{attr:{prodtype:i.Item3},visible:n.SelectedProductType()===""||i.Item3===""||NewMind.Array.indexOf(i.Item3.split(" "),n.SelectedProductType())>=0},i)};n.filterNotApplicable=function(t){return Object.prototype.toString.call(t.ApplicableProductTypeIds)==="[object Array]"&&NewMind.Array.indexOf(t.ApplicableProductTypeIds,n.SelectedProductType())<0};n.filterSelected=function(t){var i=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id===t.Id});return i.length>0&&i[0]().HasOptionsSelected()};n.filterHasError=function(t){var i=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id===t.Id});return i.length>0&&i[0]().HasError()};n.filterSummary=function(t){var i=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id===t.Id});return i.length>0?i[0]().Summary():""};n.SelectedProductType=ko.computed(function(){var t=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id==="TypeIds"});return t.length>0&&t[0]().SelectedOptions()!=undefined&&t[0]().SelectedOptions().length===1?t[0]().SelectedOptions()[0]:""});n.SelectedProductTypeName=ko.computed(function(){var t=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id==="TypeIds"});return t.length>0&&t[0]().SelectedOptions()!=undefined&&t[0]().SelectedOptions().length===1?t[0]().SelectedOptions.Summary():""});n.IsOrganisationSearch=ko.computed(function(){return n.SelectedProductType()==="BUSI"});n.IsRelatedToProductSearch=ko.computed(function(){var t=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id==="RelatedToProduct"});return t.length>0&&t[0]().HasOptionsSelected()});n.GetSearchTitle=function(t,i,r){return ko.computed(function(){return n.IsOrganisationSearch()?t+" "+i:n.SelectedProductType()?n.SelectedProductTypeName()+" "+t:t+" "+r})};n.SelectedFiltersCount=ko.computed(function(){var t=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().HasOptionsSelected()});return n.IsOrganisationSearch()?t.length-1:t.length});n.HasVisibleSelectedFilters=function(){return!n.AreFiltersCollapsed()&&n.SelectedFiltersCount()>0};n.addFilter=function(t){typeof t=="undefined"&&(t=this);var u=new e(t),r=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id===t.Id}),i;return r.length>0?i=r[0]:(i=ko.observable(u),n.SelectedFilters.push(i)),i()};n.selectFilter=function(t){var i=n.addFilter(t);n.CurrentSelectedFilter(i);i.ShowOptions();n.AreFiltersCollapsed(!$(".filters").is(":visible"))};n.initialiseFromQueryModel=function(){n.Conjugation(queryModel.Conjugation);$(".auto-apply-chosen select").trigger("chosen:updated");jQuery.trim(queryModel.CombinedNameKeyIDs)&&n.CombinedNameKeyIDsValue(queryModel.CombinedNameKeyIDs);NewMind.Array.forEach(n.Filters,function(t){var s=t.Template,l=t.Id,i,h,c,e,o;if(value=queryModel[l],value!==null||(s==="MembershipCompositeMultiSelect"||s==="ChannelCompositeMultiSelect")&&queryModel[l+"Exclusions"]!=null){i=n.addFilter(t);switch(s){case"SingleSelect":switch(l){case"StatusId":case"WidgetID":i.SelectedOption(value);break;default:i.SelectedOption(value?"true":"false")}break;case"TextBox":case"Hidden":i.TextBoxValue(value);break;case"SingleSelectWithTextBox":i.SelectedOption(value.Key);i.TextBoxValue(value.Text);break;case"TwoSingleSelectsWithTextBox":i.SelectedOption(value.FilterType);value.TextLang!=null&&(i.TextBoxValue(value.TextLang.Text),i.SelectedOptionTwo(value.TextLang.LanguageId));break;case"MediaCountMultiSingleSelect":i.SelectedOption(value.CountConjugation);i.SelectedOptionTwo(value.MediaCount);i.SelectedOptionThree(value.SizeConjugation);i.TextBoxValue(value.ImageWidthInPixels);break;case"SingleSelectWithOptionalTextBox":i.SelectedOption(value.ExternaIDKey);i.SelectedOptionTwo(value.ExternalIDSearchType);i.TextBoxValue(value.Value);break;case"CompositeProximity":i.SelectedOption(value.DistanceInKilometres);isEmptyOrWhiteSpace(value.PostCode)?(i.SelectedOptionTwo("LATLONG"),i.TextBoxValueTwo(value.Latitude),i.TextBoxValueThree(value.Longitude)):(i.SelectedOptionTwo("POSTCODE"),i.TextBoxValue(value.PostCode));break;case"DateRange":i.SelectedOption(value.InRange?"true":"false");i.DateFrom(dateFormat(value.From));i.DateTo(dateFormat(value.To));break;case"DateRangeWithRelativeDates":i.RelativeDatesSelected(value.RelativeDates?"true":"false");i.SelectedOption(value.InRange?"true":"false");i.DateFrom(dateFormat(value.From));i.DateTo(dateFormat(value.To));i.SelectedOptionTwo(value.Interval==null?i.Filter.OptionsFourDefaultValue:value.Interval.toString());i.TextBoxValue(value.PeriodValue==null?i.Filter.TextBoxDefaultValue:value.PeriodValue.toString());i.SelectedOptionFour(value.Period==null?i.Filter.OptionsFourDefaultValue:value.Period.toString());break;case"MultiSelectSimple":i.SelectedOptions(value.Options);break;case"MultiSelect":case"CompositeMultiSelect":h=[];NewMind.Array.forEach(value.Options,function(n){if(s==="MultiSelect")h.push(n.Key);else{var i=new r(t);i.SelectedOptionKey(n.Key);i.SelectedOptionType(n.TypeKey);i.SelectedOptionIsType(n.IsType==null?"":n.IsType.toString());h.push(ko.observable(i))}});s==="MultiSelect"?i.SelectedOptions(h):(h.push(ko.observable(new r(t))),i.CompositeSelectedOptions(h));i.SelectedOption(value.FilterType);break;case"MembershipCompositeMultiSelect":c=function(n,t){var i=[];return NewMind.Array.forEach(n.Options,function(n){var r=new f(t);r.SelectedOptionKey((n.Key||0).toString());r.SelectedPaymentStatus(n.PaymentStatus==null?"":n.PaymentStatus.toString());r.SelectedSaleStatus(n.SaleStatus||0);r.SelectedSaleType((n.SaleType||0).toString());r.SelectedPaymentMethod((n.PaymentMethod||0).toString());r.SelectedScheme((n.Scheme||0).toString());i.push(ko.observable(r))}),i.push(ko.observable(new f(t))),i};value!==null&&(e=c(value,t),i.MembershipCompositeSelectedOptions(e),i.SelectedOption(value.FilterType.toString()));o=queryModel[l+"Exclusions"];o!=null&&(e=c(o,t),i.Exclusions().MembershipCompositeSelectedOptions(e),i.Exclusions().SelectedOption(o.FilterType.toString()));break;case"ChannelCompositeMultiSelect":c=function(n,t){var i=[];return NewMind.Array.forEach(n.Options,function(n){var r=new u(t);r.SelectedOptionKey(n.Key);r.SelectedListingLevel(n.ListingLevel);r.SelectedIsKey(n.IsKey==null?"":n.IsKey.toString());r.SelectedDoNotIndex(n.DoNotIndex==null?"":n.DoNotIndex.toString());i.push(ko.observable(r))}),i.push(ko.observable(new u(t))),i};value!==null&&(e=c(value,t),i.ChannelCompositeSelectedOptions(e),i.SelectedOption(value.FilterType.toString()));o=queryModel[l+"Exclusions"];o!=null&&(e=c(o,t),i.Exclusions().ChannelCompositeSelectedOptions(e),i.Exclusions().SelectedOption(o.FilterType.toString()));break;case"NumericRange":i.MinimumValue(value.Min);i.MaximumValue(value.Max);break;case"NumericRangeWithToggle":i.SelectedOption(value.HasGroupTravel.toString());value.Range&&(i.MinimumValue(value.Range.Min),i.MaximumValue(value.Range.Max));break;default:window.console&&console.log("Unsupported Template: "+s)}}})};n.removeFilter=function(){var t=this;n.SelectedFilters.remove(function(n){return n().Filter.Id==t.Id})};n.buildSearchQuery=function(){var r=!1,t=new ProductSearchQuery,u=jQuery.trim(n.CombinedNameKeyIDsValue());return u.length>0&&(t.CombinedNameKeyIDs=u,r=!0),NewMind.Array.forEach(n.SelectedFilters(),function(n){var o,tt,it,rt,et,ot,st,y,f,h,c,s,nt,l,a,p,w,ht;if(n().HasOptionsSelected()){var e=n().Filter.Template,u=n().Filter.Id,v=function(n){var f=function(n,t,i){this.FilterType=isNaN(n)?1:parseInt(n);this.Options=t instanceof Array?t:null;this.MultiOptionsHasCompositeKey=i},o=function(n,t){this.FilterType=isNaN(n)?1:parseInt(n);this.Options=t instanceof Array?t:null},s=function(n){this.Key=n},h=function(n){var r=n().SelectedOptionKey(),t=n().SelectedOptionType(),i=n().SelectedOptionIsType();this.Key=r;this.TypeKey=isNaN(t)?null:parseInt(t);this.IsType=jQuery.trim(i)===""?null:i==="true"},c=function(n){var u=n().SelectedOptionKey(),t=n().SelectedListingLevel(),i=n().SelectedIsKey(),r=n().SelectedDoNotIndex();this.Key=u;this.ListingLevelKey=isNaN(t)?null:parseInt(t);this.IsKey=jQuery.trim(i)===""?null:i==="true";this.DoNotIndex=jQuery.trim(r)===""?null:r==="true"},l=function(n){this.Key=n().SelectedOptionKey();this.PaymentStatus=n().SelectedPaymentStatus();this.SaleStatus=n().SelectedSaleStatus();this.SaleType=n().SelectedSaleType();this.PaymentMethod=n().SelectedPaymentMethod();this.Scheme=n().SelectedScheme()},r,u,t,i;return r=e==="MultiSelect"||e==="MultiSelectSimple"?n.SelectedOptions():e==="MembershipCompositeMultiSelect"?n.MembershipCompositeSelectedOptions():e==="ChannelCompositeMultiSelect"?n.ChannelCompositeSelectedOptions():n.CompositeSelectedOptions(),t=n.SelectedOption(),r.length>0?(i=[],NewMind.Array.forEach(r,function(n){var t=n,r;e==="MultiSelect"&&t>0?r=new s(t):e==="MultiSelectSimple"&&t!==""?r=t:e==="MembershipCompositeMultiSelect"&&(t().SelectedOptionKey()!="0"||t().SelectedOptionKey()=="-1")?r=new l(t):e==="ChannelCompositeMultiSelect"&&(t().SelectedOptionKey()!="0"||t().SelectedOptionKey()=="-1")?r=new c(t):(t().SelectedOptionKey()!="0"||t().SelectedOptionKey()=="-1")&&(r=new h(t));typeof r!="undefined"&&i.push(r)}),u=e==="MultiSelectSimple"?new o(t,i):new f(t,i,n.MultiOptionsHasCompositeKey)):t==="4"&&(u=new f(t,null,n.MultiOptionsHasCompositeKey)),u};switch(e){case"TextBox":case"Hidden":s=jQuery.trim(n().TextBoxValue());s.length>0&&(t[u]=s,r=!0);break;case"SingleSelectWithTextBox":o=jQuery.trim(n().TextBoxValue());f=n().SelectedOption();o.length>0&&!isNaN(f)&&(tt=function(n,t){this.Key=parseInt(n);this.Text=t},t[u]=new tt(f,o),r=!0);break;case"TwoSingleSelectsWithTextBox":var o=jQuery.trim(n().TextBoxValue()),f=n().SelectedOption(),k=jQuery.trim(n().SelectedOptionTwo());o.length>0&&k.length>0&&!isNaN(f)&&(it=function(n,t){this.Text=n;this.LanguageId=t},rt=function(n,t,i){this.FilterType=isNaN(n)?1:parseInt(n);this.TextLang=new it(t,i)},t[u]=new rt(f,o,k),r=!0);break;case"MediaCountMultiSingleSelect":var ct=jQuery.trim(n().TextBoxValue()),ut=n().SelectedOption(),ft=jQuery.trim(n().SelectedOptionTwo()),lt=jQuery.trim(n().SelectedOptionThree());ft.length>0&&ut.length>0&&(et=function(n,t,i,r){this.MediaCount=n;this.CountConjugation=t;i.length>0&&IsNumeric(parseInt(r))&&(this.SizeConjugation=i,this.ImageWidthInPixels=r)},t[u]=new et(ft,ut,lt,ct),r=!0);break;case"SingleSelectWithOptionalTextBox":var o=jQuery.trim(n().TextBoxValue()),f=n().SelectedOption(),k=jQuery.trim(n().SelectedOptionTwo());isNaN(f)||(ot=function(n,t,i){this.ExternaIDKey=parseInt(n);this.ExternalIDSearchType=parseInt(t);this.Value=i},t[u]=new ot(f,k,o),r=!0);break;case"CompositeProximity":var f=n().SelectedOption(),o=jQuery.trim(n().TextBoxValue()),d=jQuery.trim(n().TextBoxValueTwo()),g=jQuery.trim(n().TextBoxValueThree());!isNaN(f)&&(o.length>0||d.length>0&&isLatitudeValid(d)&&g.length>0&&isLatitudeValid(g))&&(st=function(t,i,r,u){this.DistanceInKilometres=isNaN(t)?1:parseInt(t);n().IsPostcodeProximitySelected()?this.PostCode=i:(this.Latitude=parseFloat(r),this.Longitude=parseFloat(u))},t[u]=new st(f,o,d,g),r=!0);break;case"DateRange":h=i(n().DateFrom());c=i(n().DateTo());(h!==null||c!==null)&&(f=n().SelectedOption(),y=function(n,t,i){this.InRange=n==="true";this.From=t;this.To=i},t[u]=new y(f,h,c),r=!0);break;case"DateRangeWithRelativeDates":if(y=function(n,t,i,r,u,f,e){this.RelativeDates=t;this.InRange=n==="true";this.Interval=i;this.PeriodValue=r;this.Period=u;this.From=f;this.To=e},f=n().SelectedOption(),n().RelativeDatesSelected()==="true"){var at=n().SelectedOptionTwo(),vt=n().TextBoxValue(),yt=n().SelectedOptionFour();t[u]=new y(f,!0,at,vt,yt);r=!0}else h=i(n().DateFrom()),c=i(n().DateTo()),(h!==null||c!==null)&&(t[u]=new y(f,!1,null,null,null,h,c),r=!0);break;case"SingleSelect":if(s=n().SelectedOption(),s!==undefined){r=!0;switch(u){case"StatusId":case"WidgetID":t[u]=s;break;default:t[u]=s==="true"}}break;case"MultiSelect":case"MultiSelectSimple":case"CompositeMultiSelect":nt=v(n());typeof nt!="undefined"&&(t[u]=nt,r=!0);break;case"MembershipCompositeMultiSelect":l=v(n());typeof l!="undefined"&&(t[u]=l,r=!0);a=v(n().Exclusions());typeof a!="undefined"&&(t[u+"Exclusions"]=a,r=!0);break;case"ChannelCompositeMultiSelect":l=v(n());typeof l!="undefined"&&(t[u]=l,r=!0);a=v(n().Exclusions());typeof a!="undefined"&&(t[u+"Exclusions"]=a,r=!0);break;case"NumericRange":p=n().MinimumValue();w=n().MaximumValue();(p!==null||w!==null)&&(ht=function(n,t){this.Min=n;this.Max=t},t[u]=new ht(p,w),r=!0);break;case"NumericRangeWithToggle":var b=n().SelectedOption(),p=n().MinimumValue(),w=n().MaximumValue();if(b&&(p!==null||w!==null)){var pt=function(n,t){this.HasGroupTravel=n;this.Range=t},wt=b==="true"||b===undefined,bt=wt?{min:p,max:w}:undefined;t[u]=new pt(b,bt);r=!0}break;default:window.console&&console.log("Unsupported Template: "+e)}}}),r?t:null};Date.prototype.addDays=function(n){var t=new Date(this.valueOf());return t.setDate(t.getDate()+n),t};Date.prototype.addMonths=function(n){var t=new Date(this.valueOf());return t.setMonth(t.getMonth()+n),t};i=function(n){var t=kendo.parseDate(n);return t!=null?new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())):null};n.runSearch=function(){var t=this.buildSearchQuery();queryModel=t!=null?t:new ProductSearchQuery;queryModel.Conjugation=isNaN(n.Conjugation())?0:parseInt(n.Conjugation());n.CollapseFilters();RunSearchQuery()};n.HasError=ko.computed(function(){var t=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().HasError()});return t.length>0});n.CombinedNameKeyIDsValue=ko.observable("");n.AreFiltersCollapsed=ko.observable($(".filters").is(":visible"));n.CollapseFilters=function(){$(".filters").hide();n.AreFiltersCollapsed(!0)};n.ToggleFilters=function(){$(".filters").toggle();n.AreFiltersCollapsed(!$(".filters").is(":visible"))};n.Conjugation=ko.observable(0);n.GetConjunction=function(){return this.ConjugationOptions()[this.Conjugation()].Conjunction().toUpperCase()};n.showJson=function(){alert(ko.toJSON(n))};n.OpeningPeriodSearch=function(t){var c=NewMind.Array.filter(n.SelectedFilters(),function(n){return n().Filter.Id==="Openings"}),f,r,u,e,o,h,s;c.length!==0&&(f=c[0](),f.RelativeDatesSelected()==="true"&&(f.updateDateRanges(),f.RelativeDatesSelected("false")),r=i(f.DateFrom()),u=i(f.DateTo()),r.getDate()===u.getDate()&&r.getMonth()!==u.getMonth()?(h=monthsDiff(r,u),t?(e=u,o=u.addMonths(h)):(e=r.addMonths(h*-1),o=r)):(s=daysDiff(r,u),s===0&&(s=1),t?(e=u.addDays(1),o=u.addDays(s)):(e=r.addDays(s*-1),o=r.addDays(-1))),f.DateFrom(kendo.toString(e,kendo.culture().calendar.patterns.d)),f.DateTo(kendo.toString(o,kendo.culture().calendar.patterns.d)),n.runSearch())}};String.prototype.repeat=function(n){if(n<1)return"";for(var i="",t=this.valueOf();n>0;)n&1&&(i+=t),n>>=1,t+=t;return i};_gaq=_gaq||[];_gaq.push(["_setAccount","UA-21389996-1"]);_gaq.push(["_setDomainName","none"]);_gaq.push(["_trackPageview"]),function(){var n=document.createElement("script"),t;n.type="text/javascript";n.async=!0;n.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)}();NewMind=NewMind||{};NewMind.Array=NewMind.Array||{};NewMind.Array.filter=function(n,t){"use strict";var r,e,u,o,i,f;if(this===void 0||this===null)throw new TypeError;if(r=Object(n),e=r.length>>>0,typeof t!="function")throw new TypeError;for(u=[],o=arguments.length>=2?arguments[1]:void 0,i=0;i<e;i++)i in r&&(f=r[i],t.call(o,f,i,r)&&u.push(f));return u};NewMind=NewMind||{};NewMind.Array=NewMind.Array||{};NewMind.Array.find=function(n,t){var i;if(typeof t!="function")throw new TypeError("predicate must be a function");var r=Object(n),f=r.length>>>0,e=arguments[2],u;for(i=0;i<f;i++)if(i in r&&(u=r[i],t.call(e,u,i,r)))return u;return undefined};NewMind=NewMind||{};NewMind.Array=NewMind.Array||{};NewMind.Array.forEach=function(n,t,i){var f,r,u=Object(n),o=u.length>>>0,e;if(typeof t!="function")throw new TypeError(t+" is not a function");for(i&&(f=i),r=0;r<o;)r in u&&(e=u[r],t.call(f,e,r,u)),r++};NewMind=NewMind||{};NewMind.Array=NewMind.Array||{};NewMind.Array.indexOf=function(n,t,i){var u,e,f,r;if(n==null)throw new TypeError('"array" is null or not defined');if((e=Object(n),f=e.length>>>0,f===0)||(r=+i||0,Math.abs(r)===Infinity&&(r=0),r>=f))return-1;for(u=Math.max(r>=0?r:f-Math.abs(r),0);u<f;){if(u in e&&e[u]===t)return u;u++}return-1};NewMind=NewMind||{};NewMind.Array=NewMind.Array||{};NewMind.Array.map=function(n,t,i){var o,f,r,u=Object(n),s=u.length>>>0,h,c,e;if(typeof t!="function")throw new TypeError(t+" is not a function");for(i&&(o=i),f=new Array(s),r=0;r<s;)r in u&&(e=r.toString(),h=u[e],c=t.call(o,h,r,u),f[e]=c),r++;return f};$(function(){var t=1,n=document.createElement("img");n.style.position="absolute";n.style.top="-1px";n.style.left="-1px";n.style.width="1px";n.style.height="1px";document.body.appendChild(n);setInterval(function(){t>18||(n.src="/keepalive.asp?"+(new Date).getTime(),t++)},6e5)});$(function(){applyChosen()});NewMind=window.NewMind||{};NewMind.Dms=function(){function k(n,t,i){var t=t||60;return"https://www.gravatar.com/avatar/"+MD5(n)+".jpg?s="+t+"&d="+escape(i)}var c=0,l=0,a=0,p,o,t,v,n,u,s,i,h,w=function(){p=document.body;o=document.getElementById("menu");v=document.getElementById("topbar");t=document.getElementById("menubutton");n=document.getElementById("wall");u=document.getElementById("userprofile");s=document.getElementById("useroptions");y();b();$(t).click(function(n){n.preventDefault();n.stopImmediatePropagation();d()});$(u).click(function(n){n.preventDefault();n.stopImmediatePropagation();g()});$(n).click(function(n){n.preventDefault();n.stopImmediatePropagation();r();e();f()});$(v).click(function(n){n.stopImmediatePropagation();r();e();f()})},b=function(){var n=$("#user-email").text(),i=$("#user-face"),t=location.protocol+"//"+(location.hostname||location.hostname)+"/App/Content/css/3.0/default-avatar.png",r=n?k(n,64,t):t;i.css("background-image","url('"+r.replace("'","")+"')")},d=function(){$(t).hasClass("open")?r():tt()},g=function(){$(u).hasClass("open")?e():rt()},nt=function(){$(i).hasClass("open")?f():it()},tt=function(){clearTimeout(c);o.style.display="";$(t).addClass("open");e(function(){n.style.display="block"});f(function(){n.style.display="block"});resizeIframeToFitContent(document.getElementById("classicMenuFrame"));resizeIframeToFitContentWidth(document.getElementById("classicMenuFrame"))},r=function(i){o&&t&&(c=setTimeout(function(){o.style.display="none";$(t).removeClass("open");n.style.display="none";i&&i()},0))},it=function(){clearTimeout(a);h.style.display="";$(i).addClass("open");e(function(){n.style.display="block"});r(function(){n.style.display="block"})},f=function(t){i&&h&&(a=setTimeout(function(){h.style.display="none";$(i).removeClass("open");n.style.display="none";t&&t()},0))},rt=function(){clearTimeout(l);s.style.display="";$(u).addClass("open");r(function(){n.style.display="block"});f(function(){n.style.display="block"})},e=function(t){s&&(l=setTimeout(function(){s.style.display="none";$(u).removeClass("open");n.style.display="none";t&&t()},0))},y=function(){i=document.getElementById("basket");h=document.getElementById("basketmenu");$(i).click(function(n){n.preventDefault();n.stopImmediatePropagation();nt()})};return $(w),{hideMenu:r,bindBasket:y}}();MD5=function(n){function a(n,t){return n<<t|n>>>32-t}function o(n,t){var f,e,r,u,i;return(r=n&2147483648,u=t&2147483648,f=n&1073741824,e=t&1073741824,i=(n&1073741823)+(t&1073741823),f&e)?i^2147483648^r^u:f|e?i&1073741824?i^3221225472^r^u:i^1073741824^r^u:i^r^u}function yt(n,t,i){return n&t|~n&i}function pt(n,t,i){return n&i|t&~i}function wt(n,t,i){return n^t^i}function bt(n,t,i){return t^(n|~i)}function s(n,t,i,r,u,f,e){return n=o(n,o(o(yt(t,i,r),u),e)),o(a(n,f),t)}function h(n,t,i,r,u,f,e){return n=o(n,o(o(pt(t,i,r),u),e)),o(a(n,f),t)}function c(n,t,i,r,u,f,e){return n=o(n,o(o(wt(t,i,r),u),e)),o(a(n,f),t)}function l(n,t,i,r,u,f,e){return n=o(n,o(o(bt(t,i,r),u),e)),o(a(n,f),t)}function kt(n){for(var r,u=n.length,o=u+8,s=(o-o%64)/64,e=(s+1)*16,i=Array(e-1),f=0,t=0;t<u;)r=(t-t%4)/4,f=t%4*8,i[r]=i[r]|n.charCodeAt(t)<<f,t++;return r=(t-t%4)/4,f=t%4*8,i[r]=i[r]|128<<f,i[e-2]=u<<3,i[e-1]=u>>>29,i}function v(n){for(var i="",r="",u,t=0;t<=3;t++)u=n>>>t*8&255,r="0"+u.toString(16),i=i+r.substr(r.length-2,2);return i}function dt(n){var i,r,t;for(n=n.replace(/rn/g,"n"),i="",r=0;r<n.length;r++)t=n.charCodeAt(r),t<128?i+=String.fromCharCode(t):t>127&&t<2048?(i+=String.fromCharCode(t>>6|192),i+=String.fromCharCode(t&63|128)):(i+=String.fromCharCode(t>>12|224),i+=String.fromCharCode(t>>6&63|128),i+=String.fromCharCode(t&63|128));return i}var e=Array(),f,ht,ct,lt,at,t,i,r,u,y=7,p=12,w=17,b=22,k=5,d=9,g=14,nt=20,tt=4,it=11,rt=16,ut=23,ft=6,et=10,ot=15,st=21,vt;for(n=dt(n),e=kt(n),t=1732584193,i=4023233417,r=2562383102,u=271733878,f=0;f<e.length;f+=16)ht=t,ct=i,lt=r,at=u,t=s(t,i,r,u,e[f+0],y,3614090360),u=s(u,t,i,r,e[f+1],p,3905402710),r=s(r,u,t,i,e[f+2],w,606105819),i=s(i,r,u,t,e[f+3],b,3250441966),t=s(t,i,r,u,e[f+4],y,4118548399),u=s(u,t,i,r,e[f+5],p,1200080426),r=s(r,u,t,i,e[f+6],w,2821735955),i=s(i,r,u,t,e[f+7],b,4249261313),t=s(t,i,r,u,e[f+8],y,1770035416),u=s(u,t,i,r,e[f+9],p,2336552879),r=s(r,u,t,i,e[f+10],w,4294925233),i=s(i,r,u,t,e[f+11],b,2304563134),t=s(t,i,r,u,e[f+12],y,1804603682),u=s(u,t,i,r,e[f+13],p,4254626195),r=s(r,u,t,i,e[f+14],w,2792965006),i=s(i,r,u,t,e[f+15],b,1236535329),t=h(t,i,r,u,e[f+1],k,4129170786),u=h(u,t,i,r,e[f+6],d,3225465664),r=h(r,u,t,i,e[f+11],g,643717713),i=h(i,r,u,t,e[f+0],nt,3921069994),t=h(t,i,r,u,e[f+5],k,3593408605),u=h(u,t,i,r,e[f+10],d,38016083),r=h(r,u,t,i,e[f+15],g,3634488961),i=h(i,r,u,t,e[f+4],nt,3889429448),t=h(t,i,r,u,e[f+9],k,568446438),u=h(u,t,i,r,e[f+14],d,3275163606),r=h(r,u,t,i,e[f+3],g,4107603335),i=h(i,r,u,t,e[f+8],nt,1163531501),t=h(t,i,r,u,e[f+13],k,2850285829),u=h(u,t,i,r,e[f+2],d,4243563512),r=h(r,u,t,i,e[f+7],g,1735328473),i=h(i,r,u,t,e[f+12],nt,2368359562),t=c(t,i,r,u,e[f+5],tt,4294588738),u=c(u,t,i,r,e[f+8],it,2272392833),r=c(r,u,t,i,e[f+11],rt,1839030562),i=c(i,r,u,t,e[f+14],ut,4259657740),t=c(t,i,r,u,e[f+1],tt,2763975236),u=c(u,t,i,r,e[f+4],it,1272893353),r=c(r,u,t,i,e[f+7],rt,4139469664),i=c(i,r,u,t,e[f+10],ut,3200236656),t=c(t,i,r,u,e[f+13],tt,681279174),u=c(u,t,i,r,e[f+0],it,3936430074),r=c(r,u,t,i,e[f+3],rt,3572445317),i=c(i,r,u,t,e[f+6],ut,76029189),t=c(t,i,r,u,e[f+9],tt,3654602809),u=c(u,t,i,r,e[f+12],it,3873151461),r=c(r,u,t,i,e[f+15],rt,530742520),i=c(i,r,u,t,e[f+2],ut,3299628645),t=l(t,i,r,u,e[f+0],ft,4096336452),u=l(u,t,i,r,e[f+7],et,1126891415),r=l(r,u,t,i,e[f+14],ot,2878612391),i=l(i,r,u,t,e[f+5],st,4237533241),t=l(t,i,r,u,e[f+12],ft,1700485571),u=l(u,t,i,r,e[f+3],et,2399980690),r=l(r,u,t,i,e[f+10],ot,4293915773),i=l(i,r,u,t,e[f+1],st,2240044497),t=l(t,i,r,u,e[f+8],ft,1873313359),u=l(u,t,i,r,e[f+15],et,4264355552),r=l(r,u,t,i,e[f+6],ot,2734768916),i=l(i,r,u,t,e[f+13],st,1309151649),t=l(t,i,r,u,e[f+4],ft,4149444226),u=l(u,t,i,r,e[f+11],et,3174756917),r=l(r,u,t,i,e[f+2],ot,718787259),i=l(i,r,u,t,e[f+9],st,3951481745),t=o(t,ht),i=o(i,ct),r=o(r,lt),u=o(u,at);return vt=v(t)+v(i)+v(r)+v(u),vt.toLowerCase()};$(function(){LoadBasketControl()});$(function(){$(".modal").on("show.bs.modal",centerModal);$(".modal").on("hidden.bs.modal",function(){resizeIframeToFitContent(window.frameElement)})});$(window.parent||window).on("resize",function(){typeof jQuery!="undefined"&&$(".modal").filter(":visible").each(centerModal)});$.fn.modal.Constructor.prototype.enforceFocus=function(){modal_this=this;$(document).on("focusin.modal",function(n){modal_this.$element[0]===n.target||modal_this.$element.has(n.target).length||$(n.target.parentNode).hasClass("cke_dialog_ui_input_select")||$(n.target.parentNode).hasClass("cke_dialog_ui_input_text")||modal_this.$element.focus()})};NewMind=window.NewMind||{};NewMind.Buttons=function(){function n(n,e,o,s,h){var c,a,l;n.getAttribute("data-original-label")||n.setAttribute("data-original-label",n.textContent||n.innerText);c=$(n);c.css("width","auto");a=c.width();l=c.find("*").last();l.length||(l=c);l.text(e||n.getAttribute("data-original-label"));setTimeout(function(){n.disabled=!o},100);var v=(s?u:0)+r,y=parseInt(c.css("padding-left").replace("px",""),10),p=c.outerWidth()+(v-y);c.width(a);c.animate({width:p+"px",paddingLeft:v+"px"},i);s?t=setTimeout(function(){c.addClass("with-spinner")},i):(t&&clearTimeout(t),t=null,c.removeClass("with-spinner"));h&&setTimeout(function(){NewMind.Buttons.resetButtonStatus(n)},f)}var r=12,u=24,i=100,f=1e3,t=null;return{setButtonStatusSaving:function(t){n(t,NewMind.CommonTranslations.ButtonSaving,!1,!0,!1)},setButtonStatusSaved:function(t){n(t,NewMind.CommonTranslations.ButtonSaved,!0,!1,!0)},setButtonStatusSending:function(t){n(t,NewMind.CommonTranslations.ButtonSending,!1,!0,!1)},setButtonStatusSent:function(t){n(t,NewMind.CommonTranslations.ButtonSent,!0,!1,!0)},setButtonStatusCancelling:function(t){n(t,NewMind.CommonTranslations.ButtonCancelling,!1,!0,!1)},setButtonStatusClosing:function(t){n(t,NewMind.CommonTranslations.ButtonClosing,!1,!0,!1)},setButtonStatusLoggingIn:function(t){n(t,NewMind.CommonTranslations.ButtonLoggingIn,!1,!0,!1)},setButtonStatusSearching:function(t){n(t,NewMind.CommonTranslations.ButtonSearching,!1,!0,!1)},setButtonStatusCopying:function(t){n(t,NewMind.CommonTranslations.ButtonCopying,!1,!0,!1)},setButtonStatusCreating:function(t){n(t,NewMind.CommonTranslations.ButtonCreating,!1,!0,!1)},setButtonStatusDone:function(t){n(t,NewMind.CommonTranslations.ButtonDone,!0,!1,!0)},resetButtonStatus:function(t){n(t,null,!0,!1,!1)}}}();$(function(){wireUpDatePickers()});$(function(){resolveDates()});$(function(){$(".homepage-block").on("mouseover",function(){var n=$(this),t=n.children("img");n.addClass("hover").css("backgroundColor",this.getAttribute("data-color"));t.attr("src",t.attr("src").replace(".png","_Reversed.png"))}).on("mouseout",function(){var n=$(this),t=n.children("img");n.removeClass("hover").css("backgroundColor","");t.attr("src",t.attr("src").replace("_Reversed.png",".png"))})});Simpleview=window.Simpleview||{};Simpleview.MegaNav=function(){function i(n,t){while(n){if(n.classList&&n.classList.contains(t))return n;if(!n||n.tagName.toLowerCase()==="body")return null;n=n.parentElement}}var n=function(n){n.classList.add("searching")},t=function(n,t,r,u){var h=(n.currentTarget.value||"").trim(),s,f,e,o;if(n.keyCode==13&&h!=""){if(s=i(n.currentTarget,"nav-search"),!s)return;Simpleview.MegaNav.setMegaNavSearchState(s);f=document.createElement("form");f.style.display="none";f.setAttribute("target","_top");f.setAttribute("method","get");f.setAttribute("action",t);e=document.createElement("input");e.type="hidden";e.name="searchType";e.value=r;f.appendChild(e);o=document.createElement("input");o.type="text";o.name=u;o.value=h;f.appendChild(o);document.body.appendChild(f);f.submit()}};return{setMegaNavSearchState:n,performMegaNavSearchIfRequired:t}}();NewMind=window.NewMind||{};NewMind.Products=NewMind.Products||{};NewMind.Products.FacilityTab=function(){function u(n,t,r,u,f,e,o){var s=$("<div/>").text(t).html(),h=$("<div/>").text(product.Notes).html();i+='\t\t\t<div class="facility-item" id="facility-item-'+n+'">\t\t\t\t<div class="checkboxcell"><input name="fac-fac" onclick="product.facility.tn(this);" type="checkbox"'+(e===!0?' checked="checked"':"")+(u===!0?" disabled ":"")+" value="+parseInt(n,10)+'><\/div>\t\t\t\t<div class="checkbox-label">\t\t\t\t\t<label class="facilityName">'+s+'<\/label>\t\t\t\t\t<label class="idLabel">['+r+"]<\/label>\t\t\t\t\t<a "+(e!==!0||u?' disabled="disabled"':"")+' class="note'+(o===!0?" hasN":"")+'" onclick="product.facility.notes(this); return false;" href="#" style="'+(f?"":"visibility: hidden")+'">'+h+"<\/a>\t\t\t\t<\/div>\t\t\t<\/div>\t\t"}function f(n){n.append(i);n.append('<div class="clearfix"><\/div>');i=""}function e(){clearTimeout(r);r=setTimeout(t,200)}function t(){var i=document.getElementById("facilityFilter").value,r=$("#showAll",n).hasClass("active"),f=document.getElementById("facilitySetFilter").value,u,t;if(document.getElementById("facilityShowSelectedFilter").value=r?"":"true",$(".select-all span.unfiltered",n).hide(),$(".deselect-all span.unfiltered",n).hide(),$(".select-all span.filtered",n).hide(),$(".deselect-all span.filtered",n).hide(),$(".noSelectedResults",n).hide(),$(".noResults",n).hide(),i===""&&r&&!f){$(".facility-item",n).show().parents(".facCont").show();$(".select-all span.unfiltered",n).show();$(".deselect-all span.unfiltered",n).show();return}$(".select-all span.filtered",n).show();$(".deselect-all span.filtered",n).show();$(".facility-item",n).hide().parents(".facCont").hide();u=f?$("h4:iequals('"+f.replace(/(:|\.|\[|\]|,)/g,"\\$1")+"')",n).closest(".facCont"):$(n);i!==""?(t=$('label:icontains("'+i.replace(/(:|\.|\[|\]|,)/g,"\\$1")+'")',u).closest(".facility-item"),t=t.add($('h4:icontains("'+i.replace(/(:|\.|\[|\]|,)/g,"\\$1")+'")',u).closest(".facCont").find(".facility-item"))):t=$(".facility-item",u);r||(t=t.find("input[type=checkbox]:checked").closest(".facility-item"),t.length==0&&$(".noSelectedResults",n).show());t.show().parents(".facCont").show();t.length==0&&r&&$(".noResults",n).show()}function o(i){$(i).closest(".btn-group").find(".btn.active").removeClass("active");$(i).addClass("active");t();$('div[id^="facSet"]',n).each(function(){var n=$(this),t=$(".facility-item:visible",n);t.length==1?n.css("column-count","").css("-webkit-column-count","").css("-moz-column-count",""):n.css("column-count","3").css("-webkit-column-count","3").css("-moz-column-count","3")})}function s(t){var i=$("#facility-item-"+t,n);i.length!==0?(i.show().parents(".facCont").show(),ScrollTo(i),i.stop().css("background-color","#f2dede"),setTimeout(function(){i.animate({backgroundColor:""},2e3)},500)):NMAlert(product.facilityIsNotAvailableForSelection)}function h(){var i=$("h4",n),t=$("#facilitySetFilter",n);$.each(i,function(n,i){t.append($("<option><\/option>").text($(i).text()))});t.chosen({width:"300px"})}function c(n,t){var u=$(n).parent().parent().parent(),i=$(".checkboxset",u),r;r=t?$(".checkboxcell:not(.checked):visible",i):$(".checkboxcell.checked:visible",i);$("input[type=checkbox]",r).click()}var i="",n="#facTab",r=0;return{toggleCheckedVisible:o,textFilterChanged:e,appendFacility:u,renderFacilities:f,jumpTo:s,populateFacSets:h,facSetFilterChanged:t,applyFilters:t,toggleAllFacilities:c}}();jQuery(document).ready(function(){var t=220,n=500;jQuery(window).scroll(function(){jQuery(this).scrollTop()>t?jQuery(".scroll-to-top").fadeIn(n):jQuery(".scroll-to-top").fadeOut(n)});jQuery(".scroll-to-top").click(function(t){return t.preventDefault(),jQuery("html, body").animate({scrollTop:0},n),!1})});jQuery(window).load(function(){scrollToBottom=function(){var n=$(document).height(),t=$(window).height();n>t&&$("html, body").animate({scrollTop:n-t},500)}});jQuery(document).ready(function(){var t=220,n=500;jQuery(window).scroll(function(){jQuery(this).scrollTop()>t?jQuery(".scroll-to-top").fadeIn(n):jQuery(".scroll-to-top").fadeOut(n)});jQuery(".scroll-to-top").click(function(t){return t.preventDefault(),jQuery("html, body").animate({scrollTop:0},n),!1})});$(function(){$(document).on("click",":not(th).checkboxcell",cellClick);$(document).on("click","th.checkboxcell",headerRowCellClicked);$(function(){$("td .basket").on("click",function(){$(this).toggleClass("inbasket")})});$(".checkboxcell:not(.checked) input[type=checkbox]:checked").closest(".checkboxcell").addClass("checked");$(".checkboxcell:not(.disabled) input[type=checkbox]:disabled").closest(".checkboxcell").addClass("disabled")});__oldDoPostBack=null;$(function(){if(typeof __doPostBack!="undefined"){function n(n,t){try{return __oldDoPostBack(n,t)}catch(i){if(i.message.indexOf("Unspecified")==-1)throw i;}}__oldDoPostBack=__doPostBack;__doPostBack=n}});$(function(){var n=$("xml").length>0;n&&showDatabindingWarningIfUnsupported(0)})