function fixBrandImageInIE6(){if($.browser.msie&&$.browser.version=="6.0"){$("#brand_image").css({"background-image":"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$("#brand_image img").attr("src")+"', sizingMethod='crop')"});$("#brand_image img").css("display","none")}}function extractProducts(b){var a=$("<ul>").attr("id","next_previous_products").attr("class","relations_products");$("div#next_previous").html(a);var c=b.substr(b.indexOf('<ul id="products">')+18,b.length);c=c.substr(0,c.indexOf('<script type="text/javascript">')-15);$("ul#next_previous_products").html(c);$("div#product_per_row").remove();$("ul#next_previous_products li.divider").remove();$("ul#next_previous_products .button").remove();$("ul#next_previous_products .product_price").remove();$("ul#next_previous_products .alt-colours-title").remove();$("ul#next_previous_products .alt-colours").remove();$("div#product_relationships img").each(function(){$(this).attr("width","60");$(this).attr("src",$(this).attr("src").replace("medium","thumb"))});postTabSetup()}function fadeButtons(a,b){if(a==0){$("div#tab_scroll_left").fadeTo(300,0).css("cursor","default")}else{$("div#tab_scroll_left").css("cursor","pointer").fadeTo(300,1)}if(a>=b){$("div#tab_scroll_right").fadeTo(300,0).css("cursor","default")}else{$("div#tab_scroll_right").css("cursor","pointer").fadeTo(300,1)}}function setupScroll(a){if($("ul#"+a).attr("scroll_num")==null){$("ul#"+a).attr("scroll_num","0")}currentScrollNum=$("ul#"+a).attr("scroll_num");var b=1;var e=5;var d=$("ul#"+a+" li:first").width()+parseInt($("ul#"+a+" li:first").css("padding-left"))+parseInt($("ul#"+a+" li:first").css("padding-right"))+parseInt($("ul#"+a+" li:first").css("margin-left"))+parseInt($("ul#"+a+" li:first").css("margin-right"));var c=Math.ceil($("ul#"+a+" li").length/b)-Math.ceil(e/b);fadeButtons(currentScrollNum,c);$("div#tab_scroll_right").unbind("click").click(function(){if(currentScrollNum<c){currentScrollNum++;$("ul#"+a).animate({left:-(b*currentScrollNum*d)+"px"},750);$("ul#"+a).attr("scroll_num",currentScrollNum);fadeButtons(currentScrollNum,c)}});$("div#tab_scroll_left").unbind("click").click(function(){if(currentScrollNum>0){currentScrollNum--;$("ul#"+a).animate({left:-(b*currentScrollNum*d)+"px"},750);$("ul#"+a).attr("scroll_num",currentScrollNum);fadeButtons(currentScrollNum,c)}})}function setupTabs(){$(".tabs li span").click(function(a){$(".tabs li span").each(function(){$(this).removeClass("active")});$(this).addClass("active");$("div.tab").each(function(){$(this).addClass("closed")});var b="#"+$(this).parent().attr("id").replace("_tab","");$(b).removeClass("closed");setupScroll($(b).find("ul").attr("id"));a.preventDefault()});if($("ul#next_previous_products").length>0||$("ul#recently_viewed_products").length>0){$("div#product_relationships").addClass("show")}if($("ul#recently_viewed_products").length>0){$("li#recently_viewed_tab").removeClass("hide")}$("#product_relations_tabs li span:visible:first").click()}function postTabSetup(){setupTabs();var b=window.location.href;var c=b.split("fcp-product/");var a="0123456789";var e;if(c.length>1){var d;for(d=0;d<c[1].length;d++){if(a.indexOf(c[1].charAt(d))==-1){break}}e=c[1].slice(0,d);$("div#next_previous li#prod_"+e).addClass("selected")}}function loadParentCategory(a){$.ajax({url:a,beforeSend:function(b){},success:function(b,c){extractProducts(b)},error:function(b,d,c){}})}function nextPrevious(c,b){var a="fcp_last_category";if(window.location.href.indexOf("redirect=true")==-1&&$.cookie(a)!=null){$.ajax({url:$.cookie(a),beforeSend:function(d){},success:function(d,e){extractProducts(d)},error:function(d,f,e){loadParentCategory(b)}})}else{loadParentCategory(b);postTabSetup()}}function setupWishlist(){$("span.add_to_wishlist").click(function(){$(".wishlist_selection").slideDown("slow");$.scrollTo($(".wishlist_selection"),{duration:1000})})}(function(a){a.fn.frescaZoom=function(f){var n=a.extend({},a.fn.frescaZoom.defaults,f);var i=this;var g;var e;var l;var q;var d;var r;function c(){g=a(i);a(i).wrap('<div id="zoomParent">');i=a("div#zoomParent");var u=g.attr("src").split(n.productFolder);var t=u[0]+n.zoomFolder+u[1];if(n.ie6PngFix&&a.browser.msie&&a.browser.version==="6.0"){e=a("<span></span>").css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+t+"', sizingMethod='scale')",height:n.zoomHeight+"px",width:n.zoomWidth+"px",display:"block",position:"absolute"});a(i).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+g.attr("src")+"', sizingMethod='crop')");g.css("opacity",0)}else{e=a("<img>").attr("src",t).attr("width",n.zoomWidth).attr("height",n.zoomHeight).css("position","absolute")}l=a('<div id="zoomCont"></div>');q=a('<div id="mouseWindow"></div>');l.append(e);if(a.browser.msie&&a.browser.version==="6.0"){iframe=a("<iframe id='zoomFrame' frameBorder='0'></iframe>");l.prepend(iframe);iframe.css({display:"block",width:l.width(),height:l.height()})}a(i).after(l);a(i).append(q);p();q.css({height:mouseWindowHeight+"px",width:mouseWindowWidth+"px"});m();if(n.alternativeViews){h(u[0])}if(n.overlayZoom){r=a("#zoomCont")}else{r=i}i.data("active","false");if(n.showMessage){i.after(n.zoomMessage)}}function m(){switch(n.activateOn){case"click":o();break;default:b();break}}function o(){i.click(function(t){if(i.data("active")==="false"){k();i.data("active","true");s(t);return false}});a(r).hover(function(){},function(){j();i.data("active","false")}).click(function(){if(i.data("active")==="true"){j();i.data("active","false")}})}function b(){a(r).hover(function(){k()},function(){j()})}function p(){d=n.zoomHeight/g.height();mouseWindowWidth=(l.width()/d);mouseWindowHeight=(l.height()/d)}function s(y){if(d>999&&g.height()>0){p()}var B=g.offset({relativeTo:"html"}).top;var u=g.offset({relativeTo:"html"}).left;var x=g.height();var z=g.width();var v=y.pageY-g.offset({relativeTo:"html"}).top;var w=y.pageX-g.offset({relativeTo:"html"}).left;var C=(w-mouseWindowWidth/2);var A=(v-mouseWindowHeight/2);if(C<0){C=0}else{if(C>(z-mouseWindowWidth)){C=z-mouseWindowWidth}}if(A<0){A=0}else{if(A>(x-mouseWindowHeight)){A=x-mouseWindowHeight}}if(!n.overlayZoom){q.css({top:A,left:C})}e.css({top:"-"+(A*d)+"px",left:"-"+(C*d)+"px"});var t="-"+(A*d)+"px"}function k(){if(!n.overlayZoom){q.css("display","block")}l.css("display","block");a(r).bind("mousemove",function(t){s(t)});if(a.browser.msie&&a.browser.version==="6.0"){a("select.msieHide").css("visibility","hidden")}a("img#zoomMessage").attr("src","/pws/images/hd_clickToZoom_1.gif")}function j(){a(r).unbind("mousemove");if(!n.overlayZoom){q.css("display","none")}l.css("display","none");if(a.browser.msie&&a.browser.version==="6.0"){a("select.msieHide").css("visibility","visible")}}function h(t){a(n.alternativeViewsElement+" li").each(function(){var x=a(this).find("img").attr("src").split(n.thumbnailFolder);var u=x[x.length-1];var w=t+n.productFolder+u;var v=t+n.zoomFolder+u;a("<img>").attr("src",w);a("<img>").attr("stc",v);a(this).css("cursor","pointer").click(function(){if(n.ie6PngFix&&a.browser.msie&&a.browser.version==="6.0"){a(i).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+w+"', sizingMethod='image')");e.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+v+"', sizingMethod='scale')")}else{g.attr("src",w);e.attr("src",v)}})})}c();return a(this)};a.fn.frescaZoom.defaults={thumbnailFolder:"thumb",productFolder:"large",zoomFolder:"zoom",alternativeViews:true,alternativeViewsElement:"ul#alternativeViews",ie6PngFix:false,activateOn:"click",overlayZoom:true,zoomHeight:1500,zoomWidth:1000,zoomMessage:"<p>Click image to zoom</p>",showMessage:true}})(jQuery);$(document).ready(function(){fixBrandImageInIE6();$("img#main_image").frescaZoom();setupWishlist();if($("#basket_response").length>0){$.scrollTo($("#basket_response"),{duration:1000})}else{if($("#wishlist_response").length>0){$.scrollTo($("#wishlist_response"),{duration:1000})}}$("div#product_relationships img").each(function(){$(this).attr("width","60");$(this).attr("src",$(this).attr("src").replace("medium","thumb"))})});