// Library release: v1.19.0.4, 16 February 2010
// Documentation: svn\Wiki\JavaScript\
Brand={version:"1.12.1",name:"Evans",directory:4,activeSalesCatalogId:20554,isUSStore:false,storeCurrencySymbol:"&#163;",removeCategoryText:false,collapseCategories:false,basicSrollerConfig:{},cycleContentConfig:{home_cycle:{fx:"fade",timeout:4000,delay:-2000},header_cycle:{fx:"fade",timeout:4000,delay:-2000},maintile_cycle:{fx:"fade",timeout:4000,delay:-2000},homerighttile_cycle:{fx:"fade",timeout:3000,delay:-1000}},contentTabsConfig:{},newScrollerConfig:{whatshot_scroller:{orientation:"horizontal",moveLeft:155,moveDown:0,speed:400,easing:"jswing",loop:false},profiles_scroller:{orientation:"vertical",moveLeft:0,moveDown:460,speed:500,easing:"jswing",loop:false},newin_scroller:{orientation:"horizontal",moveLeft:350,moveDown:0,speed:400,easing:"jswing",loop:false},spring_summer_scroller:{orientation:"horizontal",moveLeft:590,moveDown:0,speed:400,easing:"jswing",loop:false},interstitial_scroller:{orientation:"horizontal",moveLeft:501,moveDown:0,speed:400,easing:"jswing",loop:false},interstitial_three_scroller:{orientation:"horizontal",moveLeft:324,moveDown:0,speed:400,easing:"jswing",loop:false}},enableProdListerFormatting:true,prodListSetHeight:true,prodListHeightPadding:10,switchProductInsertType:"after",switchProductInsertTarget:"#largerimage2",internationalTrackingUrl:"www.evans.co.uk/international/index.html",ProductConfig:{cSizeAmmount:'13',cMdlOpacity:'90',cMdlSizeGuide:true,cSizeGuideHide:true,mOutOfStock:'<h2>Sorry, Item Out of Stock</h2>',mBasket:'<span class="headercart-items"></span>&nbsp;items in bag: <strong>&pound;<span class="headercart-total"></span></strong>',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:true,mercadoFiltersH2:"Choose an option to refine your search further",googleAccounts:["UA-806703-5"],ajaxConfig:{teeshop:{root:"/ajax_content/",effectSpeed:250,eventType:"click"},whatshot:{root:"/ajax_content/whatshot/",effectSpeed:850,eventType:"click"},cmsajax:{root:"/cms/pages/ajax/"}}};Template.initBrandMethods=function(){Template.addProductSearchLink();};Template.addDollarDisplay=function(){if(Template.id!="productdisplay"&&Template.id!="orderitemdisplay"&&Template.id!="orderdisplay")return;var priceExp=new RegExp(/[^0-9.]+/g);var exchangeRate=1.6;var disclaimer="<p id=\"exchange_rate_disclaimer\">* USD prices are based on an exchange rate of "+exchangeRate+":1 and are for guide purposes only.</p>";function convertPrice(price){return" <span class=\"usd_conversion\">&nbsp; ($"+(price*exchangeRate).toFixed(2)+" <acronym title=\"United States Dollars\">U.S.</acronym>)*</span>"};if(Template.id=="productdisplay"){var wrapper=$("#product_display_details_price_dd");var isDiscounted=wrapper.children(".price_now").size();if(isDiscounted){var productPrices=wrapper.text().replace(priceExp,"|").split("|");var wasPrice=productPrices[1],nowPrice=productPrices[2];wrapper.html("Was &pound;"+wasPrice+convertPrice(wasPrice)+" - <strong class=\"price_now\">Now &pound;<span class=\"itemprice\">"+nowPrice+"</span>"+convertPrice(nowPrice)+"</strong>");}else{var productPrice=wrapper.text().replace(priceExp,"");wrapper.html("&pound;<span class=\"itemprice\">"+productPrice+"</span>"+convertPrice(productPrice)+"");}wrapper.parent().after(disclaimer);}else{var wrapper=$(".shopping_bag_total .summary_price");var totalPrice=wrapper.text().replace(priceExp,"");wrapper.parent().after("<li class=\"usd_total\">"+convertPrice(totalPrice)+"</li>");wrapper.parent().parent().after(disclaimer);}};Template.addProductSearchLink=function(){if(Template.id!="productdisplay")return;$.getScript("/javascript/template/evans_more_colours.js",function(){if(typeof Brand.knitwearProducts!="object")return;$.each(Brand.knitwearProducts,function(){if(this[0]==$("span.catcode").text()){var mercadoUrl="CatalogSearchResultCmd?langId=-1&storeId=12553&catalogId=20554&beginIndex=0&searchTermScope=3&searchTermOperator=LIKE&searchType=ALL&sort_field=Relevance";$("#product_display_details").append("<p id=\"alternative_colour_search\"><a href=\""+mercadoUrl+"&searchTerm="+this[1]+"\" title=\"Click here to view more colours\">Click here to view more colours</a></p>");}})})};Behaviour.initBrandMethods=function(){Behaviour.CapitaliseField();Behaviour.InterstitialSwitch();Behaviour.ImageToolTip();Behaviour.DidYouKnow();Behaviour.initTransparency();};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.initTransparency=function(){$(".js_transparency").css({backgroundColor:"#F1F1F1",opacity:0.7});};Behaviour.InterstitialSwitch=function(){if($("#interstitial #interstitial_switch").length){$("#interstitial_switch ul li#switch1 a").addClass("selected");var divid="";$("#interstitial_switch ul li a").mouseover(function(){$("#interstitial_switch div").removeClass("selected");$("#interstitial_switch ul li a").removeClass("selected");$("#interstitial_switch ul li a").removeClass("selected");divid=$(this).parent("li").attr("id");$("#"+divid+"_panel").addClass("selected");$(this).addClass("selected");});}};Behaviour.ImageToolTip=function(){if($(".imagetooltip").length){xOffset=10;yOffset=30;var winWidth=$(window).width();var winHeight=$(window).height();var divid="";$("a.screenshot").mouseover(function(e){this.t=this.title;this.title="";var theimage=$(this).css("background-image");theimage=theimage.replace('url(','');theimage=theimage.replace(')','');theimage=theimage.replace(/"/gi,'');var thumbimgsrc=theimage;var imgsrc=theimage.split("/");imgsrc=imgsrc[imgsrc.length-1];extension=imgsrc.substring(imgsrc.indexOf("."));newimgsrc=imgsrc.split(".");newimgsrc=newimgsrc[0];divid="screenshot"+newimgsrc;newimgsrc+="_tooltip"+extension;var tipimgsrc=thumbimgsrc.replace(imgsrc,newimgsrc);$("body").append("<p id='"+divid+"' class='preview'><img src='"+tipimgsrc+"' alt=' ' /></p>");var maxHeight=350+e.clientY;var maxWidth=350+e.clientX;if(maxHeight>winHeight&&maxWidth>winWidth){yOffset=329;xOffset=309;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX-yOffset)+"px").fadeIn("fast");}else if(maxHeight>winHeight){xOffset=309;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");}else if(maxWidth>winWidth){yOffset=329;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX-yOffset)+"px").fadeIn("fast");}else{$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");}$("a.screenshot").mousemove(function(e){$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",((maxWidth>winWidth)?e.pageX-yOffset:e.pageX+yOffset)+"px");});});$("a.screenshot").mouseout(function(e){this.title=this.t;$("#"+divid).remove();xOffset=10;yOffset=30});}};Behaviour.DidYouKnow=function(){if($(".didyouknow").length){xOffset=-30;yOffset=-15;var winWidth=$(window).width();var winHeight=$(window).height();var divid="";var theHeight="";var theWidth="";var theid="";$(".didyouknow").mouseover(function(e){theHeight="";theWidth="";divid="";theid="";theelement=$(this);if(theelement.attr("title")){theelement.attr({title:""});}if(theelement.attr("alt")){theelement.attr({alt:""});}if(theelement.contents().attr("title")){theelement.contents().attr({title:""});}if(theelement.contents().attr("alt")){theelement.contents().attr({alt:""});}theid=theelement.attr("id");theid=theid.split("_");theid=theid[1];divid="didyouknow_content_"+theid;var divcontent=theelement.attr("rel");$("body").append('<div class="didyouknow_content" id="'+divid+'"><div class="didyou_top"></div><div class="didyou_bg"><p>'+divcontent+'</p></div><div class="didyou_bot"></div></div>');theHeight=$("#"+divid).height();theWidth=$("#"+divid).width();var maxHeight=theHeight+e.clientY;var maxWidth=theWidth+e.clientX;if(maxHeight>winHeight&&maxWidth>winWidth){yOffset=theWidth-20;xOffset=theHeight+14;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX-yOffset)+"px").fadeIn("fast");}else if(maxHeight>winHeight){xOffset=theHeight+14;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");}else if(maxWidth>winWidth){yOffset=theWidth-20;$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX-yOffset)+"px").fadeIn("fast");}else{$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");}$(".didyouknow").mousemove(function(e){$("#"+divid).css("top",(e.pageY-xOffset)+"px").css("left",((maxWidth>winWidth)?e.pageX-yOffset:e.pageX+yOffset)+"px");});});$(".didyouknow").mouseout(function(e){$("#"+divid).remove();xOffset=-30;yOffset=-15});}};