function lastCategory(a){$.cookie("lastCategory",a,{expires:31,path:"/"})}function select_size(){$("#overlayContent").find(".quickBuySelectSize").each(function(){var a=$(this);if(a.children("input:checked").length>0){a.addClass("selected")}a.click(function(){if($("#overlayContent").find(".quickBuySize").hasClass("error")){$("#overlayContent").find(".quickBuySize").removeClass("error")}$(".quickBuySelectSize").removeClass("selected");$(this).addClass("selected");$("input",$(this)).attr("checked","checked")})})}function productHover(){var a=$(".productCont","#productsCont");a.find(".buyNow").click(function(c){var b=$(this).attr("id").split("_")[1];c.preventDefault();initPopupOverlay(b)});a.hoverIntent(function(){var b=$(this).find(".productDetailsCont");b.find(".wasPrice").fadeOut(300);b.animate({height:"52px"});b.find(".buyNowButton").fadeIn()},function(){var b=$(this).find(".productDetailsCont");b.find(".buyNowButton").fadeOut();b.animate({height:"25px"});b.find(".wasPrice").fadeIn(300)})}function initPopupOverlay(e){var c='<div id="buyNowLoading"><img src="/pws/images/ajax-loader-quickbuy.gif" alt="Loading..." /></div><div id="overlayBackground"></div><div id="buyNowContainer"><div id="closeOverlay"></div><div id="overlayContent"></div></div>';$("#pageCont").append(c);var d=$(document).height()+"px",h=$("#header").outerHeight()+"px",g=$("#overlayBackground"),b=$("#buyNowLoading"),f=$("#buyNowContainer"),a="/pws/AJProductDetails.ice?layout=product.pop.layout&ProductID="+e+"&tabInfo=true";centerContent(b);centerContent(f);g.css({height:d,top:h}).fadeTo(200,0.6);$.ajax({url:a,type:"GET",success:function(i){$(i).appendTo("#overlayContent");f.show();select_size();$("#quickBuyAddToBag").click(function(m){m.preventDefault();var k="";if($("#overlayContent").find(".quickBuySelectSize").hasClass("selected")){var k=$("#overlayContent").find(".quickBuySelectSize.selected").attr("id");var k=k.split("_");var k=k[1]}var l=1;if($("#quickBuyQuantity").val()!==""){var l=$("#quickBuyQuantity").val()}var j="/pws/UpdateBasket.ice?Update=AddQuantity&ProductID="+k+"&quantity="+l;if(k==""){$("#overlayContent").find(".quickBuySize").addClass("error")}else{b.css("z-index","20");$.ajax({url:j,type:"GET",success:function(n){loadMiniBasket(true);removeOverlay()},error:function(o,q,p){var n='<p class="quickBuyError">An error has occurred. This product is no longer in stock.</p>';$(n).html("#overlayContent")}})}});$("#quickBuyCheckout").click(function(j){var k="";if($("#overlayContent").find(".quickBuySelectSize").hasClass("selected")){var k=$("#overlayContent").find(".quickBuySelectSize.selected").attr("id");var k=k.split("_");var k=k[1]}if(k==""){j.preventDefault();$("#overlayContent").find(".quickBuySize").addClass("error")}})},error:function(){var i='<p class="quickBuyError">An error has occured. Please close this window and try again.</p>';$(i).appendTo("#overlayContent")}});$("#overlayBackground, #closeOverlay, #closeButton").click(function(){removeOverlay()})}function removeOverlay(){$("#overlayBackground, #buyNowContainer, #closeOverlay, #buyNowLoading").animate({opacity:"0"},200,"linear",function(){$("#overlayBackground, #buyNowContainer, #closeOverlay, #buyNowLoading").remove()})}function centerContent(b){if(!$("html").hasClass("ie6")){b.css({position:"fixed",top:"50%",left:"50%"}).css({"margin-left":"-"+(b.outerWidth()/2)+"px","margin-top":"-"+(b.outerHeight()/2)+"px"})}else{var a=$(window).scrollTop();b.css({position:"absolute",top:($(window).outerHeight()/2+a)+"px",left:($(window).outerWidth()/2)+"px"}).css({"margin-left":"-"+(b.outerWidth()/2)+"px","margin-top":"-"+(b.outerHeight()/2)+"px"})}}$(document).ready(function(){$("#leftNavCategoriesLevel1").addClass("filterOptions");var a=$(".filterTitle","#leftNavCont");a.click(function(){var b=$(this).parent(".filterGroup");var c=$(this).siblings(".filterOptions");b.hasClass("open")?(c.hide(),b.toggleClass("open")):(c.show(),b.toggleClass("open"))});productHover();$("#viewingFormat a").click(function(){var b=$(this);$.cookie("view_format",b.attr("id"),{expires:31,path:"/"});window.location.reload();return false});cookieRequest=$.cookie("view_format");if(cookieRequest!=""&&cookieRequest!==null){$("#"+cookieRequest).addClass("current")}else{if(cookieRequest==null){$("#view_4").addClass("current")}}});
