$(document).ready(function(){$(".wishlistlayout li#nav_jewellery_wishlist a").addClass("selectedNav");$("img#closePopup").click(function(){hidePopUp()});var c=$.cookie("annoushka_wishlist");if(!c===null||!c==""){var b=c.split(",");var a=0;$(b).each(function(g,m){var f=m.split(":")[0];var l=m.split(":")[1];if(f!=null&&l!=null){var j='width="178px" height="178px"';var h="medium";if(a==0){j='width="350px" height="350px"';h="xlarge"}if($("div.jewelleryWishlistProduct:eq("+a+")").length){k=$("div.jewelleryWishlistProduct:eq("+a+")")}else{$("div#jewelleryWishlistProducts").append('<div class="jewelleryWishlistProduct"></div>');var k=$("div.jewelleryWishlistProduct:last")}k.attr("id","prod_"+m).addClass("populated").html("<img "+j+' src="/pws/client/images/catalogue/products/'+l+"/"+h+"/"+l+'_1.jpg" />');a++}});var e=5-(($("div.jewelleryWishlistProduct").length)-8)%5;if(e<5){var d=0;do{$("div#jewelleryWishlistProducts").append('<div class="jewelleryWishlistProduct"></div>');d++}while(d<e)}$("div.populated").hoverIntent(function(){$("div.currentProduct",$("div#jewelleryWishlistProducts")).hide().removeClass("currentProduct");var h=$(this);var i=h.attr("id").replace("prod_","").split(":")[0];if(!h.find("div.productInfo").length){h.append('<div class="productInfo"></div>');var g=true}var f=h.find("div.productInfo");if(g){h.append('<img src="/pws/images/ajax_wishlistLoading.gif" alt="Loading..." class="wishlistLoading" />');$.ajax({url:"/pws/AJProductDetails.ice?layout=wishlist.product.layout&ProductID="+i,success:function(j){f.html(j).show().addClass("currentProduct");h.find("img.wishlistLoading").remove();jwPopupInfoSifr();linkActions(f);formAction(f)},error:function(j,l,k){f.html('This product is out of stock.<br /><img id="remove_'+h.attr("id").replace("prod_","").split(":")[0]+"_"+h.attr("id").replace("prod_","").split(":")[1]+'" class="removeItem" alt="Remove Item" src="/pws/images/btn_RemoveItem.gif"/>').show().addClass("currentProduct");h.find("img.wishlistLoading").remove();linkActions(f)}})}else{f.show().addClass("currentProduct")}},function(){if(!$("div.currentProduct",$("div#jewelleryWishlistProducts")).is(".stillInteracting")){$("div.currentProduct",$("div#jewelleryWishlistProducts")).hide().removeClass("currentProduct")}})}});function linkActions(a){a.find("img.fullDetails").click(function(){window.location="/fcp/product////"+$(this).attr("id").replace("fulldetails_","")});a.find("img.removeItem").click(function(){var b=$.cookie("annoushka_wishlist");var e=$(this).attr("id").replace("remove_","").replace("_",":");var c=b.split(e);var d=c[0]+c[1];d=d.replace(",,",",");if(d.charAt(d.length-1,1)==","){d=d.substring(0,d.length-1)}if(d.charAt(0,1)==","){d=d.substring(1)}$.cookie("annoushka_wishlist",d,{expires:31,path:"/"});$(this).parents("div.jewelleryWishlistProduct").unbind().empty()});if($.browser.msie){a.find("select.selectQuantity, select.selectSize").click(function(){var b=$(this);if(!b.is(".active")){a.find("select.selectQuantity, select.selectSize").removeClass("active");b.addClass("active");a.addClass("stillInteracting")}else{b.removeClass("active");a.removeClass("stillInteracting")}})}}function formAction(a){a.find("form").ajaxForm({beforeSubmit:function(){a.find("input.submit").attr("src","/pws/images/btn_Purchasing.gif").attr("disabled",true)},success:function(d,f){var c=d.slice(d.indexOf('<p id="basketResponse">')+23);c=c.slice(0,c.indexOf("</p>"));var b=0;if(a.parents("div.jewelleryWishlistProduct").is(".firstRow")){b=100}$("div#addedToBasketContent").html('<h3 class="sifrGold">'+c+"</h3>").parent("div").css("top",a.parents("div.jewelleryWishlistProduct").position().top+b).show();jwPopupAddedSifr();$("div#jewelleryWishlistProducts").block();a.find("input.submit").attr("src","/pws/images/btn_Purchase.gif").attr("disabled",false);loadMiniBasket()},error:function(c,d,b){}})}function jwPopupInfoSifr(){if(typeof sIFR=="function"){sIFR.replaceElement(named({sSelector:".currentProduct .sifrGold",sFlashSrc:"/pws/flash/monotype.swf",sWmode:"transparent",sColor:"#938362"}))}}function jwPopupAddedSifr(){if(typeof sIFR=="function"){sIFR.replaceElement(named({sSelector:"div#addedToBasketContent .sifrGold",sFlashSrc:"/pws/flash/monotype.swf",sWmode:"transparent",sColor:"#938362"}))}}function hidePopUp(){$("div#addedToBasket").hide();$("div#jewelleryWishlistProducts").unblock()};