jTip=(function(){var j=function(r,q){this.key=r;this.url=q;this.id="jtip-panel-"+(++l);var s=this,o=q.indexOf("?"),u=s.params=c.hash(o!=-1?q.substring(o+1):null);u.width=(u.width||250)*1;u.title=u.title||"";this.panel=a("div","jtip-panel",this.id,{display:"none",width:"250px"});this.panel.appendChild(this.arrow=a("div","jtip-arrow"));this.panel.appendChild(this.head=a("div","jtip-head"));this.panel.appendChild(this.body=a("div","jtip-body"));this.body.appendChild(this.loader=a("div","jtip-loader"));$(this.head).html(this.params.title||"&nbsp;");var t=$("body");if($.browser.msie&&$.browser.version<6.5){this.iframe=a("iframe","jtip-iframe");this.iframe.src="javascript:'<html></html>';";t.append(this.iframe);}t.append(this.panel);$(this.body).load(q);this.show();var n=$("#"+r);if(u.link){n.each(function(){this.href=u.link;}).css("cursor","pointer");}else{n.click(f);}};j.prototype={show:function(){if(this.visible){return;}this.visible=true;var o=self.innerWidth||(document.documentElement&&document.documentElement.clientWidth)||document.body.clientWidth,q=this.params.width,s=q+75,n=c.absLeft(this.key),t=c.absTop(this.key)-3,r=o-n,p=s>=r&&s<o;n=!p?n+c.width(this.key)+11:n-q-15;$(this.panel).css({width:q+"px"});$(this.arrow).css({left:(!p?"":(q+1)+"px")});$(this.panel).css({left:n+"px",top:t+"px"}).removeClass(p?"jtip-onright":"jtip-onleft").addClass(p?"jtip-onleft":"jtip-onright").show();if(this.iframe){$(this.iframe).css({width:(q+20)+"px",left:(n-5)+"px",top:t+"px"}).show();}},hide:function(){if(!this.visible){return;}this.visible=false;$(this.panel).hide();if(this.iframe){$(this.iframe).hide();}}};var c={el:function(n){return typeof n=="string"?document.getElementById(n):n;},accumulatedProp:function(r,q){var p=c.el(r),n=p[q];while(null!=(p=p.offsetParent)){n+=p[q];}return n;},width:function(n){return c.el(n).offsetWidth;},absLeft:function(n){return c.accumulatedProp(n,"offsetLeft");},absTop:function(n){return c.accumulatedProp(n,"offsetTop");},hash:function(r){var q={};if(r){var o=r.split(/[;&]/);for(var n=0;n<o.length;n++){var p=o[n].split("=");if(p&&p.length==2){q[unescape(p[0])]=unescape(p[1]).replace(/\+/g," ");}}}return q;}},a=function(n,o,r,p){var q=document.createElement(n);if(o){q.className=o;}if(r){q.id=r;}if(p){$(q).css(p);}return q;},h={},g=function(){if(!this.id){this.id="jtip-autoid-"+(++b);}i(this.id,this.href);},d=function(){e(this.id);},f=function(){return false;},m=function(n){if(typeof n!="string"){var n="a.jtip";}return $(n).hover(g,d);},k=function(o,n){return h[o]=new j(o,n);},i=function(o,n){var p=h[o];if(!p){if(!n){var q=c.el(o),n=q.href;}p=k(o,n);}p.show();},e=function(n){var o=h[n];if(o){o.hide();}},b=-1,l=-1;if(typeof jTipAutoInit=="undefined"||jTipAutoInit!==false){$(m);}return{init:m,show:i,hide:e};})();
if(!Array.indexOf){Array.prototype.indexOf=function(c,d){for(var b=d||0,a=this.length;b<a;++b){if(this[b]==c){return b;}}return -1;};}Cookies={get:function(b){var c=new RegExp("(?:^|;)\\s*"+b+"=(.*?)(?:$|;)");var a=c.exec(document.cookie);return a!=null?a[1]:null;},set:function(c,d,e){var a="";if(e){var b=new Date();b.setTime(b.getTime()+e*24*60*60*1000);a="; expires="+b.toGMTString();}document.cookie=c+"="+d+a+"; path=/";},remove:function(a){Cookies.set(a,"",-1);}};Engine=(function(){var a={};a.stats={all:{instock:0,local:0,international:0,total:0},adult:{instock:0,local:0,international:0,total:0},children:{instock:0,local:0,international:0,total:0}};a.appendTimestamp=function(c){var d=new Date().getTime();var e=c.indexOf("?")==-1?"?t=":"&t=";return c+e+d;};a.getById=function(c){return $("#"+c);};a.findBy=function(){var e=arguments,j=e[0],g,d;if(e.length==3){var f=e[1],h=e[2];for(g=0,d=j.length;g<d;++g){if(j[g][f]===h){return j[g];}}}else{if(e.length==2&&typeof e[1]=="function"){var c=e[1];for(g=0,d=j.length;g<d;++g){if(c(j[g])){return j[g];}}}}return null;};a.round=function(e,c){c=Math.abs(parseInt(c))||0;var d=Math.pow(10,c);return Math.round(e*d)/d;};a.Hash=function(c){if(c){this.create(c);}};a.Hash.keyRegex={returnUrl:/^returnUrl$/i};a.Hash.prototype={create:function(k){var j=this;if(k){var g=k.split(/[;&]/);for(var d=0;d<g.length;d++){var h=g[d].split("=");if(h&&h.length==2){var c=unescape(h[0]),e=unescape(h[1]).replace(/\+/g," "),f=j[c];if(e){j[c]=(f?f+",":"")+e;}}}}return j;},set:function(c,e){if(!this[c]){var f=c.toLowerCase();for(var d in this){if(d.toLowerCase()==f){c=d;break;}}}this[c]=e;return this;},remove:function(){var d=arguments,c=d.length;if(c>0){for(var e=0;e<c;++e){this.set(d[e],null);}}return this;},get:function(c,e){var f=c.toLowerCase();for(var d in this){if(d.toLowerCase()==f){return this[d];}}return(typeof e!="undefined")?e:null;},getInt:function(c){return parseInt(this.get(c)||"0",10);},serialise:function(g){g=g||this;var e=[],h=null;for(var c in g){var d=g[c];if(null!=d&&typeof d!="function"){var f=c+"="+escape(d);if(a.Hash.keyRegex.returnUrl.test(c)){h=f;}else{e.push(c+"="+escape(d));}}}if(h){e.push(h);}return e.join("&");}};a.Uri=function(f){if(!f){var f=document.location.toString();}var e=this;e.path=f;e.query=null;e.frag=null;e.params=new a.Hash();var d=f.indexOf("?"),c=f.indexOf("#");if(d!=-1&&c!=-1&&c>d){e.path=f.substring(0,d);e.query=f.substring(d+1,c);e.frag=f.substring(c+1);}else{if(d!=-1){e.path=f.substring(0,d);e.query=f.substring(d+1);}else{if(c!=-1){e.path=f.substring(0,c);e.frag=f.substring(c+1);}}}e.params.create(e.query);e.stripDefaultDocument();};a.Uri.prototype={path:"",query:"",frag:"",params:new a.Hash(),stripDefaultDocument:function(){this.path=this.path.replace(/\/(default|index)\.(as[phm]x?|html?)/i,"/");},getAbsPath:function(){return this.path.replace(/(ht|f)tps?:\/\/[^\/]+[\/]/i,"/");},toString:function(){var d=this.params.serialise(),c=this.getAbsPath();return(d?(c+"?"+d):c)+(this.frag?"#"+this.frag:"");},updateTime:function(c){if(c===true){this.params.set("t",new Date().getTime());}else{if(c===false){this.params.set("t",null);}}return this;},load:function(c){this.updateTime(c);document.location=this.toString();},replace:function(c){this.updateTime(c);document.location.replace(this.toString());},get:function(c,d){return this.params.get(c,d);},getInt:function(c){return this.params.getInt(c);},set:function(c,d){this.params.set(c,d);return this;},remove:function(){a.Hash.prototype.remove.apply(this.params,arguments);return this;}};var b=null;a.Uri.current=function(){return b||(b=new a.Uri());};a.setQueryValue=function(d,f,e,c){if(f==e){f=null;}new a.Uri(c).set(d,f).load();};a.ui={layout:function(d,c){d();$(window).resize(function(){if(d.t){clearTimeout(d.t);}d.t=setTimeout(d,c||220);});}};return a;})();Behave={over:function(){$(this).addClass("over");},out:function(){$(this).removeClass("over");},select:function(b){if(b&&b>0){var c=this;setTimeout(function(){Behave.select.call(c);},b);}else{try{this.select();}catch(a){}}}};Enhance={_prefix:function(a){return a?"#"+a+" ":"";},zebra:function(a){return $(this._prefix(a)+"table.zebra tbody tr:odd").addClass("odd");},overable:function(a){return $(this._prefix(a)+"table.overable tbody tr").hover(Behave.over,Behave.out).click(function(){$(this).find(".clickable:first").click();});},jtip:function(a){if(typeof jTip!="undefined"){return jTip.init(this._prefix(a)+"a.jtip");}return null;},num:function(a){return $(this._prefix(a)+"input.num:not(.ignore)").numericUpDown();},all:function(a){var b=this;b.zebra(a);b.overable(a);b.jtip(a);b.num(a);}};if(window.attachEvent){var version=navigator.appVersion;version=version.indexOf("MSIE")!=-1?parseFloat(version.split("MSIE")[1]):5.5;if(version<7){$(function(){$("ul.choices label").hover(Behave.over,Behave.out);});}}(function(b,a){b.fn.extend({freeze:function(c){var d="freeze";return this.each(function(){var e=b(this),f;if(!!c){if(f=e.data(d)){e.css("height",f).data(d,null);}}else{f=e.css("height");if(f=="0px"){f="auto";}e.data(d,f).css("height",e.height()+"px");}});},unfreeze:function(){return this.freeze(true);},uri:function(c){if(c){return this.attr("href",c.toString());}else{return new a.Uri(this.attr("href"));}},updateUri:function(c,d){return this.each(function(){var f=b(this),e=f.uri().set(c,d);f.uri(e);});},onEnter:function(d,c){return this.bind(c||"keypress",function(f){if((f.keyCode||f.charCode||0)==13){return d.call(this,f);}});},tooltip:function(c){return this.attr({alt:c,title:c});},attrOrText:function(c){return this.attr(c)||this.text();},slideIn:function(c,d){return this.animate({width:"hide",paddingLeft:"hide",paddingRight:"hide",marginLeft:"hide",marginRight:"hide"},c,d);},slideOut:function(c,d){return this.animate({width:"show",paddingLeft:"show",paddingRight:"show",marginLeft:"show",marginRight:"show"},c,d);},pulsate:function(c,d){return this.fadeTo(c,0.1).fadeTo(c,1,d);},reversePulsate:function(c,d){return this.fadeTo(c,1).fadeTo(c,0.1).fadeTo(c,1,d);},scrollTo:function(c,d){return this.each(function(){var e=b(this).offset().top;b("html,body").animate({scrollTop:e},c,d);});},noPropagation:function(c){var d=function(f){f.stopPropagation();};return this.bind(c||"click",d);},noop:function(c){var d=function(f){f.stopPropagation();f.preventDefault();};return this.bind(c||"click",d);},collapsible:function(e){var i=b.extend({},{moreText:"more",lessText:"fewer",moreIcon:"/shared/img/icons/silk/sweetie2_arrow_down.png",lessIcon:"/shared/img/icons/silk/sweetie2_arrow_up.png"},e);var c=b(this),d=b('<div style="position:relative;"/>'),h=b('<ul style="display: none; margin: 0; position: absolute; right: 10px; top: -12px; font-size: .9em;">	<li><a href="javascript:"><img src="'+i.lessIcon+'" class="silk" /><var>'+i.lessText+"</var></a></li></ul>").appendTo(d),f=function(){var j=c.is(":visible");b("img:first",h).attr("src",j?i.lessIcon:i.moreIcon);b("var:first",h).text(j?i.lessText:i.moreText);c.addClass("gainlayout");};c.after(d);c.appendTo(d);var g=a.Uri.current().getInt("page")||1;if(g>1){c.css("border","1px solid #fff").delay(g>2?100:350).slideUp(g>2?"fast":"",function(){f();h.fadeIn();});h.click(function(){c.slideToggle("",f);});}},pageSource:function(){var f=null,e=function(){if(f){clearTimeout(f);}b(this).addClass("show");},d=function(){if(f){clearTimeout(f);}var g=this;f=setTimeout(function(){c.call(g);},250);},c=function(){b(this).removeClass("show");};return this.each(function(){var h=b(this),j=h.attr("id")+"-ctxmenu",g=h.hover(e,d).children("div.ps-tools a:first").attr("href");var i='style="background-image: url(/shared/img/icons/silk/${icon}.png);"';b('<ul id="'+j+'" class="contextMenu"><li class="none disabled"><a>Admin Menu</a></li><li class="none separator"><a href="#'+g+'" '+i.replace("${icon}","page_white_edit")+'>Edit</a></li><li class="none"><a href="#'+g.replace(/edit\.aspx/i,"history.aspx")+'" '+i.replace("${icon}","chart_organisation")+'>History</a></li><li class="none" title="Disables this context menu - allows normal right click on an item."><a href="#noctx" '+i.replace("${icon}","stop")+">No Context!</a></li>").appendTo(b("body:first"));h.contextMenu({menu:j},function(l,m,k){switch(l){case"noctx":m.css("background-color","transparent").destroyContextMenu();break;default:document.location=l;break;}});});},inlinetip:function(){return this.each(function(){b(this).css("cursor","help").attr("title","Click to 'expand' this info...").bind("click",function(){var d=b(this),c=d.find(".summary");if(c.is(":visible")){d.attr("title","Click to 'collapse' this info...").find(".full").slideDown();c.slideUp();}else{d.attr("title","Click to 'expand' this info...").find(".full").slideUp();c.slideDown();}}).find(".summary>*:last").append(" <a href='#'>&raquo; show more info</a>").end().find(".full a").noPropagation();});},rowExpander:function(d,c){return this.each(function(){var h=true,k=this,e=d||0,f=c||100,l=null,i=function(){return Math.min(f,Math.max(k.value.split("\n").length+1,e));},g=function(){if(e<=0){e=k.rows;}k.rows=h?i():e;},j=function(n,m){if(h&&m||(n.keyCode||n.charCode||0)==13){if(l){clearTimeout(l);}l=setTimeout(function(){g(k);},10);}};b(this).bind("keypress change",j);g(k);});},disableEmpty:function(){return this.each(function(){var c=b(this);c.attr("disabled",c.val().length==0);});},autoselect:function(){return this.focus(function(){Behave.select.call(this,40);});},numericUpDown:(function(){var c=38,e=40,d=function(j){var h=j.charCode||j.keyCode||0;if(h==c||h==e){if(/input/i.test(this.tagName)){var f=b(this),k=f.val(),i=parseFloat(k||"0")||0,g=0;if(k.indexOf(".")!=-1){g=k.substring(k.indexOf(".")+1).length;}if(h==c){++i;}else{if(h==e){--i;}}k=g>0?Math.max(a.round(i,g),0):Math.max(i,0);f.val(k).select().change();}}};return function(){return this.attr("autocomplete","off").keyup(d).focus(Behave.select);};})(),toC:function(){return this.format({format:"-$###,###,###.00",locale:"us"});},toN:function(){return this.format({format:"-###,###,###",locale:"us"});}});})(jQuery,Engine);
WB={Async:{rootUrl:"/utility/async",timeout:10*1000,maxTimeouts:3,resetDays:3,resetTimeoutCount:function(){Cookies.remove("netfails");},getTimeoutCount:function(){return parseInt(Cookies.get("netfails")||"0",10)||0;},logTimeout:function(){var a=this.getTimeoutCount()+1;Cookies.set("netfails",a,this.resetDays);return a>this.maxTimeouts;},bypass:function(){return this.getTimeoutCount()>this.maxTimeouts;}},User:{isStandingOrder:function(){try{return Engine.Uri.current().get("so")=="1";}catch(a){}},isBooksInHomes:function(){try{return Engine.Uri.current().get("bih")=="1";}catch(a){}},Basket:{name:null,isStandingOrder:false,isBooksInHomes:false},enhanced:false},Page:{rootUrl:"",init:function(){$("#acc-basket-slider").click(function(a){$("#acc-basket-recent").slideToggle("",function(){Cookies.set("basket.open",$(this).is(":visible")?"true":"false",30);});return false;});Enhance.num();},initSubmitDisplay:function(){$("#submitWrap :submit").bind("click",function(a){$("#submitWrap").hide();$("#submitMessage").fadeIn();});},autoload:function(a){return false;},initDecryptEmail:function(){$("a.mailto",$("#content,#sidebar")).each(function(){var a=$(this).html().replace("®","@").replace(/·/g,".");$(this).html(a).attr("href","mailto:"+a);});},initCheckboxToggle:function(){$("#checkboxToggle").click(function(){var a=$(this).is(":checked")?"checked":"";$("input:checkbox").attr("checked",a);});}},Product:{},Carousel:{}};WB.Product=(function(){var c={catalogue:"catalogue",grid:"list",gallery:"gallery",compact:"compact"};var e={ok:false,message:""};var b=function(l){this.el=$(l);};b.prototype={val:function(l){return this.el.val(l);},getId:function(){return this.el.val();},setId:function(l){return this.el.val(l);}};var d=null,h=null,a=WB.Async.bypass();function j(s){if(a){return;}var p=$(this),l=p.attr("href");if(l.match("/signin/")){return;}var t=p.hasClass("icon")?c.catalogue:c.grid;if(t==c.grid){p.hide();}else{p.fadeTo("fast",0.1);}try{var m=null,o=p.uri(),q={type:"basket",action:"add",group:t,basketId:WB.Product.info.cart().getId(),id:o.getInt("id"),quantity:o.getInt("quantity")||1,priority:o.get("priority"),comp:o.get("comp"),so:WB.User.isStandingOrder(),bih:WB.User.isBooksInHomes(),notes:o.get("notes")||""};try{p.closest(".elroot").find(".cart-data select:first").each(function(){q["cart-data"]=true;var w=$(this),v=w.attr("class");if(v){q[v]=w.val();}});}catch(n){alert("The item will still be added to your cart but there has been an error collecting your library specific data.\nPlease contact us for if you continually see this message.");}var r="/utility/async/basket.ashx?basketId="+q.basketId+"&productId="+q.id+"&t="+new Date().getTime();$.post(r,q,function(w){if(null!=m){clearTimeout(m);}if(!(w=(w||e)).ok){alert(w.message||"Operation failed. Please refresh the page and try again. Contact us if you experience ongoing problems.");p.fadeTo("fast",1);return;}try{g(w,p);}catch(v){alert("The title was added, but there was an error updating the page.\nPlease contact us if you continue to receive this warning.");}},"json");m=setTimeout(function(){if(WB.Async.logTimeout()||confirm("It seems to be taking longer than normal to add the title to your basket, would you like to try adding the title again?\n\n[If this message bugs you too often, please contact us as there may be a problem]")){o.set("basketId",WB.info.cart().getId()).set("so",WB.User.isStandingOrder()).set("bih",WB.User.isBooksInHomes()).set("bypass",true).set("returnUrl",document.location.toString()).load();}},WB.Async.timeout);return false;}catch(u){}}function i(p,n,o,l){var m=$("#async-feedback-"+o).stop();m.slideUp("fast",function(){m.empty();var r="/customer/"+p+"/?"+p+"Id="+n+"&returnUrl="+encodeURIComponent(document.location)+"#title-"+o,q=$('<p class="asyncNotify">Product added to your <a href="'+r+'">'+(l||p)+"</a>"+(WB.User.enhanced?(' <span> (edit <a href="'+r+'" style="text-decoration:none;border-bottom: 1px dotted #444;color:#444;">title notes</a>?)</span>'):"")+".</p>");m.css("opacity",0.1).append(q).slideDown().fadeTo(500,1).fadeTo(10000,0.1).slideUp();});}function g(p,n){if(p.group==c.grid){n.fadeIn("slow");}else{n.reversePulsate();if(n.text()=="Add to Basket"){n.html("Update Basket");}i("basket",p.basketId,p.productId,"shopping basket");$("#pid-title-"+p.productId).addClass("productTitleBasket");}var l=$("#acc-basket-recent ul"),m=WB.info.cart();if(m.getId()!=p.basketId){l.html("");}if(m.setId(p.basketId)&&m.getId()!=p.basketId){m.el.append("<option value='"+p.basketId+"' selected='selected'>"+p.name+"</option>");}$("#acc-basket .summary").html(p.summary);if(p.item){l.show().children(".item-"+p.productId).remove();$('<li class="item-'+p.productId+'">'+p.item+"</li>").prependTo(l).reversePulsate();}$("#acc-basket-recent:hidden").slideToggle("normal");}function k(r){if(a){return;}var q=$(this);if(q.attr("href").match("/signin/")){return;}q.fadeTo("fast",0.1);try{var s=null,n=q.uri(),p={type:"wishlist",action:"add",group:"",wishlistId:WB.Product.info.wish().getId(),id:n.getInt("id"),quantity:n.getInt("quantity")||1,priority:n.get("priority"),comp:n.get("comp"),notes:n.get("notes")||""};try{q.closest(".elroot").find(".cart-data select").each(function(){p["cart-data"]=true;var u=$(this),t=u.attr("class");if(t){p[t]=u.val();}});}catch(o){alert("The item will still be added to your cart but there has been an error collecting your library specific data.\nPlease contact us for if you continually see this message.");}var m="/utility/async/basket.ashx?wishlistId="+p.wishlistId+"&productId="+p.id+"&t="+new Date().getTime();$.post(m,p,function(u){if(null!=s){clearTimeout(s);}if(!(u=(u||e)).ok){alert(u.message||"Operation failed. Please refresh the page and try again.");q.fadeTo("fast",1);return;}try{f(u,q);}catch(t){alert("The title was added, but there was an error updating the page.\nPlease contact us if you continue to receive this warning.");}},"json");s=setTimeout(function(){if(WB.Async.logTimeout()||confirm("It seems to be taking longer than normal to add the title to your wishlist, would you like to try adding the title again?\n\n[If this message bugs you too often, please contact us as there may be a problem]")){n.set("wishlistId",WB.info.wish().getId()).set("bypass",true).set("returnUrl",document.location.toString()).load();}},WB.Async.timeout);return false;}catch(l){}}function f(m,l){l.reversePulsate();i("wishlist",m.wishlistId,m.productId);$("#acc-wishlist .summary").html(m.summary);}return{info:{cart:function(){return d||(d=new b("#basket-options"));},wish:function(){return h||(h=new b("#wishlist-options"));}},go:{cart:function(){$(this).updateUri("basketId",WB.info.cart().getId());},wish:function(){$(this).updateUri("wishlistId",WB.info.wish().getId());}},add:{cart:j,wish:k},initBasketQuantity:function(){var l="a.basketControlTarget";$("#content input,#content textarea").each(function(){var m=$(this);if(m.is(".productQuantity")){m.bind("change",function(){m.closest(".basketControl").find(l).updateUri("quantity",parseInt(m.val(),10)||1);}).trigger("change");}else{if(m.is(".titleNotes")){m.bind("blur",function(){m.closest(".basketControl").find(l).updateUri("notes",m.val()||null);}).trigger("blur");}else{if(m.is(":checkbox.priority")){m.bind("change",function(){m.closest(".elroot").find(l).updateUri("priority",m.is(":checked")?"true":null);}).trigger("change");}else{if(m.is(":radio")&&m.parent().is(".cb")){m.bind("change",function(){m.closest(".elroot").find(l).updateUri("comp",m.val()=="true"?"true":null);}).filter(":checked").trigger("change");}}}}});},initLightbox:function(l){$("a.lightbox").lightBox();}};})();WB.info=WB.Product.info;WB.go=WB.Product.go;WB.add=WB.Product.add;WB.Carousel=(function(){var b=5,a=[],c=[],f=true;function g(){var o=0;if(f){for(o=0;o<b;o++){c[o]=o;}f=false;return;}while(o<b){var s=Math.floor(Math.random()*a.length);if(c.indexOf(s)<0){c[o]=s;o++;}}var r=$(a[c[0]]),q=$(a[c[1]]),p=$(a[c[2]]),n=$(a[c[3]]),m=$(a[c[4]]);var h=function(){m.insertAfter(n).fadeIn(500);};var j=function(){n.insertAfter(p).fadeIn(500,h);};var k=function(){p.insertAfter(q).fadeIn(500,j);};var l=function(){q.insertAfter(r).fadeIn(500,k);};r.fadeIn(500,l);}function d(){for(var h=0;h<c.length;h++){$(a[c[h]]).fadeOut("fast");}c=[];}function e(){d();setTimeout(g,500);}return{init:function(){a=$(".carousel a");if(a.length>=b){g();window.setInterval(e,8000);}},display:g,update:e};})();(function(){var d="/utility/data.ashx",f=false;var b=$("#s2"),e=$("#s2-go").click(function(h){h.preventDefault();$("input.searchText",b).trigger("format.ui").disableEmpty();b.submit();});try{$("input:text.wm, input:password.wm",b).watermark();}catch(a){}$("input.searchText",b).onEnter(function(h){e.click();});var g={delay:50,minChars:4,matchSubset:0,matchContains:0,cacheLength:10,maxItemsToShow:10,width:400,selectFirst:0,onItemSelect:function(h){e.click();}};var c=function(h){return $.extend({extraParams:h},g);};$("#s2-t").bind("keydown",function(h){f=false;}).bind("format.ui",function(){if(f){return;}var i=$(this),h=i.val();if(h.length>0&&h.indexOf("*")==-1&&h.indexOf('"')==-1){i.val(h+"*");}}).autocomplete(d,{delay:300,minChars:5,matchSubset:0,matchContains:0,cacheLength:10,maxItemsToShow:12,width:550,selectFirst:0,extraParams:{type:"title"},formatQuery:function(h){return $.trim(h.replace(/^(the|a) /i,""));},onItemSelect:function(h){f=true;e.click();}});$("#s2-a").autocomplete(d,c({type:"author"}));$("#s2-s").autocomplete(d,c({type:"series"}));})();$(function(){var a=$("#browser");if(!a.length){return;}var g=$("#contentWrap"),b=Cookies.get("dock")=="0",d=function(){if(b){g.css("height","auto");}else{var j=a.height();if(j>g.height()){g.css("height",(j+50)+"px");}}},e=function(){b=true;g.removeClass("docked").addClass("floating");Cookies.set("dock","0",60);a.animate({width:"15px"});d();},i=function(){b=false;Cookies.set("dock","1");d();},c=function(){g.removeClass("floating").addClass("docked");a.animate({width:"174px"},{complete:i});},h=function(){a.animate({width:"0"},{complete:e});},f=function(){a.animate({width:"0"},{complete:c});};d();$(".mast img",a).click(function(){if(b){f();}else{h();}}).css("cursor","pointer");$("dd ul li",a).each(function(){$("ul",this).hide();}).hover(function(){$(this).addClass("exp").children("ul").show();},function(){$(this).removeClass("exp").children("ul").hide();});});(function(){var c=null,a=function(){b();var d=$(this).attr("class").split(/\s+/);c=$("div."+d[d.length-1]).show().css("z-index","5");},b=function(){if(c){c.hide();}c=null;};$("a.tip").hover(a,b);})();$(function(){$("#basket-options,#wishlist-options").change(function(){var c=$(this),f=c.val();c.nextAll("div.mini-form:first").toggle(f==0).find("input:text").onEnter(function(i){i.preventDefault();return false;},"keydown");if(f>0){var h=this.id.indexOf("wishlist")!=-1,b=h?"wishlist":"basket";if(!h){var g=$(":selected",c).text().toLowerCase();var e=WB.User.Basket;e.isStandingOrder=g.indexOf("* standing order")!=-1;e.isBooksInHomes=g.indexOf("* books in homes")!=-1;}var a="/utility/async/settings.ashx?t="+new Date().getTime(),d={action:"set",target:b,id:f};$.post(a,d,function(j){if(WB.Page.autoload(b)){Engine.Uri.current().set(b+"Id",f).load();}else{$("#acc-"+b+" .summary").html(j.summary);var i=$("#note-pref-"+b);if(j.feedback){i.html(j.feedback).slideDown();}else{i.slideUp(function(){$(this).html("");});}if(!h){$("#acc-"+b+"-recent ul").slideUp("normal",function(){$(this).children().remove();});}}},"json");}}).each(function(){var a=$(this);if(a.val()==0){a.change();}});});$(function(){var a=$("#nav.token-d1");if(!a.length){return;}var b=$("a[class|=sect]",a),c=b.parents("li"),d=null;b.bind("mouseover focus",function(h){var f=$(this),g=f.attr("class").split(/\s+/)[0];if(d!=g){d=g;}c.removeClass("here").removeClass("nextHere");f.closest("li").addClass("here").addClass("nextHere").prev("li").addClass("nextHere");d=f.attr("class").split(/\s+/)[0];$("#hs div.sect").each(function(){$(this).toggle(this.id==d);});});($("li.here:first a[class|=sect]",a)||$("li:first a[class|=sect]",a)).mouseover();});
