// Library release: v1.18.0.2, 06 November 2009
// Documentation: svn\Wiki\JavaScript\
Brand={version:"1.8.0",name:"TopShop",directory:7,activeSalesCatalogId:19551,isUSStore:false,storeCurrencySymbol:"&#163;",removeCategoryText:true,collapseCategories:true,basicSrollerConfig:{},cycleContentConfig:{gallery_slideshow:{fx:"scrollHorz",prev:"#prev",next:"#next",after:Behaviour.galleryNavigationEffect,speed:400,timeout:0},gallery:{fx:"fade",speed:"fast",timeout:0,next:"#next",prev:"#prev",nexttext:"Next",prevtext:"Previous"}},contentTabsConfig:{},newScrollerConfig:{boutique_scroller:{orientation:"horizontal",moveLeft:293,moveDown:0,speed:400,easing:"jswing",loop:false}},enableColourSwatchHelpers:false,enableProdListerFormatting:false,prodListSetHeight:false,prodListHeightPadding:0,switchProductInsertType:"after",switchProductInsertTarget:"#largerimage2",internationalTrackingUrl:"www.topshop.com/international/index.html",addThisAccountName:"",addThisLocation:"",addThisLink:"<li><a href=\"http://www.addthis.com/bookmark.php\" id=\"add_this_link\" title=\"Bookmark this page\"><img src=\"http://s7.addthis.com/button1-bm.gif\" alt=\"Bookmark this page\" /></a></li>",ProductConfig:{cSizeAmmount:'13',cMdlOpacity:'90',cMdlSizeGuide:true,cSizeGuideHide:true,mOutOfStock:'<h2>Sorry, Item Out of Stock</h2>',mBasket:'<span class="headercart-items"></span> item(s) in your Bag: &pound;<span class="headercart-total"></span>',mAJAXError:'We&lsquo;re sorry there was a problem, please try again.<br /><br /> If the problem continues please contact us.',mAJAXH2Error:'Error',mAJAXH2Success:'Item added to bag',mAddingToBag:'Adding item to bag...',mErrorSize:'You need to select a size before you can add this item to your bag.',mErrorWishlist:'You need to select a size before you can add this item to your wishlist.'},enableMercadoFilters:false,mercadoFiltersH2:"Choose an option to refine your search further",googleAccounts:["UA-806703-3"],ajaxConfig:{lookbook_08_content:{root:"/ajax_content/lookbook_aw08/"},lookbook_content:{root:"/ajax_content/lookbook_ss09/"},denimshop:{root:"/ajax_content/denimshop/"},cmsajax:{root:"/cms/pages/ajax/"}}};Template.initBrandMethods=function(){};Behaviour.initBrandMethods=function(){Behaviour.CapitaliseField();Behaviour.initStoreMenus();Behaviour.initServicesGallery();Behaviour.activateSwatchMenu();};Behaviour.CapitaliseField=function(){if($("input.capitalise").length){$("input.capitalise").blur(function(){if($(this).val()!=""&&$(this).val().length>1){var rtn=$(this).val();var re=/\s/;var words=rtn.split(re);re=/(\S)(\S+)/;re.exec(words[0]);words[0]=RegExp.$1.toUpperCase()+RegExp.$2.toLowerCase();rtn=words.join(' ');$(this).val(rtn);}});}};Behaviour.initServicesGallery=function(){$("#store_gallery").append("<ul id=\"gallery_nav\"><li><a id=\"prev\" href=\"#\" title=\"Previous\">Previous</a></li><li><a id=\"next\" href=\"#\" title=\"Next\">Next</a></li></ul>");};Behaviour.galleryNavigationEffect=function(curr,next,opts){var index=$(this).parent().children().index(this);$('#prev')[index==0?'hide':'show']();$('#next')[index==opts.slideCount-1?'hide':'show']();};Behaviour.initStoreMenus=function(){var wrapper=$("#ts_services"),content=$("#menu_selector"),storeNames=content.find("h5"),storeInfo=content.find(".store_info"),maps=content.find(".store_map");storeNames.hide();maps.hide();var storeToShow=Util.getUrlParam("initialStore"),index=0;if(storeToShow){storeNames.each(function(i){if(unescape(storeToShow).toLowerCase()==$(this).text().toLowerCase())index=i});}storeInfo.not(":eq("+index+")").hide();var menu=$("<select id=\"stores_menu\"></select>");storeNames.each(function(i){var text=$(this).text();var option="<option";if(i==index)option+=" selected=\"selected\"";option+=" value=\""+text+"\">"+text+"</option>";menu.append(option);});var control=$("<a href=\"#\" title=\"View details\" id=\"menu_control\" class=\"replace\">View details</a>").click(function(){var current=menu[0].selectedIndex;storeInfo.not(":hidden").fadeOut(function(){storeInfo.eq(current).fadeIn();});maps.not(":hidden").fadeOut(function(){maps.eq(current).fadeIn();});return false});if(maps.size()){var map_wrapper=$("<div id=\"current_store_map\"></div>");map_wrapper.append(maps).children(":eq("+index+")").show();wrapper.append(map_wrapper);}content.prepend(control).prepend(menu);};Behaviour.activateSwatchMenu=function(){var menu=Util.$("tee_menu");if(menu==null)return;var links=menu.getElementsByTagName("a");for(var i=0;i<links.length;i++){var href=Util.getUrlParam("identifier",links[i].href);if(href==Arcadia.currentIdentifierId){$(links[i]).addClass("active");break}}var swatch=Util.$("teenav");if(swatch==null)return;var img=Util.$("teeimage"),imgLink=Util.$("teeshop_product_link"),buyNow=Util.$("teeshop_buynow_link");var src=img.src,newSrc,colour="front_";colour=src.substring(src.indexOf("/"+colour)+colour.length+1);var links=Util.$("teenav").getElementsByTagName("a");$(links[0]).addClass("activeswatch");Behaviour.swatchActiveColour=links[0];for(var i=0;i<links.length;i++){var func=function(){imgLink.href=this.href;buyNow.href=this.href;if(this!=buyNow){Behaviour.swatchActiveColour.className="";Behaviour.swatchActiveColour=this;$(this).addClass("activeswatch");newSrc=src.replace(colour,this.title.toLowerCase()+".jpg");img.src=newSrc}};Util.addEvent(links[i],"click",func);if(links[i]!=buyNow)Util.addEvent(links[i],"click",Util.cancelClick);}};