var KB=new KitbagObjects("forest");$(document).ready(function(){removeSSL.init()});var header={curMenu:{},init:function(){var e=$("#headerNav"),c=$("li:not(.NoChild)","#navTopDeps"),a=$("a","#navDepartment"),b=$(".navMenu","#navDepartment"),d=document.location.href;if(d.indexOf("17016=christmas")>-1){$("#pageContainer").css("background-image",'url("/stores/forest/artwork/english/banners/xmas_bg.jpg")');$("#pageContainer").css("background-attachment","scroll");$("#pageContainer").css("background-repeat","no-repeat");$("#pageContainer").css("background-position","center top");$("#pageContainer").css("background-size","auto");$("#pageContainer").css("background-origin","padding-box");$("#pageContainer").css("background-clip","border-box");$("#pageContainer").css("background-color","transparent")}if(document.location.protocol=="https:"){a.each(function(){var a=$(this).attr("href");$(this).attr("href","http://"+document.location.hostname+a.substr(a.indexOf("/stores/")))});c.find("a").each(function(){var a=$(this).attr("href");$(this).attr("href","http://"+document.location.hostname+a.substr(a.indexOf("/stores/")))})}a.live("mouseenter",function(){$(this).addClass("siteNavActive");if(!($.browser.msie&&$.browser.version=="6.0")){header.curMenu=b.eq(a.index($(this)));if(header.curMenu.html()!=null){var c=$(this).position().left,d=990+$("#navDepartment").position().left-(header.curMenu.width()+c);if(d<0)c=c+d;header.curMenu.css("left",c).fadeIn(200)}}}).live("mouseleave",function(a){if($.browser.msie&&$.browser.version=="6.0")$(this).removeClass("siteNavActive");else if(!$(a.relatedTarget).hasClass("navMenu")&&$(a.relatedTarget).parents(".navMenu").length==0){header.curMenu&&header.curMenu.hide(0);$(this).prev().css("visibility","hidden");$(this).removeClass("siteNavActive").css("opacity",1)}});b.live("mouseleave",function(){a.removeClass("siteNavActive").css("opacity",1);$(this).hide(0)});$("#txt_search").focus(function(){if(this.defaultValue==this.value)this.value=""}).blur(function(){if(this.value=="")this.value=this.defaultValue});$("#img_search").click(function(){if($("#txt_search").attr("value").indexOf("Search Products")==-1&&$("#txt_search").attr("value")!="")window.location.href="/stores/forest/products/product_browse.aspx?free_text="+encodeURIComponent($("#txt_search").attr("value"))});$("#txt_search").keypress(function(a){if(a.which&&a.which==13||a.keyCode&&a.keyCode==13){a.preventDefault();if($("#txt_search").attr("value").indexOf("Search Products")==-1&&$("#txt_search").attr("value")!="")window.location.href="/stores/forest/products/product_browse.aspx?free_text="+encodeURIComponent($(this).attr("value"));return false}else return true})},setBG:function(){$("#promoimage").height($("#pageContainer").height())}},removeSSL={init:function(){var b=$("a","#pageFooter"),a=$("a",".basketContents");if(document.location.protocol=="https:"){b.each(function(){var a=$(this).attr("href");a.indexOf("http")==-1&&$(this).attr("href","http://"+document.location.hostname+a.substr(a.indexOf("/stores/")))});a.each(function(){var a=$(this).attr("href");$(this).attr("href","http://"+document.location.hostname+a.substr(a.indexOf("/stores/")))})}}},home={imgID:{},timer:{},links:{},init:function(){$("#hpMz").kb_tabs({tabEffect:"scroll"});$("#hpSignUp").kb_signup();$("#hpSideBnrs .lpBnr span").kb_equaliseHeights({minHeight:30});$("#hpSideBnrs .lpBnr, .hpFollowUs").kb_equaliseHeights({minHeight:200});$("a","#hpSideBnrs").click(function(){sc_trackLink("HPSideBnr"+$("a","#hpSideBnrs").index(this),"eVar6")});$("a","#hpBtmBnrs").click(function(){sc_trackLink("HPBottomBnr"+$("a","#hpBtmBnrs").index(this),"eVar6")})},initCarousel:function(){home.imgID=0;$("#promoimage").data("animating",false).queue(function(){$(this).css("background","url("+tlma[0].image+") top center no-repeat");$(this).dequeue()}).show().queue(function(){$(this).height($("#pageContainer").height());$(this).dequeue()});$("#navbarnext").click(function(){clearTimeout(home.timer);home.tlmFireRotate()});if(tlma[0].desc=="")$("#promodescbg, #promodesc").hide(0);else{$("#promodescbg").css("opacity",.5).show();$("#promodesc").show(0).children("span").html(tlma[0].title);$("#hpTopBnr").attr("href",tlma[0].link).attr("title",tlma[0].desc);$("#promodesc").find("a").attr("href",tlma[0].link).html(tlma[0].desc)}home.links=$("a","#navbarlinks");home.links.filter(":not(:first)").fadeTo(200,.6);home.links.live("mouseenter",function(){home.links.index($(this))!=home.imgID&&$(this).addClass("promoimageselected").fadeTo(50,1)});home.links.live("mouseleave",function(){home.links.index($(this))!=home.imgID&&$(this).removeClass("promoimageselected").fadeTo(50,.6)});home.links.show();$("a.promoimage","#hpTopBnrs").click(function(){sc_trackLink("HPTopBnr"+$("a.promoimage","#hpTopBnrs").index(this),"eVar6")})},tlmRotate:function(){home.timer=setTimeout(function(){home.tlmFireRotate()},8e3)},tlmFireRotate:function(){if($("#promoimage").data("animating")==false){home.imgID+=1;if(home.imgID==tlma.length)home.imgID=0;var a=tlma[home.imgID].image;$(new Image).load(function(){home.changeImg()}).attr("src",a)}},changeImg:function(){$("#promoimage").data("animating",true).height($("#pageContainer").height());var a=tlma[home.imgID];$("#promoimage").fadeOut(800,function(){home.links.eq(home.imgID-1).removeClass("promoimageselected").fadeTo(200,.6);home.links.eq(home.imgID).addClass("promoimageselected").fadeTo(200,1);$(this).css("background","url("+a.image+") top center no-repeat").fadeIn(800,function(){$(this).data("animating",false)});$("#hpTopBnr").attr("href",a.link).attr("title",a.desc);if(a.desc=="")$("#promodescbg, #promodesc").hide(0);else{$("#promodescbg, #promodesc").show(0);$("#promodesc").children("span").html(a.title);$("#promodesc").find("a").attr("href",a.link).html(a.desc)}});home.tlmRotate()}},browse={init:function(){$(".browseMz","#productBrowseContent").kb_tabs({tabEffect:"scroll",tabClass:".browseMz"});$("#navSU").kb_signup();$(".lpBnr span:not(.speech)").kb_equaliseHeights({minHeight:15});$(".productListLink",".browseResults").kb_equaliseHeights({minHeight:55});$(".paging a").click(function(){showProgress()});var a=$(".refinementPanel .refinement","#productBrowseContainer");a.children("a").click(function(a){a.preventDefault();$(this).parent().next().slideToggle(250)});$(".colourway a").mouseover(function(){var a=$(this).parents(".productListItem"),f=a.find(".productListImage img"),e=a.children(".productListLink").find("a"),d=a.children(".productListPrice").find("span:last"),b={};b.img=f.attr("src");b.desc=e.html();b.price=d.html();!a.data("orig")&&a.data("orig",b);var c=window["colour"+$(this).attr("rel")];f.attr("src",c.ImageURL);e.html(c.Description);d.html(c.PriceString)});$(".productListColours").mouseleave(function(){var b=$(this).parents(".productListItem"),c=b.find(".productListImage img"),a=b.data("orig");a&&a.img!=c.attr("src")&&c.fadeTo(200,.5,function(){$(this).attr("src",a.img).fadeTo(600,1);b.find(".productListLink a").html(a.desc);b.find(".productListPrice span:last").html(a.price)})})}},productplus={img:{},init:function(){$(".ppimg").click(function(b){b.preventDefault;var a=$(this).parents(".ppItem");a.addClass("ppSelected").siblings(".ppItem").removeClass("ppSelected");productplus.img=a.find(".ppImg").attr("src");KB.Services.Product().SetProductPlus($(this).attr("rel"),a.find(".ppVariation").val(),productplus.onPPComplete,productplus.onError)});$("#ppSelectedInfo").live("click",function(){KB.Services.Product().RemoveProductPlus(productplus.onPPRemoveComplete,productplus.onError)})},onPPComplete:function(a){a=a.replace("[IMG]","<img src='"+productplus.img+"' alt='' />");$("#ppSelectedInfo").slideUp(400).queue(function(){$(this).html(a+"<br/><a><img src='/stores/forest/artwork/english/interface/buttons/button_cancel.gif' /></a>").dequeue()}).slideDown(400)},onPPRemoveComplete:function(){$("#ppSelectedInfo").slideUp(400).queue(function(){$(".ppItem").removeClass("ppSelected");$(this).html("<p>You have not yet made a selection</p>").dequeue()}).slideDown(200)},onError:function(){$("#ppSelectedInfo").html("Unfortunately a problem occurred, please try again or come back later when the problem will hopefully be resolved")}};function s7jsonResponse(b){var c="",e=0,a=0,f=0;for(c in b){e=b[c].indexOf(";",0);a=b[c].indexOf(",",0);if(a==-1)a=b[c].length;while(e>0){f++;var d=b[c].substring(e+1,a).replace("Findel/","");d=d.substring(d.indexOf("-")+1);var g=productdetail.ImageURL.substring(productdetail.ImageURL.lastIndexOf("/")+1,productdetail.ImageURL.lastIndexOf("-")+1)+d;$("<img/>").data("imgname",g).attr("src","//images.kitbag.com/"+g+".jpg?width=90&height=90&quality=95").appendTo("#pdMultiImages");if(f==4)break;e=b[c].indexOf(";",a);a=b[c].indexOf(",",a+1);if(a==-1)a=b[c].length}}f<2&&$("#pdMultiImages").hide(0)}var sizechart_viewer={load:function(a){!KB.Cache.Get("chart")&&$.get("/stores/forest/help/size_chart.htm",function(b){KB.Cache.Set("chart",b);$(a).html(b);$("#sizecharttabs").kb_tabs()})}},productDetailOptions={pdAreaSelector:"#pdInfo",nameBoxSelector:"input.pdNameBox",numberBoxSelector:"input.pdNumberBox",sizeDDSelector:"select.pdSizes",persBoxSelector:".persfield",giftWrapTagSelector:".giftWrapTagTxt",OnInit:function(){proddetails.UnbindDefaults();$("#showsizechart").mousedown(function(){$(this).queue(function(){sizechart_viewer.load("#sizechart div.content");$(this).dequeue()})});$("#returnsinfolink").mousedown(function(){$(this).queue(function(){$("#returnsinfo div.content").kb_content({branch:437,leaf:"Paragraph_forest"});$(this).dequeue()})});$("#ukdeliveryinfolink").mousedown(function(){$(this).queue(function(){$("#ukdeliveryinfo div.content").kb_content({branch:897,leaf:"delinfo_UKFull118"});$(this).dequeue()})});$("#overseasdeliveryinfolink").mousedown(function(){$(this).queue(function(){$("#overseasdeliveryinfo div.content").kb_content({branch:897,leaf:"delinfo_OverseasFull_Generic"});$(this).dequeue()})});$("#showdesc").click(function(){$(".tabheader a","#pdTabs").eq(0).click();scrollTo(0,$("#pdTabs").offset().top)});$("#showreturn").click(function(){$(".tabheader a","#pdTabs").eq(2).click();scrollTo(0,$("#pdTabs").offset().top)});$("#showdelivery").click(function(){$(".tabheader a","#pdTabs").eq(1).click();scrollTo(0,$("#pdTabs").offset().top)})}},basket={init:function(){$("#basketRight").kb_accordian({grow:true});$(".productListATB").click(function(){EnableUI.Toggle(false);var a=$(this).parents(".productListItem"),c=$(this).attr("rel"),b=0;if(a.find(".productListSizes").get(0))b=parseInt(a.find(".productListSizes").val(),10);KB.Services.Product().AddToBasket(c,b,0,"","",0,basket.onATBComplete,basket.onError)});$(".shiplink").live("mousedown",function(){$(this).queue(function(){$("#deliveryinfo div.content").kb_content({branch:892,leaf:"shipping_info_118"});$(this).dequeue})});$("#returnslink").live("mousedown",function(){$(this).queue(function(){$("#returnsinfo div.content").kb_content({branch:437,leaf:"Paragraph_forest"});$(this).dequeue})});$("#collectionlink").live("mousedown",function(){$("#collectioninfo .content").html("");$.get("/stores/forest/help/store_information.html",function(a){$("#collectioninfo .content").html(a);$("#collectionintro").kb_content({branch:892,leaf:"collection_info_118"})})});$(".removeItem").live("click",function(a){a.preventDefault();basket.feedback($(this),"Please wait while this item is removed from your basket");__doPostBack($(this).attr("name"),"")});$(".decreaseItem, .increaseItem").live("click",function(){basket.feedback($(this),"Please wait while this item is updated");__doPostBack($(this).attr("name"),"")});basket.giftWrap.init()},refreshContents:function(){__doPostBack($("div[id*=up_basket]").attr("id"),"BasketRefresh")},feedback:function(b,c){var a=b.parents("tr");a.find("td:gt(0)").remove();a.find("td:first").css("background-color","#F2F2F2");a.append("<td colspan='6' align='center' style='background-color:#F2F2F2'><img src='/stores/forest/artwork/common/interface/loader_bar_v1.gif' alt='loading' /><p>"+c+"</p></td>")},onATBComplete:function(b){if(b){var a=$("."+b.ProductID+b.VariationID),c="<td align='center' valign='middle' style='background-color:#F2F2F2;height:105px;width:120px;'><img src='//images.kitbag.com/"+b.ImageName+"?width=100&amp;height=100' alt='"+b.Description+"' style='height:100px;width:100px;border-width:0px;' /></td><td colspan='6' align='center' style='background-color:#F2F2F2'><img src='/stores/forest/artwork/common/interface/loader_bar_v1.gif' alt='loading' /><p>Please wait while <em>'"+b.Description+"'</em> is added to your basket</p></td>";if(a.length>0)a.html(c);else a=$("<tr style='display:none' />").html(c).fadeIn(600).appendTo($(".basketContents"));alert(a.length);alert(a.offset().top);var d=a.offset().top+a.height();if(parseInt(d,10)>$(window).height()+$(window).scrollTop())$("html,body").animate({scrollTop:d-$(window).height()+10},500,function(){basket.refreshContents()});else basket.refreshContents()}else{alert("There was a problem adding the current selection to the basket");EnableUI.Toggle(true)}},onError:function(){alert("Unfortunately an error has occurred, please try again");EnableUI.Toggle(true)},giftWrap:{init:function(){basket.giftWrap.enableGWCheckBoxes();var a=Sys.WebForms.PageRequestManager.getInstance();a.add_endRequest(function(){basket.giftWrap.enableGWCheckBoxes()});$(".chkGiftWrap").live("click",function(){var a=$(this).find("input");shadowViewer.highlight({resourceURL:"/stores/forest/help/giftwrap/giftwrap_enter.htm",width:640,height:550});$(".gw_charsmax").text(KB.GiftWrap.taglength);if(a.is(":checked")){$(".gw_text").data("bskItem",$(this).attr("rel")).focus();$(".gw_add").show()}else{$(".gw_text").data("bskItem",$(this).attr("rel")).attr("readonly","true").val($(".giftwrapmsg"+$(this).attr("rel")).html().replace(KB.GiftWrap.emptymsg,""));$(".gw_remove").show()}$(".gw_cancel").data({chkBoxID:a.attr("id")});basket.giftWrap.giftTagCalculateChars();$(".gw_price").html("£"+KB.GiftWrap.price)});$(".editGiftTag").live("click",function(){shadowViewer.highlight({resourceURL:"/stores/forest/help/giftwrap/giftwrap_enter.htm",width:640,height:550});$(".gw_charsmax").text(KB.GiftWrap.taglength);$(".gw_text").data("bskItem",$(this).attr("rel")).show().val($(".giftwrapmsg"+$(this).attr("rel")).html().replace(KB.GiftWrap.emptymsg,"")).focus();$(".gw_edit").show();basket.giftWrap.giftTagCalculateChars()});$(".gw_info").live("click",function(){shadowViewer.highlight({resourceURL:"/stores/forest/help/giftwrap/giftwrap_info.htm",width:520,height:310});$(".gw_price").html("£"+KB.GiftWrap.price)});$(".gw_cancel").live("click",function(){shadowViewer.hide();var a=$("#"+$(this).data("chkBoxID")).eq(0);if(a.attr("checked"))a.attr("checked",false);else a.attr("checked",true)});$(".gw_add").live("click",function(){if($(".gw_text").eq(0).val().length>KB.GiftWrap.taglength)basket.giftWrap.giftTagCalculateChars();else{EnableUI.Toggle(false);KB.Services.Basket().InsertPrintingItem($(".gw_text").data("bskItem"),16,1,KB.GiftWrap.name,0,KB.GiftWrap.price,basket.giftWrap.giftWrapAddedSuccess,basket.giftWrap.giftWrapError)}});$(".gw_edit").live("click",function(){var a=$(this).siblings(".gw_text").eq(0).val();if(a.length>KB.GiftWrap.taglength)basket.giftWrap.giftTagCalculateChars();else{EnableUI.Toggle(false);KB.Services.Basket().UpdatePrintingItem($(".gw_text").data("bskItem"),17,a,basket.giftWrap.giftWrapSuccess,basket.giftWrap.giftWrapError)}});$(".gw_remove").live("click",function(){EnableUI.Toggle(false);KB.Services.Basket().RemovePrintingItem($(".gw_text").data("bskItem"),17,basket.giftWrap.giftTagRemovedSuccess,basket.giftWrap.giftWrapError)});$(".gw_removeall").live("click",function(){EnableUI.Toggle(false);KB.Services.Basket().RemovePrintingItemsByType(17,basket.giftWrap.giftTagAllRemovedSuccess,basket.giftWrap.giftWrapError)});$(".gw_cancelcountry").live("click",function(){shadowViewer.hide();var a=$(".countrySelector");if(a.length>0){$(".countrySelector option[value='204']").attr("selected","selected");basket.refreshContents()}});$("body").delegate(".countrySelector","change",function(){var c=KB.GiftWrap.countries.split(","),b=$(".countrySelector").eq(0).val(),a=$(".chkGiftWrap input:checked").length;a>0&&$.inArray(b,c)<0&&shadowViewer.highlight({resourceURL:"/stores/forest/help/giftwrap/giftwrap_restrictions.htm",width:520,height:310})});$(".gw_text").live("keydown",function(){var a=$(".gw_text").eq(0);if(a.val().length>KB.GiftWrap.taglength)return false}).live("keyup",function(){var a=$(".gw_text").eq(0);a.val(a.val().substring(0,KB.GiftWrap.taglength));basket.giftWrap.giftTagCalculateChars()})},enableGWCheckBoxes:function(){$(".chkGiftWrap input").attr("disabled",false);$(".chkGiftWrap").attr("disabled",false)},giftTagCalculateChars:function(){var a=$(".gw_text").eq(0).val();$(".gw_charsused").html(a.length);$(".gw_charsremaining").html(KB.GiftWrap.taglength-a.length)},giftWrapSuccess:function(){basket.feedback($(".chkGiftWrap[rel='"+$(".gw_text").data("bskItem")+"']"),"Altering gift wrap selection on this item");shadowViewer.hide({callback:basket.refreshContents()})},giftWrapError:function(){alert("There was a problem with the operation");EnableUI.Toggle(true)},giftWrapAddedSuccess:function(){KB.Services.Basket().InsertPrintingItem($(".gw_text").data("bskItem"),17,1,$(".gw_text").eq(0).val(),0,0,basket.giftWrap.giftWrapSuccess,basket.giftWrap.giftWrapError)},giftTagRemovedSuccess:function(){KB.Services.Basket().RemovePrintingItem($(".gw_text").data("bskItem"),16,basket.giftWrap.giftWrapSuccess,basket.giftWrap.giftWrapError)},giftTagAllRemovedSuccess:function(){KB.Services.Basket().RemovePrintingItemsByType(16,basket.giftWrap.giftWrapSuccess,basket.giftWrap.giftWrapError)}}};function ValueChangedHandler(){showProgress();$("input:submit").click()}function showProgress(){$("#productBrowseNav").block({message:'<img src="/stores/forest/artwork/common/interface/loader_v1.gif" />',overlayCSS:{backgroundColor:"#fff",opacity:.6}});$(".productListImage").block({message:'<img src="/stores/forest/artwork/common/interface/loader_v1.gif" />',overlayCSS:{backgroundColor:"#fff",opacity:.6}})}var orderDetails={init:function(){$(".shipOptions input:checked").parents("tr").css("background-color","#EEE");var a=Sys.WebForms.PageRequestManager.getInstance();a.add_endRequest(function(){orderDetails.init()});$("#collectionlink").live("mousedown",function(){$("#collectioninfo .content").html("");$.get("/stores/forest/help/store_information.html",function(a){$("#collectioninfo .content").html(a);$("#collectionintro").kb_content({branch:892,leaf:"collection_info_118"})})})},showInvalidGiftWrapMsg:function(){shadowViewer.highlight({resourceURL:"/stores/forest/help/giftwrap/giftwrap_restrictions.htm",width:520,height:310})}};$(document).ready(function(){try{$("#aspnetForm").validate()}catch(a){}});
