var EasyAutocomplete=function(n){return n.Configuration=function(n){function u(){var f,i,e,r,u;if(n.dataType==="xml"&&(n.getValue||(n.getValue=function(n){return $(n).text()}),n.list||(n.list={}),n.list.sort||(n.list.sort={}),n.list.sort.method=function(t,i){return(t=n.getValue(t),i=n.getValue(i),ti?1:0},n.list.match||(n.list.match={}),n.list.match.method=function(n,t){return n.search(t)>-1?!0:!1}),n.categories!==undefined&&n.categories instanceof Array){for(f=[],i=0,e=n.categories.length;ii?1:0}},maxNumberOfElements:6,hideOnEmptyPhrase:!0,match:{enabled:!1,caseSensitive:!1,method:function(n,t){return n.search(t)>-1?!0:!1}},showAnimation:{type:"normal",time:400,callback:function(){}},hideAnimation:{type:"normal",time:400,callback:function(){}},onClickEvent:function(){},onSelectItemEvent:function(){},onLoadEvent:function(){},onChooseEvent:function(){},onKeyEnterEvent:function(){},onMouseOverEvent:function(){},onMouseOutEvent:function(){},onShowListEvent:function(){},onHideListEvent:function(){}},highlightPhrase:!0,theme:"",cssClasses:"",minCharNumber:0,requestDelay:0,adjustWidth:!0,ajaxSettings:{},preparePostData:function(n){return n},loggerEnabled:!0,template:"",categoriesAssigned:!1,categories:[{maxNumberOfElements:4}]},r=["ajaxSettings","template"];this.get=function(n){return t[n]};this.equals=function(n,i){return s(n)&&t[n]===i?!0:!1};this.checkDataUrlProperties=function(){return t.url==="list-required"&&t.data==="list-required"?!1:!0};this.checkRequiredProperties=function(){for(var n in t)if(t[n]==="required")return logger.error("Option "+n+" must be defined"),!1;return!0};this.printPropertiesThatDoesntExist=function(n,t){i(n,t)};u();f();t.loggerEnabled===!0&&i(console,n);o();e()},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.Logger=function(){this.error=function(n){console.log("ERROR: "+n)};this.warning=function(n){console.log("WARNING: "+n)}},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.Constans=function(){var n={CONTAINER_CLASS:"easy-autocomplete-container",CONTAINER_ID:"eac-container-",WRAPPER_CSS_CLASS:"easy-autocomplete"};this.getValue=function(t){return n[t]}},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.ListBuilderService=function(n,t){function i(t,i){function f(){var u={},r;return t.xmlElementName!==undefined&&(u.xmlElementName=t.xmlElementName),t.listLocation!==undefined?r=t.listLocation:n.get("listLocation")!==undefined&&(r=n.get("listLocation")),r!==undefined?typeof r=="string"?u.data=$(i).find(r):typeof r=="function"&&(u.data=r(i)):u.data=i,u}function e(){var n={};return t.listLocation!==undefined?typeof t.listLocation=="string"?n.data=i[t.listLocation]:typeof t.listLocation=="function"&&(n.data=t.listLocation(i)):n.data=i,n}var r={},u;return r=n.get("dataType").toUpperCase()==="XML"?f():e(),t.header!==undefined&&(r.header=t.header),t.maxNumberOfElements!==undefined&&(r.maxNumberOfElements=t.maxNumberOfElements),n.get("list").maxNumberOfElements!==undefined&&(r.maxListSize=n.get("list").maxNumberOfElements),t.getValue!==undefined?typeof t.getValue=="string"?(u=t.getValue,r.getValue=function(n){return n[u]}):typeof t.getValue=="function"&&(r.getValue=t.getValue):r.getValue=n.get("getValue"),r}function r(t){var i=[];return t.xmlElementName===undefined&&(t.xmlElementName=n.get("xmlElementName")),$(t.data).find(t.xmlElementName).each(function(){i.push(this)}),i}this.init=function(t){var r=[],i={};return i.data=n.get("listLocation")(t),i.getValue=n.get("getValue"),i.maxListSize=n.get("list").maxNumberOfElements,r.push(i),r};this.updateCategories=function(t,r){var u,f;if(n.get("categoriesAssigned"))for(t=[],u=0;u0)return!0;return!1}},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.proccess=function(t,i,r){function o(n,i){var u=[],e="",r,o;if(t.get("list").match.enabled)for(r=0,o=n.length;ri.maxNumberOfElements&&(n=n.slice(0,i.maxNumberOfElements)),n}function h(n){return t.get("list").sort.enabled&&n.sort(t.get("list").sort.method),n}n.proccess.match=f;var u=i.data,e=r;return u=o(u,e),u=s(u),h(u)},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.Template=function(n){var t={basic:{type:"basic",method:function(n){return n},cssClass:""},description:{type:"description",fields:{description:"description"},method:function(n){return n+" - description"},cssClass:"eac-description"},iconLeft:{type:"iconLeft",fields:{icon:""},method:function(n){return n},cssClass:"eac-icon-left"},iconRight:{type:"iconRight",fields:{iconSrc:""},method:function(n){return n},cssClass:"eac-icon-right"},links:{type:"links",fields:{link:""},method:function(n){return n},cssClass:""},custom:{type:"custom",method:function(){},cssClass:""}},i=function(n){var i=n.fields,r;return n.type==="description"?(r=t.description.method,typeof i.description=="string"?r=function(n,t){return n+" - "+t[i.description]+"<\/span>"}:typeof i.description=="function"&&(r=function(n,t){return n+" - "+i.description(t)+"<\/span>"}),r):n.type==="iconRight"?(typeof i.iconSrc=="string"?r=function(n,t){return n+""}:typeof i.iconSrc=="function"&&(r=function(n,t){return n+""}),r):n.type==="iconLeft"?(typeof i.iconSrc=="string"?r=function(n,t){return""+n}:typeof i.iconSrc=="function"&&(r=function(n,t){return""+n}),r):n.type==="links"?(typeof i.link=="string"?r=function(n,t){return""+n+"<\/a>"}:typeof i.link=="function"&&(r=function(n,t){return""+n+"<\/a>"}),r):n.type==="custom"?n.method:t.basic.method},r=function(n){return!n||!n.type?t.basic.method:n.type&&t[n.type]?i(n):t.basic.method},u=function(n){var i=function(){return""};return!n||!n.type?i:n.type&&t[n.type]?function(){var i=t[n.type].cssClass;return function(){return i}}():i};this.getTemplateClass=u(n);this.build=r(n)},n}(EasyAutocomplete||{}),EasyAutocomplete=function(n){return n.main=function(t,i){function g(){if(u.length===0){a.error("Input field doesn't exist.");return}if(!r.checkDataUrlProperties()){a.error("One of options variables 'data' or 'url' must be defined.");return}if(!r.checkRequiredProperties()){a.error("Will not work without mentioned properties.");return}w();nt()}function w(){function n(){var i=$("
"),n=s.getValue("WRAPPER_CSS_CLASS");r.get("theme")&&r.get("theme")!==""&&(n+=" eac-"+r.get("theme"));r.get("cssClasses")&&r.get("cssClasses")!==""&&(n+=" "+r.get("cssClasses"));v.getTemplateClass()!==""&&(n+=" "+v.getTemplateClass());i.addClass(n);u.wrap(i);r.get("adjustWidth")===!0&&t()}function t(){var n=u.outerWidth();u.parent().css("width",n)}function i(){u.unwrap()}function o(){var n=$("
").addClass(s.getValue("CONTAINER_CLASS"));n.attr("id",b()).prepend($("
    ")),function(){n.on("show.eac",function(){var t,i;switch(r.get("list").showAnimation.type){case"slide":t=r.get("list").showAnimation.time;i=r.get("list").showAnimation.callback;n.find("ul").slideDown(t,i);break;case"fade":t=r.get("list").showAnimation.time;i=r.get("list").showAnimation.callback;n.find("ul").fadeIn(t);i;break;default:n.find("ul").show()}r.get("list").onShowListEvent()}).on("hide.eac",function(){var t,i;switch(r.get("list").hideAnimation.type){case"slide":t=r.get("list").hideAnimation.time;i=r.get("list").hideAnimation.callback;n.find("ul").slideUp(t,i);break;case"fade":t=r.get("list").hideAnimation.time;i=r.get("list").hideAnimation.callback;n.find("ul").fadeOut(t,i);break;default:n.find("ul").hide()}r.get("list").onHideListEvent()}).on("selectElement.eac",function(){n.find("ul li").removeClass("selected");n.find("ul li").eq(f).addClass("selected");r.get("list").onSelectItemEvent()}).on("loadElements.eac",function(t,i,o){var w="",y=n.find("ul"),p,s,b,h,c,k;for(y.empty().detach(),e=[],p=0,s=0,b=i.length;s0&&y.append("
    "+i[s].header+"<\/div>"),c=0,k=h.length;c
    <\/div><\/li>"),function(){var t=c,n=p,e=i[s].getValue(h[t]);w.find(" > div").on("click",function(){u.val(e).trigger("change");f=n;l(n);r.get("list").onClickEvent();r.get("list").onChooseEvent()}).mouseover(function(){f=n;l(n);r.get("list").onMouseOverEvent()}).mouseout(function(){r.get("list").onMouseOutEvent()}).html(v.build(a(e,o),h[t]))}(),y.append(w),e.push(h[c]),p+=1;n.append(y);r.get("list").onLoadEvent()})}();u.after(n)}function c(){u.next("."+s.getValue("CONTAINER_CLASS")).remove()}function a(n,t){return r.get("highlightPhrase")&&t!==""?p(n,t):n}function y(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function p(n,t){var i=y(t);return(n+"").replace(new RegExp("("+i+")","gi"),"$1<\/b>")}u.parent().hasClass(s.getValue("WRAPPER_CSS_CLASS"))&&(c(),i());n();o();h=$("#"+b());r.get("placeholder")&&u.attr("placeholder",r.get("placeholder"))}function b(){var n=u.attr("id");return s.getValue("CONTAINER_ID")+n}function nt(){function n(){d("autocompleteOff",!0)&&b();t();i();s();h();v();w()}function t(){u.focusout(function(){var i=u.val(),t,n,o;for(r.get("list").match.caseSensitive||(i=i.toLowerCase()),n=0,o=e.length;n0?p():c()),t=e(),(t.url===undefined||t.url==="")&&(t.url=r.get("url")),(t.dataType===undefined||t.dataType==="")&&(t.dataType=r.get("dataType")),t.url!==undefined&&t.url!=="list-required"&&(t.url=t.url(n),t.data=r.get("preparePostData")(t.data,n),$.ajax(t).done(function(t){var i=o.init(t);i=o.updateCategories(i,t);i=o.convertXml(i);s(n,t)&&(i=o.processData(i,n),k(i,n));o.checkIfDataExists(i)&&u.parent().find("li").length>0?p():c();r.get("ajaxCallback")()}).fail(function(){a.warning("Fail to load response data")}).always(function(){})))}switch(n.keyCode){case 27:c();tt();break;case 38:n.preventDefault();e.length>0&&f>0&&(f-=1,u.val(r.get("getValue")(e[f])),l(f));break;case 40:n.preventDefault();e.length>0&&f40||n.keyCode===8){var t=u.val();r.get("list").hideOnEmptyPhrase===!0&&n.keyCode===8&&t===""?c():r.get("requestDelay")>0?(y!==undefined&&clearTimeout(y),y=setTimeout(function(){i(t)},r.get("requestDelay"))):i(t)}}})}function s(){u.on("keydown",function(n){n=n||window.event;var t=n.keyCode;if(t===38)return suppressKeypress=!0,!1}).keydown(function(n){n.keyCode===13&&f>-1&&(u.val(r.get("getValue")(e[f])),r.get("list").onKeyEnterEvent(),r.get("list").onChooseEvent(),f=-1,c(),n.preventDefault())})}function h(){u.off("keypress")}function v(){u.focus(function(){u.val()!==""&&e.length>0&&(f=-1,p())})}function w(){u.blur(function(){setTimeout(function(){f=-1;c()},250)})}function b(){u.attr("autocomplete","off")}n()}function p(){h.trigger("show.eac")}function c(){h.trigger("hide.eac")}function l(n){h.trigger("selectElement.eac",n)}function k(n,t){h.trigger("loadElements.eac",[n,t])}function tt(){u.trigger("blur")}var s=new n.Constans,r=new n.Configuration(i),a=new n.Logger,v=new n.Template(i.template),o=new n.ListBuilderService(r,n.proccess),d=r.equals,u=t,h="",e=[],f=-1,y;n.consts=s;this.getConstants=function(){return s};this.getConfiguration=function(){return r};this.getContainer=function(){return h};this.getSelectedItemIndex=function(){return f};this.getItems=function(){return e};this.getItemData=function(n){return e.length0?!0:!1},n.assignRandomId=function(t){var i="";do i="eac-"+Math.floor(Math.random()*1e4);while($("#"+i).length!==0);elementId=n.consts.getValue("CONTAINER_ID")+i;$(t).attr("id",i)},n.setHandle=function(t,i){n.eacHandles[i]=t},n}(EasyAutocomplete||{}),果冻影院;(function(n){n.fn.easyAutocomplete=function(t){return this.each(function(){var i=n(this),r=new EasyAutocomplete.main(i,t);EasyAutocomplete.inputHasId(i)||EasyAutocomplete.assignRandomId(i);r.init();EasyAutocomplete.setHandle(r,i.attr("id"))})};n.fn.getSelectedItemIndex=function(){var t=n(this).attr("id");return t!==undefined?EasyAutocomplete.getHandle(t).getSelectedItemIndex():-1};n.fn.getItems=function(){var t=n(this).attr("id");return t!==undefined?EasyAutocomplete.getHandle(t).getItems():-1};n.fn.getItemData=function(t){var i=n(this).attr("id");return i!==undefined&&t>-1?EasyAutocomplete.getHandle(i).getItemData(t):-1};n.fn.getSelectedItemData=function(){var t=n(this).attr("id");return t!==undefined?EasyAutocomplete.getHandle(t).getSelectedItemData():-1}})(jQuery);果冻影院=果冻影院||{},function(n){果冻影院.DepartmentBrowsing={init:function(){var t={getValue:"Title",list:{maxNumberOfElements:8,match:{enabled:!0},showAnimation:{type:"slide",time:300},hideAnimation:{type:"slide",time:300}},template:{type:"links",fields:{link:"Url"}}};Object.defineProperty(t,"data",{get:function(){return JSON.parse(n("#ac-department-data").val())}});n("#search-depts").easyAutocomplete(t)}};果冻影院.FauxTabs={init:function(t){var i=n(t),r=果冻影院.FauxTabs;if(i.length>0)r.bind(i),r.activate(i);else return!1},bind:function(t){var i=果冻影院.FauxTabs;t.each(function(){var t=n(this),r=n(this).parent("li").siblings("li").children("a"),u=n(t.attr("href")),f=n(r.attr("href"));t.on("click",function(n){n.preventDefault();n.stopPropagation();t.hasClass("-active")||i.showPane(t,u,r,f)})})},showPane:function(n,t,i,r){r.fadeOut(300,function(){i.removeClass("-active").addClass("-inactive").parent("li").removeClass("-active");r.removeClass("-active").addClass("-inactive");t.fadeIn(300,function(){n.addClass("-active").removeClass("-inactive").parent("li").addClass("-active");t.addClass("-active").removeClass("-inactive")})})},activate:function(t){var i=n(t[0]),u=n(i.attr("href")),r=n(t[1]),f=n(r.attr("href"));i.addClass("-active").parent("li").addClass("-active");u.addClass("-active");r.addClass("-inactive");f.addClass("-inactive")}};果冻影院.SearchResize={init:function(t){var i=n(t),r=i.find(".easy-autocomplete");n(window).smartresize(function(){var n=i.width(),t=r.width();n!=t&&r.width(n)})}};果冻影院.DepartmentBrowsing.init();果冻影院.SearchResize.init(".js-hero__search");果冻影院.FauxTabs.init(".js-local-navigation__link")}(jQuery)