$j(function(){$j("#definition-style-hide").click(function(e){$j("#definition-style").slideUp("slow");$j(this).hide();$j("#definition-style-show").show();
});$j("#definition-style-show").click(function(e){$j("#definition-style").slideDown("slow");$j(this).hide();$j("#definition-style-hide").show();
});var token;var brandPropertyType=0;var count=0;var today=new Date();var startNewDate=new Date();startNewDate.setDate(today.getDate()-30);$j("#product-list li").each(function(){if(++count%5==0){$j(this).addClass("last");
}});$j("li.last:not(:last-child)").after('<li class="product-list-divider"></li>');count=0;for(var id in window.productData.propertyTypes){var pt=window.productData.propertyTypes[id];
if(pt.key=="Brand"){brandPropertyType=id;}}var brandNames={};var brandCount=0;for(var id in window.productData.properties){var prop=window.productData.properties[id];
if(brandPropertyType==prop["type"]){brandNames[id]=prop["val"];brandCount++;}}var config={sorting:$j("#sort-result"),properties:$j("#property-container li.property"),paging:{gui:{container:".paging",prev:".previous-page",next:".next-page",currentPage:".current",totalPages:".total"},whitespaceAfterPage:true,totalPages:Panagora.filterJsData.totalPages,currentPage:Panagora.filterJsData.currentPage,urlTemplate:Panagora.filterJsData.urlTemplate,onFirstPage:function(){$j(".paging .previous-container").hide();
},onNotFirstPage:function(){$j(".paging .previous-container").show();},onLastPage:function(){$j(".paging .next-container").hide();},onNotLastPage:function(){$j(".paging .next-container").show();
},onPostNextPage:function(e){if($j("a.next-page").get(1)==e.target){var firstItem=$j("#product-list .product:eq(0)");var newLeft=firstItem.offset().left-firstItem.css("margin-left").replace(/[^\d]/g,"");
if($j(window).scrollLeft()>newLeft){$j(window).scrollLeft(newLeft);}$j(window).scrollTop($j("#page-container").offset().top);}}},onPreAppendItem:function(element,item){if(++count%5==0){element.addClass("last");
}var brandName="";if(item.sortd<today&&item.sortd>startNewDate){element.append('<a class="new-product" href="'+$j(".plink",element).attr("href")+'"></a>');
}for(var propertyId in item.props){var p=window.productData.properties[propertyId];if(p&&p.type==brandPropertyType){brandName=p.val;break;}else{brandName=window.defaultBrand;
}}$j("h4 a",element).text(brandName);$j("img",element).attr("alt",brandName+" "+item.name);return element;},productTemplate:{container:$j("#product-list"),element:".product",link:".plink",image:".primary",imageSize:"medium",name:".name",price:".price-container",priceTemplate:'<span class="price">{lowestPrice}</span>',varyingPriceTemplate:Panagora.filterJsData.varyingPriceTemplate,saleTemplate:'<del class="sale">{originalLowestPrice}</del><span class="sale">{lowestPrice}</span>',varyingPriceSaleTemplate:Panagora.filterJsData.varyingPriceSaleTemplate},onPostApplyFilter:function(items){$j(".totalitems").text(items.length);
},onPostRenderItems:function(){count=0;$j("li.last:not(:last-child)").after('<li class="product-list-divider"></li>');}};if(brandCount>1){Panagora.PropertyMachine.setSortFunction("b",function(a,b){var p1=window.productData.products[a];
var p2=window.productData.products[b];var b1,b2;for(var pid in p1.props){if(brandNames[pid]){b1=brandNames[pid];break;}}for(var pid in p2.props){if(brandNames[pid]){b2=brandNames[pid];
break;}}if(b1>b2){return 1;}else{if(b1<b2){return -1;}}return Panagora.PropertyMachine.sortFunctions.a(a,b);});}else{$j("#sort-result option[value=b]").remove();
}Panagora.PropertyMachine.init(config);$j("#property-container").show();});
