function cpSimpleListLayoutEvents(_1){this.moduleData=_1;this.init=function(){var _2=this,_3=_2.moduleData.moduleContainer;_3.addEvents({"submit:relay(form)":function(_4){_4.preventDefault();_2.submitFiltersForm();}});if(this.moduleData.updateProducts){_3.addEvents({"click:relay(.cp-filter-link)":function(_5){_5.preventDefault();_2.processLinkClickEvent(this);},"click:relay(.cp-color-palette-element)":function(_6){_6.preventDefault();_2.processLinkClickEvent(this);},"click:relay(.cp-clearlink)":function(_7){_7.preventDefault();_2.processLinkClickEvent(this);},"click:relay(.cp-price-clear)":function(_8){_8.preventDefault();_2.processLinkClickEvent(this);}});}};this.processLinkClickEvent=function(_9){var _a=_9.getAttribute("href");cpUpdateResutsViaAjaxObj.updateResults(_a);};this.submitFiltersForm=function(){if(this.moduleData.updateProducts){var _b=this.getAppliedRefinementsURL();cpUpdateResutsViaAjaxObj.updateResults(_b);}else{var _c=this.moduleData.moduleContainer.getElements(".hidden-filter"),_d=this.moduleData.moduleContainer.getElement("form");_c.each(function(_e){if(_e.value==""){_e.destroy();}});var _f=_d["low-price"],_10=_d["high-price"];if(_f&&_f.value==""){_f.setProperty("disabled",true);}if(_10&&_10.value==""){_10.setProperty("disabled",true);}_d.submit();}};this.getAppliedRefinementsURL=function(){var url=this.moduleData.moduleContainer.getElement("#cp"+this.moduleData.moduleID+"_base_url").getAttribute("data-value"),_11=this.moduleData.moduleContainer.getElements(".hidden-filter"),_12=this.moduleData.moduleContainer.getElements(".hidden-static-filter"),_13=this.moduleData.moduleContainer.getElement("form"),_14=[],_15=_13["low-price"],_16=_13["high-price"];_11.each(function(_17){if(_17.value){_14.push(_17.name+"="+encodeURIComponent(_17.value));}});_12.each(function(_18){if(_18.value){_14.push(_18.name+"="+encodeURIComponent(_18.value));}});if(_15&&_15.value){_14.push("low-price="+_15.value);}if(_16&&_16.value){_14.push("high-price="+_16.value);}if(_14.length){var uri=new URI(url);var _19=uri.get("query");if(_19!=""){_19+="&";}_19+=_14.join("&");uri.set("query",_19);url=uri.toAbsolute();}return url;};this.processFilterSelectEvent=function(_1a,_1b){var _1c=this.moduleData.moduleContainer.getElement("#cp"+this.moduleData.moduleID+"_group_"+_1b);var _1d=_1c.getElements(".cp-filter-filter");var len=_1d.length;while(len--){if(_1d[len].textContent==_1a){var _1e=_1d[len].hasClass("selected");if(_1e){_1d[len].removeClass("selected");_1d[len].parentNode.firstChild.removeClass("selected");}else{_1d[len].addClass("selected");_1d[len].parentNode.firstChild.addClass("selected");}if(this.moduleData.updateProducts){this.processLinkClickEvent(_1d[len].parentNode);}else{_1d[len].parentNode.click();}return;}}var uri=new URI(location.href);var _1f=uri.get("query").split("&");var len=_1f.length;if(len){var _20=[];for(var i=0;i<len;++i){var _21=_1f[i].split("=");if(_21[0]==_1b){var _1e=decodeURIComponent(_21[1]).split("|");_1e.splice(_1e.indexOf(_1a),1);if(_1e.length){_20.push(_21[0]+"="+encodeURIComponent(_1e.join("|")));}}else{_20.push(_1f[i]);}}if(_20.length){uri.set("query",_20.join("&"));}else{uri.set("query","");}var _22=uri.toString();if(this.moduleData.updateProducts){cpUpdateResutsViaAjaxObj.updateResults(_22);}else{location.href=_22;}}};this.isFilterApplied=function(_23){if(!_23){return false;}var _24=this.moduleData.moduleContainer.getElements(".cp-filter-filter.selected");var len=_24.length;if(!len){return false;}while(len--){if(_24[len].textContent==_23){return true;}}return false;};};