viewHandler=WishList;function WishList(){var a=this;this.wishlistThumbnailsTooltips=[];this.notificationTimeout=null;this.init=function(){this.base.init.call(this);this.initUrlHash();this.initLinkAnimation();this._addAnimationId(document.getElementById("wishlistNotifications"));this._precacheImages([this._imagesBaseUrl+"global-elements-processing-grey.gif"]);this.initTooltips();if(!!document.getElementById("wishlistThumbnailsEmpty")==true){document.getElementById("wishlistThumbnailsEmpty").className="listEmpty"}setTimeout("xhtml.precacheWishListImages();",1500)};this.initLinkAnimation=function(){this._addLinkAnimation(document.getElementById("wishlistHeader").getElementsByTagName("a"),this.colours.lightBlue,this.colours.darkBlue);this._addLinkAnimation(YAHOO.util.Dom.getElementsByClassName("details","div",document.getElementById("wishlistThumbnailsArtboard")),this.colours.lightBlue,this.colours.darkBlue);this._addLinkAnimation(document.getElementById("wishlistThumbnailsArtboard").getElementsByTagName("a"),this.colours.lightBlue,this.colours.darkBlue)};this.initUrlHash=function(){var e="None";var f=this._isWishListId(xhtml.cookie.get("wishlistid"));var g=this._isWishListId(window.location.hash);if(g!=null&&f!=null){if(g==f){document.getElementById("wishlistNumber").innerHTML=f}else{this.cookie.set("wishlistid",g);window.location="#"+g;window.location.reload()}return}if(f!=null){window.location="#"+f;document.getElementById("wishlistNumber").innerHTML=f;return}if(g!=null){this.cookie.set("wishlistid",g);window.location="#"+g;window.location.reload();return}document.getElementById("wishlistNumber").innerHTML="None"};this.initTooltips=function(){var f=YAHOO.util.Dom.getElementsByClassName("view","a",document.getElementById("wishlistThumbnailsArtboard"));for(var e=0,i,h,g;e<f.length;e++){h=YAHOO.util.Dom.getElementsByClassName("productName","span",f[e])[0].innerHTML;g=YAHOO.util.Dom.getElementsByClassName("productOptions","span",f[e])[0].innerHTML;var i='<div class="wishlist"><b>'+h+"</b><br/>"+g+"</div>";this.wishlistThumbnailsTooltips[e]=new YAHOO.widget.Tooltip("wishlistItemTooltip"+e,{context:f[e].getElementsByTagName("img")[0],text:i,preventoverlap:true,showDelay:500,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2}})}};this.layerHeaderCurrent=function(){document.getElementById("wishlistHeaderCurrent").className="";document.getElementById("wishlistHeaderLoad").className="invisible"};this.layerHeaderLoad=function(){document.getElementById("wishlistHeaderLoad").getElementsByTagName("input")[1].className=document.getElementById("wishlistHeaderLoad").getElementsByTagName("input")[1].className.replace(/Active/g,"");document.getElementById("wishlistHeaderLoad").getElementsByTagName("input")[1].value="";document.getElementById("wishlistHeaderCurrent").className="invisible";document.getElementById("wishlistHeaderLoad").className=""};this.changeWishList=function(){var e=document.getElementById("wishlistHeaderLoad").getElementsByTagName("input")[1].value;if(e.trim().length==0){alert("Please enter a wish list number to load.");return}if(this._isWishListId(e)==null){if(e.substring(0,2).toUpperCase()=="WL"&&e.replace(/\D/g,"").length==13){alert("Sorry, this appears to be a wish list number for our old site.\n\nUnfortunately these cannot be used with the new wish list system,\nour apologizes for the inconvenience.")}else{alert("The Wish List number entered does not appear to be valid.\nPlease check the number and try again.")}return}this.cookie.set("wishlistid",this._isWishListId(e));window.location="#"+this._isWishListId(e);window.location.reload()};this.cartAdd=function(h){if(!!h.id==false){h.id="wishlistitem"+new Date().getTime()}var f=YAHOO.util.Dom.getElementsByClassName("productAdd","span",h)[0].innerHTML.replace(/\&amp;/g,"&");f+="&callbackid="+h.id;document.getElementById("headerCart").className="loading";if(!!document.getElementById("wishlistBodyProcessing")==true){document.getElementById("wishlistBodyProcessing").parentNode.removeChild(document.getElementById("wishlistBodyProcessing"))}var g=document.createElement("div");g.id="wishlistBodyProcessing";g.className="processingOverlay";g.innerHTML='<img src="/images/global-elements-processing-grey.gif" width="16" height="16" alt=""/>';h.appendChild(g);YAHOO.util.Connect.asyncRequest("GET",this._getAjaxUrl({params:f}),{success:d,failure:function(){alert("Sorry, the server didn't respond in a timely manner...\nThis can happen occasionally, please try adding to your cart again.");document.getElementById("headerCart").className="";if(document.getElementById("wishlistBodyProcessing")){document.getElementById("wishlistBodyProcessing").parentNode.removeChild(document.getElementById("wishlistBodyProcessing"))}}});var e=YAHOO.util.Dom.getElementsByClassName("productCode","span",h)[0].innerHTML;this._googleAnalyticsTrackEvent("wishlist","addCart",e)};this.cartItemAdded=function(f){var e=[];e.push('<h1><img src="'+this._imagesBaseUrl+'global-elements-heading-itemaddedcart.png" width="299" height="17" alt=""/></h1>');e.push('<img class="photo" src="'+f.getElementsByTagName("img")[0].src.replace("fullsize","notification")+'" width="50" height="65" alt=""/>');e.push('<div class="details">');e.push("<h3>"+YAHOO.util.Dom.getElementsByClassName("productName","span",f)[0].innerHTML+"</h3>");e.push("<p>"+YAHOO.util.Dom.getElementsByClassName("productOptions","span",f)[0].innerHTML+"</p>");e.push("<p>"+YAHOO.util.Dom.getElementsByClassName("productPrice","span",f)[0].innerHTML+"</p>");e.push("</div>");e.push('<a class="cart" href="shoppingcart.html"></a>');this.notificationOpen(e.join("\n"),document.getElementById("headerCart"))};this.removeItem=function(h){var g=YAHOO.util.Dom.getElementsByClassName("itemId","span",h)[0].innerHTML.replace(/\D/g,"")*1;var f=YAHOO.util.Dom.getElementsByClassName("productCode","span",h)[0].innerHTML;if(g==0){return}YAHOO.util.Connect.asyncRequest("POST","/ajax/wishlist-remove.php",{},"id="+g);var e=new YAHOO.util.Anim(h,{opacity:{to:0}},0.5);e.onComplete.subscribe(function(){var i=this.getEl();var j=new YAHOO.util.Anim(i,{width:{to:0}},0.2);j.onComplete.subscribe(function(){var k=this.getEl();k.parentNode.removeChild(k);if(document.getElementById("wishlistThumbnailsArtboard").getElementsByTagName("div").length==0){xhtml.displayEmptyMessage()}});j.animate()});e.animate();this._googleAnalyticsTrackEvent("wishlist","remove",f)};this.displayEmptyMessage=function(){var e=document.createElement("div");e.innerHTML='<div id="wishlistThumbnailsEmpty" class="listEmpty"><h2>Your Wish List is empty.</h2><p>To put something in your Wish List, start by searching or browsing through our store.<br/>When an item interests you, click the Add to Wish List link.</p></div>';document.getElementById("wishlistThumbnailsArtboard").appendChild(e)};this.shareOpen=function(){if(xhtml.isTrident6==true){var f=document.getElementsByTagName("select");for(var e=0;e<f.length;e++){f[e].style.visibility="hidden"}}this.shareUpdateOverlay();document.getElementById("wishlistShare").className="";document.getElementById("wishlistShareBackground").className="";document.getElementById("wishlistShareDialog").className="";this._centerDiv(document.getElementById("wishlistShareDialog"),(xhtml.isTrident6?false:true))};this.shareClose=function(){if(xhtml.isTrident6==true){var f=document.getElementsByTagName("select");for(var e=0;e<f.length;e++){f[e].style.visibility="visible"}}document.getElementById("formWishlistShareEmail").getElementsByTagName("label")[0].className="hidden";document.getElementById("formWishlistShareEmail").getElementsByTagName("label")[1].className="hidden";document.getElementById("formWishlistShareEmail").getElementsByTagName("input")[0].value="";document.getElementById("formWishlistShareEmail").getElementsByTagName("fieldset")[0].className="hidden";document.getElementById("formWishlistShareEmail").getElementsByTagName("fieldset")[1].className="";if(xhtml.isFirefox3==true){document.getElementById("wishlistShareDialog").getElementsByTagName("div")[1].style.backgroundPosition="-580px -196px";setTimeout("document.getElementById('wishlistShareDialog').getElementsByTagName('div')[1].style.backgroundPosition = '-580px 100%';",10)}document.getElementById("wishlistShare").className="invisible";document.getElementById("wishlistShareBackground").className="invisible";document.getElementById("wishlistShareDialog").className="invisible"};this.shareSocial=function(f){switch(f){case"bebo":var e="http://www.bebo.com/c/share?Url=%url%&t=%title%";break;case"delicious":var e="http://del.icio.us/post?url=%url%&title=%title%";break;case"digg":var e="http://digg.com/submit?phase=2&url=%url%&title=%title%&bodytext=%desc%";break;case"facebook":var e="http://www.facebook.com/sharer.php?u=%url%&t=%title%";break;case"google":var e="http://www.google.com/bookmarks/mark?op=edit&bkmk=%url%&title=%title%";break;case"myspace":var e="http://www.myspace.com/Modules/PostTo/Pages/?u=%url%&t=%title%";break;case"technorati":var e="http://www.technorati.com/faves?add=%url%";break;case"windowslive":var e="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=%url%&title=%title%&top=1";break;case"yahoomyweb":var e="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=%url%&t=%title%";break;default:this.shareClose();return}e=e.replace("%url%",encodeURIComponent(window.location));e=e.replace("%title%",encodeURIComponent("My Wish List at k-Bee Leotards"));e=e.replace("%desc%",encodeURIComponent("Items added to my wish list from k-Bee Leotard's range of gymnastics wear."));window.open(e,"_blank");this.shareClose();this._googleAnalyticsTrackEvent("share",f,"Wish List")};this.shareEmail=function(){var h=document.getElementById("formWishlistShareEmail");var f=h.getElementsByTagName("input");for(var e=0;e<3;e++){if(f[e].value==""){h.getElementsByTagName("fieldset")[0].className="";h.getElementsByTagName("label")[0].className="missing";if(xhtml.isFirefox3==true){document.getElementById("wishlistShareDialog").getElementsByTagName("div")[1].style.backgroundPosition="-580px -196px";
setTimeout("document.getElementById('wishlistShareDialog').getElementsByTagName('div')[1].style.backgroundPosition = '-580px 100%';",10)}return}}var g=/^[a-z0-9_+-.]+@[a-z0-9_-]*\.?[a-z0-9_-]*\.?[a-z0-9_-]*\.[a-z]+$/i;if(g.test(f[0].value)==false||g.test(f[2].value)==false){h.getElementsByTagName("fieldset")[0].className="";h.getElementsByTagName("label")[0].className="missing";if(xhtml.isFirefox3==true){document.getElementById("wishlistShareDialog").getElementsByTagName("div")[1].style.backgroundPosition="-580px -196px";setTimeout("document.getElementById('wishlistShareDialog').getElementsByTagName('div')[1].style.backgroundPosition = '-580px 100%';",10)}return}document.getElementById("formWishlistShareEmailUrl").value=window.location;document.getElementById("formWishlistShareEmailTitle").value="My Wish List at k-Bee Leotards";document.getElementById("formWishlistShareEmailDesc").value="Items added to my wish list from k-bee leotard's range of gymnastics wear.";YAHOO.util.Connect.setForm("formWishlistShareEmail");YAHOO.util.Connect.asyncRequest("POST","/ajax/emailafriend-wishlist.php",{success:function(){xhtml.shareEmailSent()},failure:function(){alert("There was a problem sending your message, please try again.")}});h.getElementsByTagName("fieldset")[0].className="";h.getElementsByTagName("label")[0].className="hidden";h.getElementsByTagName("label")[1].className="sending";if(xhtml.isFirefox3==true){document.getElementById("wishlistShareDialog").getElementsByTagName("div")[1].style.backgroundPosition="-580px -196px";setTimeout("document.getElementById('wishlistShareDialog').getElementsByTagName('div')[1].style.backgroundPosition = '-580px 100%';",10)}};this.shareEmailSent=function(){document.getElementById("formWishlistShareEmail").getElementsByTagName("fieldset")[0].className="";document.getElementById("formWishlistShareEmail").getElementsByTagName("label")[0].className="hidden";document.getElementById("formWishlistShareEmail").getElementsByTagName("label")[1].className="sending";document.getElementById("formWishlistShareEmail").getElementsByTagName("label")[1].innerHTML="<b>Message Sent!</b>";document.getElementById("formWishlistShareEmail").getElementsByTagName("fieldset")[1].className="hidden";if(xhtml.isFirefox3==true){document.getElementById("wishlistShareDialog").getElementsByTagName("div")[1].style.backgroundPosition="-580px -196px";setTimeout("document.getElementById('wishlistShareDialog').getElementsByTagName('div')[1].style.backgroundPosition = '-580px 100%';",10)}setTimeout("xhtml.shareClose();",1750);this._googleAnalyticsTrackEvent("share","email","Wish List")};this.shareUpdateOverlay=function(){var g=document.getElementById("wishlistShareBackground");g.style.position="absolute";g.style.left="0px";g.style.top="0px";g.style.background="#000";g.style.opacity=0.6;g.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=60)";g.style.width=document.body.offsetWidth+"px";var e=(document.getElementById("page").offsetHeight<document.documentElement.clientHeight?document.documentElement.clientHeight:document.getElementById("page").offsetHeight);var f=280;e=((f+40)<e?e:(f+40));g.style.height=e+"px";g.className=""};this.notificationOpen=function(h,e){clearTimeout(xhtml.notificationTimeout);document.getElementById("wishlistNotifications").className="invisible";document.getElementById("wishlistNotifications").getElementsByTagName("div")[0].innerHTML=h;var f=YAHOO.util.Dom.getXY(e);var k=parseInt(f[0]+(e.offsetWidth/2)-(document.getElementById("wishlistNotifications").offsetWidth/2));var j=parseInt(f[1]+e.offsetHeight+5);document.getElementById("wishlistNotifications").style.left=k+"px";document.getElementById("wishlistNotifications").style.top=j+"px";document.getElementById("wishlistNotifications").style.height="1px";document.getElementById("wishlistNotifications").className="";YAHOO.util.Event.removeListener(document.getElementById("wishlistNotifications"),"mouseover",b);YAHOO.util.Event.addListener(document.getElementById("wishlistNotifications"),"mouseover",b);YAHOO.util.Event.removeListener(document.getElementById("wishlistNotifications"),"mouseout",c);YAHOO.util.Event.addListener(document.getElementById("wishlistNotifications"),"mouseout",c);var g=document.getElementById("wishlistNotifications");try{xhtml.animationReferences[g.getAttribute("animationId")].stop(false)}catch(i){}xhtml.animationReferences[g.getAttribute("animationId")]=new YAHOO.util.Anim(g,{height:{to:196}},0.65,YAHOO.util.Easing.easeOut);xhtml.animationReferences[g.getAttribute("animationId")].animate();this.notificationTimeout=setTimeout("xhtml.notificationClose();",5000)};this.notificationClose=function(){clearTimeout(xhtml.notificationTimeout);YAHOO.util.Event.removeListener(document.getElementById("wishlistNotifications"),"mouseover",b);YAHOO.util.Event.removeListener(document.getElementById("wishlistNotifications"),"mouseout",c);var e=document.getElementById("wishlistNotifications");try{xhtml.animationReferences[e.getAttribute("animationId")].stop(false)}catch(f){}xhtml.animationReferences[e.getAttribute("animationId")]=new YAHOO.util.Anim(e,{height:{to:1}},0.65,YAHOO.util.Easing.easeIn);xhtml.animationReferences[e.getAttribute("animationId")].onComplete.subscribe(function(){document.getElementById("wishlistNotifications").style.height="1px";document.getElementById("wishlistNotifications").className="invisible"});xhtml.animationReferences[e.getAttribute("animationId")].animate()};this.precacheWishListImages=function(){var h=document.getElementById("wishlistThumbnailsArtboard").getElementsByTagName("img");var g=[];for(var e=0,f;f=h[e++];){g.push(f.src.replace("fullsize","notification"))}g.push(this._imagesBaseUrl+"global-elements-heading-itemaddedcart.png");this._precacheImages(g)};function b(){clearTimeout(xhtml.notificationTimeout)}function c(){xhtml.notificationTimeout=setTimeout("xhtml.notificationClose();",500)}function d(e){document.getElementById("headerCart").className="";var g={};try{g=JSON.parse(e.responseText)}catch(f){alert("There was a problem adding this item to your cart,\nplease try again.");return}if(typeof(g)=="object"&&g.status==true){xhtml._updateHeaderCart();if(!!document.getElementById("wishlistBodyProcessing")==true){document.getElementById("wishlistBodyProcessing").parentNode.removeChild(document.getElementById("wishlistBodyProcessing"))}if(typeof(g.callbackid)!="undefined"&&document.getElementById(g.callbackid)){xhtml.cartItemAdded(document.getElementById(g.callbackid))}}else{alert("Sorry, this product is no longer available.");if(typeof(g)=="object"&&typeof(g.callbackid)!="undefined"&&document.getElementById(g.callbackid)){xhtml.removeItem(document.getElementById(g.callbackid));return}return}}};