function KitbagObjects(a){this.Services=new b;this.Cache=new c;function b(){this.Product=function(){var b=this._productService?this._productService:new ProductServiceProxy("/stores/"+a+"/services/ProductService.svc/");this._productService=b;return b};this.General=function(){var b=this._generalService?this._generalService:new GeneralServiceProxy("/stores/"+a+"/services/GeneralService.svc/");this._generalService=b;return b};this.Customer=function(){var b=this._customerService?this._customerService:new CustomerServiceProxy("/stores/"+a+"/services/CustomerService.svc/");this._customerService=b;return b};this.Basket=function(){var b=this._basketService?this._basketService:new BasketServiceProxy("/stores/"+a+"/services/BasketService.svc/");this._basketService=b;return b}}function c(){this.Set=function(a,b){this[a]=b;return this[a]};this.Get=function(a){return typeof this[a]!=="undefined"?this[a]:null};this.JQuery=function(a){if(typeof this[a]==="undefined")this[a]=$(a);return this[a]}}}(function(a){a.fn.kb_accordian=function(d){var b={defaultpane:":first",grow:false,headerClass:".accHead",paneClass:".accArea",selectedClass:"accSelected"};d&&a.extend(b,d);var c=a(this).find(b.headerClass);c.live("mouseenter",function(){a(this).addClass(b.selectedClass).css("cursor","pointer")});c.live("mouseleave",function(){a(this).data("selected")!=true&&a(this).removeClass(b.selectedClass)});c.live("click",function(c){c.preventDefault();a.fn.kb_accordian.open(b,a(this),false)});a.fn.kb_accordian.open(b,c.filter(b.defaultpane),true);return this};a.fn.kb_accordian.open=function(f,c,i){var h=c.parent(),d=h.parent(),b=d.children(f.paneClass),j=b.index(h),e=0;if(i){b.each(function(){if(a(this).height()>e)e=a(this).height()});if(f.grow){var g=e+c.outerHeight(true)*(b.length-1);g>d.height()&&d.height(g)}}b.each(function(){var g,h;g=b.index(a(this));if(g<=j)h=g*c.outerHeight(true);else h=d.height()-(b.length-g)*c.outerHeight(true);if(!i)a(this).animate({top:h},500,"swing");else a(this).height(e).css({top:h,"z-index":(g+1)*10});a(this).children().eq(0).removeClass(f.selectedClass).removeData()});c.addClass(f.selectedClass).data("selected",true)};a.fn.kb_content=function(d){var b={branch:0,leaf:""},c=a(this);d&&a.extend(b,d);KB.Services.General().GetLeafContent(b.branch,b.leaf,e,f);function e(a){a&&c.html(a)}function f(){c.html("")}return this};a.fn.kb_signup=function(e){var b={welcomeurl:"",siteCatalyst:true,boxClass:".signUpBox",buttonClass:".signUpButton",responseClass:".signUpResponse"};e&&a.extend(b,e);var d=a(this),c=a(this).find(b.boxClass);c.focus(function(){if(this.defaultValue==this.value)this.value=""}).blur(function(){if(this.value=="")this.value=this.defaultValue});a(this).find(b.buttonClass).click(function(){var a=/^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/;if(a.test(c.val()))if(b.welcomeurl=="")KB.Services.Customer().AddCustomerToMailList(c.val(),f,g);else document.location.href=e.welcomeurl+"?e="+c.val();else{b.siteCatalyst&&s.sendFormEvent("e",s.pageName,"Newsletter Reg","Err:Email address is invalid");d.find(b.responseClass).html("Email address is invalid").slideDown(400).delay(5e3).slideUp(400)}});function f(a){if(b.siteCatalyst)if(a.indexOf("subscribing")!=-1)s.sendFormEvent("e",s.pageName,"Newsletter Reg","Err:"+a);else s.sendFormEvent("s",s.pageName,"Newsletter Reg");d.find(b.responseClass).html(a).slideDown(400).delay(5e3).slideUp(400)}function g(){d.find(b.responseClass).html("Unfortunately an error has occurred, please try again").slideDown(400).delay(5e3).slideUp(400);b.siteCatalyst&&s.sendFormEvent("e",s.pageName,"Newsletter Reg")}return this};a.fn.kb_tabs=function(c){var b={tabEffect:"fade",tabClass:".tabs",headerClass:".tabheader",panesClass:".tabcontents",selectedClass:"tabselected"};c&&a.extend(b,c);a(this).children(b.panesClass).children("div").eq(0).show();a(this).data("activeTab",0);a(this).find(b.headerClass+" a").click(function(c){c.preventDefault;a.fn.kb_tabs.open(b,a(this))}).eq(0).addClass(b.selectedClass);return this};a.fn.kb_tabs.open=function(a,c){var b=c.parents(a.tabClass),f=b.find(a.headerClass+" a"),g=b.children(a.panesClass).children("div"),e=g.eq(b.data("activeTab")),d=f.index(c);if(b.data("activeTab")!=d){switch(a.tabEffect){case"fade":e.fadeTo(300,0,function(){e.hide();g.eq(d).show().fadeTo(200,1);f.removeClass(a.selectedClass);c.addClass(a.selectedClass)});break;case"scroll":f.removeClass(a.selectedClass);var h=d*(e.innerWidth()*-1);b.children(a.panesClass).animate({left:h},300,"swing");c.addClass(a.selectedClass)}b.data("activeTab",d)}}})(jQuery);(function(a){a.fn.kb_equaliseHeights=function(c){var b={minHeight:0,maxHeight:0,overflow:"hidden"};c&&a.extend(b,c);this.each(function(){if(a(this).height()>b.minHeight)b.minHeight=a(this).height()});if(b.maxHeight>0&&b.minHeight>b.maxHeight)b.minHeight=b.maxHeight;return this.each(function(){a(this).height(b.minHeight).css("overflow",b.overflow)})}})(jQuery);var shadowViewer={elementHighlighted:{},init:function(){$(".viewer").live("click",function(a){a.preventDefault();shadowViewer.highlight({elementToHighlight:$(this).attr("rel")})});$(".viewerClose").live("click",function(){shadowViewer.hide()})},highlight:function(c){var a={elementToHighlight:null,duration:600,animation:"fadeIn",width:null,height:null,callback:null,resourceURL:null,resourceContainer:null,resourceCache:true};c&&$.extend(a,c);shadowViewer.elementHighlighted=a.elementToHighlight?$(a.elementToHighlight):$("<div></div>",{"class":"highlightDiv"}).data("new",true);a.height&&shadowViewer.elementHighlighted.height(a.height);a.width&&shadowViewer.elementHighlighted.width(a.width);shadowViewer.elementHighlighted.css({position:"absolute",margin:"auto","z-index":"10001"});if(a.resourceURL){var b=a.resourceContainer?$(a.resourceContainer):shadowViewer.elementHighlighted;if(a.resourceCache&&!KB.Cache.Get("res"+a.resourceURL))$.ajax({url:a.resourceURL,async:false,success:function(c){a.resourceCache&&KB.Cache.Set("res"+a.resourceURL,c);b.html(c)}});else b.html(KB.Cache.Get("res"+a.resourceURL))}var h=window.innerWidth||(window.document.documentElement.clientWidth||window.document.body.clientWidth),f=window.innerHeight||(window.document.documentElement.clientHeight||window.document.body.clientHeight),k=window.pageYOffset||(window.document.documentElement.scrollTop||window.document.body.scrollTop),d=a.elementToHighlight?shadowViewer.elementHighlighted.height():a.height,e=a.elementToHighlight?shadowViewer.elementHighlighted.width():a.width,j=Math.max(f/2-d/2+k,0),i=h/2-e/2,g=$.browser.msie?$('<iframe class="shadowDiv" src="/stores/common/products/block.html"></iframe>'):$('<div class="shadowDiv"></div>');g.height($(document).height()).appendTo($("body")).css("opacity",.8).show(0);shadowViewer.elementHighlighted.wrap('<div class="shadowViewerPlaceHolder" />');shadowViewer.elementHighlighted.appendTo($("body"));shadowViewer.elementHighlighted.css("left",i-10).css("top",j);switch(a.animation){case"hide":shadowViewer.elementHighlighted.show(a.duration,function(){a.callback&&a.callback()});break;case"slide":shadowViewer.elementHighlighted.slideDown(a.duration,function(){a.callback&&a.callback()});break;default:shadowViewer.elementHighlighted.fadeIn(a.duration,function(){a.callback&&a.callback()})}},hide:function(b){var a={duration:300,animation:"fadeOut",callback:null};b&&$.extend(a,b);switch(a.animation){case"hide":shadowViewer.elementHighlighted.hide(a.duration,function(){shadowViewer.hideContent(a.callback)});break;case"slide":shadowViewer.elementHighlighted.slideUp(a.duration,function(){shadowViewer.hideContent(a.callback)});break;default:shadowViewer.elementHighlighted.fadeOut(a.duration,function(){shadowViewer.hideContent(a.callback)})}},hideContent:function(a){shadowViewer.elementHighlighted.appendTo(".shadowViewerPlaceHolder").unwrap();$(".shadowDiv").remove();shadowViewer.elementHighlighted.data("new")&&shadowViewer.elementHighlighted.remove();a&&a()}};
