function loadMiniBasket(a){$.ajax({url:"/pws/ssnMiniBasketCount.jsp",cache:false,success:function(b){$("div#miniBasket div#miniBasketCount p").html(b)}});$.ajax({url:"/pws/ssnMiniBasketProducts.jsp",cache:false,success:function(j){$("div#miniBasketCont").html(j);var i=false;var l=false;if(a||window.location.href.match("mbshow=true")){i=true}if(i){showMiniBasket();hideMiniBasket(3000)}$("div#miniBasket").hoverIntent(function(){showMiniBasket()},function(){});$("div#miniBasketCont").hover(function(){if(window.miniBasketTimerSet){clearTimeout(window.miniBasketTimer);window.miniBasketTimerSet=false}},function(){hideMiniBasket(1000)});var b=6;var e=$("ul#miniBasketProducts li");if(e.length>b){var f=(e.length/b);var g=Math.round(f);if(f>g){f=g+1}else{f=g}$("div#miniBasketProductsCont").before("<div id='bagPageNav'/>");$("div#bagPageNav").append("<a id='bagPageLinkPrev'><img src='/pws/images/msc_BasketLeftArrow.gif' width='7' /></a>");for(c=1;c<=f;c++){$("div#miniBasketProductsCont").append("<ul id='bagPage"+c+"' class='bagPage'/>");$("div#bagPageNav").append("<a class='bagPageLink' id='bagPageLink"+c+"'>"+c+"</a>");if(c%13==0){$("a#bagPageLink"+c).css("clear","left")}}$("div#bagPageNav").append("<a id='bagPageLinkNext'><img src='/pws/images/msc_BasketRightArrow.gif' width='7' /></a>");var k=0;$.each(e,function(o,p){if(o%b==0){k++}$("ul#bagPage"+k).append($(this))});$("ul#miniBasketProducts").remove();$("ul.bagPage").css("display","none");function h(n){$("a.bagPageLink").removeClass("selectedMiniBasketNav").css("color","#999");$("a#bagPageLink"+n).addClass("selectedMiniBasketNav").css("color","#000");$("ul.bagPage").css("display","none").removeClass("currentPage");$("ul#bagPage"+n).css("display","inline").addClass("currentPage")}h(1)}else{$("ul#miniBasketProducts").addClass("currentPage")}if($("ul#bagPage1").length>0){$("a.bagPageLink").hover(function(){if(!($(this).is(".selectedMiniBasketNav"))){$(this).css("color","#333")}else{$(this).css("color","#000")}},function(){if($(this).is(".selectedMiniBasketNav")){$(this).css("color","#000")}else{$(this).css("color","#999")}}).click(function(){var n=$(this).attr("id");n=n.replace("bagPageLink","");h(n)}).css("cursor","pointer");$("a#bagPageLinkPrev").click(function(){var n=$("ul.currentPage").attr("id");n=parseFloat(n.replace("bagPage",""))-1;if(n==0){n=f}h(n)}).css("cursor","pointer");$("a#bagPageLinkNext").click(function(){var n=$("ul.currentPage").attr("id");n=parseFloat(n.replace("bagPage",""))+1;if(n>f){n=1}h(n)}).css("cursor","pointer")}$("div#miniBasketDetail a.removeItem").click(function(){productId=$(this).attr("id").substring(6);$.get("/pws/UpdateBasket.ice",{Update:"Remove",ProductID:productId},function(){if($("table#shoppingBagTable").length>0){location.reload()}else{loadMiniBasket()}});return false});if(($.browser.msie)&&($.browser.version=="6.0")){var d=$("div#miniBasketCont").width();d=d+parseFloat($("div#miniBasketCont").css("paddingLeft"));d=d+parseFloat($("div#miniBasketCont").css("paddingRight"));var m=$("div#miniBasketCont").height();m+=parseFloat($("div#miniBasketCont").css("paddingBottom"));m+=parseFloat($("div#miniBasketCont").css("paddingTop"));$("div#miniBasketCont").prepend("<iframe src='/pws/blank.html' scrolling='no' id='ieSelectBlock' frameBorder='0'></iframe>");$("iframe#ieSelectBlock").css({display:"block",width:d+"px",height:m+"px",zIndex:"-10",position:"absolute",bottom:"0px",left:"0px",border:"0"})}}})}function showMiniBasket(){if($.browser.msie&&$.browser.version=="6.0"){$("div#mainCont").css("position","static")}if($.browser.msie){$("div#categoryRetainer").css("position","static");$("div#rightNav").css({position:"static","float":"left"});if($.browser.version=="7.0"){$("div#rightNav").css({marginTop:"-16px"})}else{$("div#rightNav").css({marginTop:"-33px",marginLeft:"-1px"})}}$("div#miniBasketCont").css("top",-$("div#miniBasketCont").height()+42).animate({top:44},800)}function hideMiniBasket(a){window.miniBasketTimer=setTimeout(function(){$("div#miniBasketCont").animate({top:-$(this).height()+42},200,function(){if($.browser.msie&&$("div#categoryRetainer").length>0){$("div#categoryRetainer").css("position","relative");$("div#rightNav").css({position:"absolute"});if($.browser.version=="7.0"){$("div#rightNav").css({marginTop:"0px"})}else{$("div#rightNav").css({marginTop:"0px",marginRight:"0px",marginLeft:"0px"})}}})},a);window.miniBasketTimerSet=true}(function(a){a.fn.hoverIntent=function(l,k){var m={sensitivity:5,interval:100,timeout:100};m=a.extend(m,k?{over:l,out:k}:l);var o,n,i,e;var h=function(f){o=f.pageX;n=f.pageY};var d=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(i-o)+Math.abs(e-n))<m.sensitivity){a(f).unbind("mousemove",h);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{i=o;e=n;f.hoverIntent_t=setTimeout(function(){d(g,f)},m.interval)}};var j=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(r){var q=(r.type=="mouseover"?r.fromElement:r.toElement)||r.relatedTarget;while(q&&q!=this){try{q=q.parentNode}catch(r){q=this}}if(q==this){return false}var g=jQuery.extend({},r);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(r.type=="mouseover"){i=g.pageX;e=g.pageY;a(f).bind("mousemove",h);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){d(g,f)},m.interval)}}else{a(f).unbind("mousemove",h);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){j(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);function handleRegionChange(){var a=$("select#currency").val();if(a){$("form#changeRegion").submit()}}$(document).ready(function(){$(".rollover").hover(function(){$(this).attr("src",$(this).attr("src").replace("_0","_1"))},function(){$(this).attr("src",$(this).attr("src").replace("_1","_0"))});if($.browser.msie){$("div#mainCont").removeClass("positionRelative")}else{$("div#pageCont").removeClass("positionRelative")}loadMiniBasket();$("input.clearValue").focus(function(){if(this.value==this.defaultValue){this.value=""}}).blur(function(){if(!this.value.length){this.value=this.defaultValue}});$("option#selectLabel").attr("value","");$(".sepWindowPopup").click(function(){window.open($(this).attr("href"),"mywindow","scrollbars=1,width=848,height=600");return false});$(".deliveryWindowPopup").click(function(){window.open($(this).attr("href"),"mywindow","scrollbars=1,width=400,height=300");return false});if($("select#countryIsoParam").length>0){var b="";$.each($("select#countryIsoParam option"),function(){if($(this).attr("selected")){b=$(this).attr("value")}});$.each($("select#countryIsoParam option"),function(){if($(this).attr("value")==b){$(this).attr("selected","selected")}});$("select#countryIsoParam").change(function(){$("select#countryIsoParam option:selected").html();cmCreatePageElementTag("Country: "+$("select#countryIsoParam option:selected").html(),"Change Country","","","","-_--_--_--_--_--_--_--_--_--_--_-");$(this).parents("form").submit()})}$("a.cmExternal").click(function(){cmCreatePageElementTag($(this).html(),"External Links","","","","-_--_--_--_--_--_--_--_--_--_--_-")});if($.cookie("country_iso")){var a=$.cookie("country_iso")}else{var a=countryCodeFromApp}$("select#countryIsoParam option[value="+a+"]").attr("selected",true);$("select#countryIsoParam").before('<img src="/pws/images/img_CountryFlag_'+a+'.gif" id="imgCountryFlag" />');$("select#countryIsoParam option[value="+a+"]").attr("selected",true)});
