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 cookiecreator(){$.cookie("productRedirect",window.location.href,{expires:31,path:"/"})}function extractProducts(b){var a=$("<div>").attr("id","next_previous_products").attr("class","relations_products");$("#next_previous").html(a);var c=b.substr(b.indexOf('<div id="productsList">')+23);c=c.substr(0,c.indexOf('<div id="productsListEnd"></div>')-32);$("#next_previous_products").html(c);$(".productDivider","#next_previous_products").remove();$(".product_price","#next_previous_products").remove();$(".button","#next_previous_products").remove();$("div#product_relationships img").each(function(){$(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($("#"+a).attr("scroll_num")==null){$("#"+a).attr("scroll_num","0")}currentScrollNum=$("#"+a).attr("scroll_num");var b=1;var e=5;var d=$("#"+a+" .productCont:first").width()+parseInt($("#"+a+" .productCont:first").css("padding-left"))+parseInt($("#"+a+" .productCont:first").css("padding-right"))+parseInt($("#"+a+" .productCont:first").css("margin-left"))+parseInt($("#"+a+" .productCont:first").css("margin-right"));var c=Math.ceil($("#"+a+" .productCont").length/b)-Math.ceil(e/b);fadeButtons(currentScrollNum,c);$("div#tab_scroll_right").unbind("click").click(function(){if(currentScrollNum<c){currentScrollNum++;$("#"+a).animate({left:-(b*currentScrollNum*d)+"px"},750);$("#"+a).attr("scroll_num",currentScrollNum);fadeButtons(currentScrollNum,c)}});$("div#tab_scroll_left").unbind("click").click(function(){if(currentScrollNum>0){currentScrollNum--;$("#"+a).animate({left:-(b*currentScrollNum*d)+"px"},750);$("#"+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(".relations_products").attr("id"));a.preventDefault()});if($("#next_previous_products").length>0||$("#recently_viewed_products").length>0){$("div#product_relationships").addClass("show")}if($("#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);$("#next_previous #id_"+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{}}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:"#alternativeViews",ie6PngFix:false,activateOn:"click",overlayZoom:true,zoomHeight:1500,zoomWidth:1000,zoomMessage:"<p>Click image to zoom</p>",showMessage:true}})(jQuery);(function(a){a.fn.videoPopup=function(b){var d=a.extend({},a.fn.videoPopup.defaults,b);var c=a(this);c.click(function(){if(d.videoType!=""){var j=a(document).width();var l=a(document).height();if(a("div#overlay").length<1&&a("div#video_popup").length<1){var h=a('<div id="overlay"></div>');a("#wrapper").prepend(h);var i=a('<div id="video_popup"></div>');var m=a('<div id="close_video"><img id="close_video_btn" src="/pws/images/bt_close_popup.gif" alt="X" /></div>');var g=a('<div id="video_frame"><div id="video_object"></div></div>');i.prepend(m).append(g);a("#wrapper").prepend(i);a("#overlay, #close_video_btn").click(function(){a("#video_popup").remove();a("#overlay").fadeTo(500,0,function(){a("#overlay").remove();if(a.browser.msie&&a.browser.version==="6.0"){a("select").css("visibility","visible")}})})}h.css({width:j,height:l});var k=a(c).attr("class");if(k.length>0){buttonClassArray=k.split("_");if(buttonClassArray[1].length>0){buttonDimsArray=buttonClassArray[1].split("-");d.videoWidth=buttonDimsArray[0];d.videoHeight=buttonDimsArray[1]}}if(d.videoType=="youtube"){var e='<object data="'+a(c).attr("href")+'" type="application/x-shockwave-flash" style="width:'+d.videoWidth+"px;height:"+d.videoHeight+'px;"><param value="'+a(c).attr("href")+'" name="movie"><param value="true" name="allowFullScreen"><param value="false" name="allowscriptaccess"></object>';a("#video_object").css({width:d.videoWidth+"px",height:d.videoHeight+"px"}).append(e)}else{if(d.videoType=="360"){var f='<object data="'+a(c).attr("href")+'" type="application/x-shockwave-flash" style="width:'+d.videoWidth+"px;height:"+d.videoHeight+'px;"><param value="'+a(c).attr("href")+'" name="movie"><param value="true" name="allowFullScreen"><param value="false" name="allowscriptaccess"></object>';a("#video_object").css({width:d.videoWidth+"px",height:d.videoHeight+"px"}).append(f)}}a("#overlay").css({display:"block",opacity:"0"}).fadeTo(500,d.overlayOpacity,function(){if(a.browser.msie&&a.browser.version==="6.0"){a("select").css("visibility","hidden")}a("#close_video").css({width:d.videoWidth+"px",display:"block"});a("#video_frame").css({width:d.videoWidth+"px",display:"block"});a("#video_popup").css({display:"block",opacity:"0"});var p=a(window).width();var t=a(window).height();var r=a(window).scrollTop();var s=a("div#video_popup").height();var q=a("div#video_popup").width();var o=r+t/2-s/2-15;var n=p/2-q/2;a("#video_popup").css({top:o+"px",left:n+"px",opacity:"1"})})}return false})};a.fn.videoPopup.defaults={overlayOpacity:0.75,videoType:"",videoWidth:400,videoHeight:300,youtubeId:"",x:0}})(jQuery);$(document).ready(function(){cookiecreator();fixBrandImageInIE6();$("a#play_video").videoPopup({videoType:"youtube"});$("a#play_360").videoPopup({videoType:"360"});$("img#main_image").frescaZoom();setupWishlist();if($("#basket_response").length>0){$.scrollTo($("#product_title"),{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"))})});
