(function(a){a.fn.frescaZoom=function(q){var c=a.extend({},a.fn.frescaZoom.defaults,q);var m=this;var l;var k;var g;var n;var f;function j(){l=a(m);a(m).wrap('<div id="zoomParent">');m=a("div#zoomParent");var s=l.attr("src").split(c.productFolder);var r=s[0]+c.zoomFolder+s[1];k=a("<img>").attr("src",r).attr("width",c.zoomWidth).attr("height",c.zoomHeight).css("position","absolute");g=a('<div id="zoomCont"></div>');n=a('<div id="mouseWindow"></div>');g.append(k);a(m).append(g);a(m).append(n);f=c.zoomHeight/l.height();mouseWindowWidth=(l.width()/f);mouseWindowHeight=(l.height()/f);n.css({height:mouseWindowHeight+"px",width:mouseWindowWidth+"px"});p();if(c.alternativeViews){d(s[0])}}function p(){switch(c.activateOn){case"click":o();break;default:i();break}}function o(){m.click(function(r){b();h(r)});m.hover(function(){},function(){e()})}function i(){m.hover(function(){b()},function(){e()})}function h(v){var y=l.offset({relativeTo:"html"}).top;var r=l.offset({relativeTo:"html"}).left;var u=l.height();var w=l.width();var s=v.pageY-l.offset({relativeTo:"html"}).top;var t=v.pageX-l.offset({relativeTo:"html"}).left;var z=(t-mouseWindowWidth/2);var x=(s-mouseWindowHeight/2);if(z<0){z=0}else{if(z>(w-mouseWindowWidth)){z=w-mouseWindowWidth}}if(x<0){x=0}else{if(x>(u-mouseWindowHeight)){x=u-mouseWindowHeight}}n.css({top:x,left:z});k.css({top:"-"+(x*f)+"px",left:"-"+(z*f)+"px"})}function b(){n.css("display","none");g.css("display","block");m.bind("mousemove",function(r){h(r)})}function e(){m.unbind("mousemove");n.css("display","none");g.css("display","none")}function d(r){a(c.alternativeViewsElement+" li").each(function(){var v=a(this).find("img").attr("src").split(c.thumbnailFolder);var s=v[v.length-1];var u=r+c.productFolder+s;var t=r+c.zoomFolder+s;a("<img>").attr("src",u);a("<img>").attr("stc",t);a(this).css("cursor","pointer").hover(function(){a("ul#alternativeViews li").removeClass("rollover-active");a(this).addClass("rollover-active")},function(){a(this).removeClass("rollover-active")}).css("cursor","pointer");a(this).css("cursor","pointer").click(function(){l.attr("src",u);k.attr("src",t)})})}j();return a(this)};a.fn.frescaZoom.defaults={thumbnailFolder:"small",productFolder:"large",zoomFolder:"zoom",alternativeViews:true,alternativeViewsElement:"ul#alternativeViews",pngImageFix:false,activateOn:"click",zoomHeight:1500,zoomWidth:1500}})(jQuery);$(document).ready(function(){$("img#mainProductImage").frescaZoom();$("img#mainProductImage").hover(function(){$(this).css("cursor","url(/pws/images/img_magnifier.cur),pointer")},function(){})});
