$(document).ready(function(){var a=$("div.productCont");if(a.length>0){$.cookie("lastcategoryurl",window.location.href,{expires:31,path:"/"});a.each(function(){$(this).find("a").each(function(){$(this).attr("href",replaceQueryString($(this).attr("href"),"lastcategoryurl","true"))})})}$("#productImageInstructions").css("display","inline");readMoreLessAction();testAltImages()});function replaceQueryString(a,d,c){var b=new RegExp("([?|&])"+d+"=.*?(&|$)","i");if(a.match(b)){return a.replace(b,"$1"+d+"="+c+"$2")}else{if(a.indexOf("?")==-1){return a+"?"+d+"="+c}else{return a+"&"+d+"="+c}}}function readMoreLessAction(){var f=280;if($("p#readMore").length>0){if($("p#readMore").html().length>f){var g=$("p#readMore").html();var e=$("#readMoreBtn").text();var d=$("#readLessBtn").text();var b=g.substring(0,f);if(b.indexOf(".")!=-1){f=b.lastIndexOf(".")+1}var c=g.slice(0,f);var a=g.slice(c.length);$("p#readMore").empty().append(c).after('<p><a href="#" id="read-more">'+e+"</a></p>");$("a#read-more").toggle(function(){$("a#read-more").fadeTo("fast",0);$("p#readMore").slideUp("slow",function(){$("p#readMore").empty().append(g);$("p#readMore").slideDown("slow",function(){$("a#read-more").text(d).fadeTo("slow",1)})})},function(){$("a#read-more").fadeTo("fast",0);$("p#readMore").slideUp("slow",function(){$("p#readMore").empty().append(c);$("p#readMore").slideDown("slow",function(){$("a#read-more").text(e).fadeTo("slow",1)})})})}}}function getCurrencyConverter(c,a,b,e,d){if(d=="wasNow"){url1="/pws/ConvertCurrency.ice?value="+c+"&fromCurrency="+b+"&toCurrency="+e;$("p#productPrice span.wasPrice").load(url1,function(){});url2="/pws/ConvertCurrency.ice?value="+a+"&fromCurrency="+b+"&toCurrency="+e;$("p#productPrice span.nowPrice").load(url2,function(){});if($("#GBPLink").hasClass("show")){$("#GBPLink").removeClass("show").addClass("hide");$("#EURLink").removeClass("hide").addClass("show")}else{$("#EURLink").removeClass("show").addClass("hide");$("#GBPLink").removeClass("hide").addClass("show")}}else{if(d=="fromTo"){url1="/pws/ConvertCurrency.ice?value="+c+"&fromCurrency="+b+"&toCurrency="+e;$("p#productPrice span.fromPrice").load(url1,function(){});url2="/pws/ConvertCurrency.ice?value="+a+"&fromCurrency="+b+"&toCurrency="+e;$("p#productPrice span.toPrice").load(url2,function(){});if($("#GBPLink").hasClass("show")){$("#GBPLink").removeClass("show").addClass("hide");$("#EURLink").removeClass("hide").addClass("show")}else{$("#EURLink").removeClass("show").addClass("hide");$("#GBPLink").removeClass("hide").addClass("show")}}else{url1="/pws/ConvertCurrency.ice?value="+c+"&fromCurrency="+b+"&toCurrency="+e;$("p#productPrice span.onePrice").load(url1,function(){});if($("#GBPLink").hasClass("show")){$("#GBPLink").removeClass("show").addClass("hide");$("#EURLink").removeClass("hide").addClass("show")}else{$("#EURLink").removeClass("show").addClass("hide");$("#GBPLink").removeClass("hide").addClass("show")}}}return false}var x=0;function insertAltView(b,a,d){var e=b.slice(0,-6)+".jpg";if(a){x=a}if(x===0){var c=$("<span></span>").addClass("alternativeView").attr("alt",e).html(parseInt(x,10)+1);$("#alternativeViews").append(c)}c=$("<span></span>").addClass("alternativeView").attr("alt",b).html(parseInt(x,10)+2);$("#alternativeViews").append(c);++x;++a;alternativeViews();if(typeof d=="function"){d(x)}}function testAltImages(){altImages=$("span#alternativeViews img");$.each(altImages,function(a,b){if($(b).attr("height")>40){$(b).css({display:"none"});if(a===0){insertAltView($(b).attr("src"),0)}else{insertAltView($(b).attr("src"))}}else{$(b).css({display:"none"})}})}function alternativeViews(){$("span#alternativeViews").css({visibility:"visible"}).append("<div id='altViewCont'><div id='altViewImg'><img src='' /></div></div>").css({display:"inline"});$("span.alternativeView").css("cursor","pointer");alternativeViewImages=$("span.alternativeView");$("div#productImageCont").css({height:"592px"});$.each(alternativeViewImages,function(a,b){this.thumbSrc=$(b).attr("alt");splitSrc=this.thumbSrc.split("thumb");this.mediumSrc=splitSrc[0]+"large"+splitSrc[1];this.zoomSrc=splitSrc[0]+"zoom"+splitSrc[1];$("<img>").attr("src",this.mediumSrc);$(b).hoverIntent(function(){$(this).css("color","#333");$("div#altViewImg img").attr("src",this.thumbSrc);$("div#altViewCont").css({display:"block",top:($(this).position().top-100),left:($(this).position().left-24)});if($("div#altViewImg").attr("class")!="withShadow"){$("div#altViewImg").addClass("withShadow").dropShadow()}$("span.alternativeView").removeClass("currentLink");$(b).addClass("currentLink")},function(){$(this).css("color","#666")});$(b).click(function(){$("<img>").attr("src",this.zoomSrc);$("img#mainProductImage").attr("src",this.mediumSrc).frescaZoom();$("span.alternativeView").removeClass("selectedAltView");$(this).addClass("selectedAltView")}).css("cursor","pointer");if(this.mediumSrc==$("img#mainProductImage").attr("src")){$(this).addClass("selectedAltView")}});$("div#altViewImg img").hover(function(){},function(){$("div#altViewImg").removeClass("withShadow").removeShadow();$("div#altViewCont").css("display","none")});$("div#altViewImg img").click(function(){var a=$("div#altViewImg img").attr("src");a=a.split("thumb");var b=a;a=a[0]+"large"+a[1];b=b[0]+"zoom"+b[1];$("<img>").attr("src",b);$("img#mainProductImage").attr("src",a).frescaZoom();$("span.alternativeView").removeClass("selectedAltView");$("span.currentLink").addClass("selectedAltView")}).css("cursor","pointer");$("div#productImageCont").hover(function(){},function(){if($("div#altViewImg").is(".withShadow")){$("div#altViewImg").removeClass("withShadow").removeShadow();$("div#altViewCont").css("display","none")}})};