(function($){var isie6=$.browser.msie&&$.browser.version<7;var body=$(document.body);var window=$(window);var jqzoompluging_disabled=false;$.fn.jqzoom=function(t){return this.each(function(){var e=this.nodename.tolowercase();if(e=="a"){new jqzoom(this,t)}})};jqzoom=function(el,options){var api=null;api=$(el).data("jqzoom");if(api)return api;var obj=this;var settings=$.extend({},$.jqzoom.defaults,options||{});obj.el=el;el.rel=$(el).attr("rel");el.zoom_active=false;el.zoom_disabled=false;el.largeimageloading=false;el.largeimageloaded=false;el.scale={};el.timer=null;el.mousepos={};el.mousedown=false;$(el).css({"outline-style":"none","text-decoration":"none"});var img=$("img:eq(0)",el);el.title=$(el).attr("title");el.imagetitle=img.attr("title");var zoomtitle=$.trim(el.title).length>0?el.title:el.imagetitle;var smallimage=new smallimage(img);var lens=new lens;var stage=new stage;var largeimage=new largeimage;var loader=new loader;$(el).bind("click",function(e){e.preventdefault();return false});var zoomtypes=["standard","drag","innerzoom","reverse"];if($.inarray($.trim(settings.zoomtype),zoomtypes)<0){settings.zoomtype="standard"}$.extend(obj,{create:function(){if($(".zoompad",el).length==0){el.zoompad=$("
").addclass("zoompad");img.wrap(el.zoompad)}if($(".zoompup",el).length==0){lens.append()}if($(".zoomwindow",el).length==0){stage.append()}if($(".zoompreload",el).length==0){loader.append()}if(settings.preloadimages||settings.zoomtype=="drag"||settings.alwayson){obj.load()}obj.init()},init:function(){if(settings.zoomtype=="drag"){$(".zoompad",el).mousedown(function(){el.mousedown=true});$(".zoompad",el).mouseup(function(){el.mousedown=false});document.body.ondragstart=function(){return false};$(".zoompad",el).css({cursor:"default"});$(".zoompup",el).css({cursor:"move"})}if(settings.zoomtype=="innerzoom"){$(".zoomwrapper",el).css({cursor:"crosshair"})}$(".zoompad",el).bind("mouseenter mouseover",function(e){img.attr("title","");$(el).attr("title","");el.zoom_active=true;smallimage.fetchdata();if(el.largeimageloaded){obj.activate(e)}else{obj.load()}});$(".zoompad",el).bind("mouseleave",function(e){obj.deactivate()});$(".zoompad",el).bind("mousemove",function(e){if(e.pagex>smallimage.pos.r||e.pagexsmallimage.pos.b){lens.setcenter();return false}el.zoom_active=true;if(el.largeimageloaded&&!$(".zoomwindow",el).is(":visible")){obj.activate(e)}if(el.largeimageloaded&&(settings.zoomtype!="drag"||settings.zoomtype=="drag"&&el.mousedown)){lens.setposition(e)}});var thumb_preload=new array;var i=0;var thumblist=new array;thumblist=$("a").filter(function(){var e=new regexp("gallery[\\s]*:[\\s]*'"+$.trim(el.rel)+"'","i");var t=$(this).attr("rel");if(e.test(t)){return this}});if(thumblist.length>0){var first=thumblist.splice(0,1);thumblist.push(first)}thumblist.each(function(){if(settings.preloadimages){var thumb_options=$.extend({},eval("("+$.trim($(this).attr("rel"))+")"));thumb_preload[i]=new image;thumb_preload[i].src=thumb_options.largeimage;i++}$(this).click(function(e){thumblist.each(function(){$(this).removeclass("zoomthumbactive")});e.preventdefault();obj.swapimage(this);return false})})},load:function(){if(el.largeimageloaded==false&&el.largeimageloading==false){var e=$(el).attr("href");el.largeimageloading=true;largeimage.loadimage(e)}},activate:function(e){cleartimeout(el.timer);lens.show();stage.show()},deactivate:function(e){switch(settings.zoomtype){case"drag":break;default:img.attr("title",el.imagetitle);$(el).attr("title",el.title);if(settings.alwayson){lens.setcenter()}else{stage.hide();lens.hide()}break}el.zoom_active=false},swapimage:function(link){el.largeimageloading=false;el.largeimageloaded=false;var options=new object;options=$.extend({},eval("("+$.trim($(link).attr("rel"))+")"));if(options.smallimage&&options.largeimage){var smallimage=options.smallimage;var largeimage=options.largeimage;$(link).addclass("zoomthumbactive");$(el).attr("href",largeimage);img.attr("src",smallimage);lens.hide();stage.hide();obj.load()}else{alert("error :: missing parameter for largeimage or smallimage.");throw"error :: missing parameter for largeimage or smallimage."}return false}});if(img[0].complete){smallimage.fetchdata();if($(".zoompad",el).length==0)obj.create()}function smallimage(image){var $obj=this;this.node=image[0];this.findborder=function(){var bordertop=0;bordertop=image.css("border-top-width");btop="";var borderleft=0;borderleft=image.css("border-left-width");bleft="";if(bordertop){for(i=0;i<3;i++){var x=[];x=bordertop.substr(i,1);if(isnan(x)==false){btop=btop+""+bordertop.substr(i,1)}else{break}}}if(borderleft){for(i=0;i<3;i++){if(!isnan(borderleft.substr(i,1))){bleft=bleft+borderleft.substr(i,1)}else{break}}}$obj.btop=btop.length>0?eval(btop):0;$obj.bleft=bleft.length>0?eval(bleft):0};this.fetchdata=function(){$obj.findborder();$obj.w=image.width();$obj.h=image.height();$obj.ow=image.outerwidth();$obj.oh=image.outerheight();$obj.pos=image.offset();$obj.pos.l=image.offset().left+$obj.bleft;$obj.pos.t=image.offset().top+$obj.btop;$obj.pos.r=$obj.w+$obj.pos.l;$obj.pos.b=$obj.h+$obj.pos.t;$obj.rightlimit=image.offset().left+$obj.ow;$obj.bottomlimit=image.offset().top+$obj.oh};this.node.onerror=function(){alert("problems while loading image.");throw"problems while loading image."};this.node.onload=function(){$obj.fetchdata();if($(".zoompad",el).length==0)obj.create()};return $obj}function loader(){var e=this;this.append=function(){this.node=$("").addclass("zoompreload").css("visibility","hidden").html(settings.preloadtext);$(".zoompad",el).append(this.node)};this.show=function(){this.node.top=(smallimage.oh-this.node.height())/2;this.node.left=(smallimage.ow-this.node.width())/2;this.node.css({top:this.node.top,left:this.node.left,position:"absolute",visibility:"visible"})};this.hide=function(){this.node.css("visibility","hidden")};return this}function lens(){var t=this;this.node=$("").addclass("zoompup");this.append=function(){$(".zoompad",el).append($(this.node).hide());if(settings.zoomtype=="reverse"){this.image=new image;this.image.src=smallimage.node.src;$(this.node).empty().append(this.image)}};this.setdimensions=function(){this.node.w=parseint(settings.zoomwidth/el.scale.x)>smallimage.w?smallimage.w:parseint(settings.zoomwidth/el.scale.x);this.node.h=parseint(settings.zoomheight/el.scale.y)>smallimage.h?smallimage.h:parseint(settings.zoomheight/el.scale.y);this.node.top=(smallimage.oh-this.node.h-2)/2;this.node.left=(smallimage.ow-this.node.w-2)/2;this.node.css({top:0,left:0,width:this.node.w+"px",height:this.node.h+"px",position:"absolute",display:"none",borderwidth:1+"px"});if(settings.zoomtype=="reverse"){this.image.src=smallimage.node.src;$(this.node).css({opacity:1});$(this.image).css({position:"absolute",left:-(this.node.left+1-smallimage.bleft)+"px",top:-(this.node.top+1-smallimage.btop)+"px"})}};this.setcenter=function(){this.node.top=(smallimage.oh-this.node.h-2)/2;this.node.left=(smallimage.ow-this.node.w-2)/2;this.node.css({top:this.node.top,left:this.node.left});if(settings.zoomtype=="reverse"){$(this.image).css({position:"absolute",left:-(this.node.left+1-smallimage.bleft)+"px",top:-(this.node.top+1-smallimage.btop)+"px"})}largeimage.setposition()};this.setposition=function(e){el.mousepos.x=e.pagex;el.mousepos.y=e.pagey;var t=0;var s=0;function o(e){return el.mousepos.x-e.w/2smallimage.pos.r}function a(e){return el.mousepos.y-e.h/2smallimage.pos.b}t=el.mousepos.x+smallimage.bleft-smallimage.pos.l-(this.node.w+2)/2;s=el.mousepos.y+smallimage.btop-smallimage.pos.t-(this.node.h+2)/2;if(o(this.node)){t=smallimage.bleft-1}else if(i(this.node)){t=smallimage.w+smallimage.bleft-this.node.w-1}if(a(this.node)){s=smallimage.btop-1}else if(l(this.node)){s=smallimage.h+smallimage.btop-this.node.h-1}this.node.left=t;this.node.top=s;this.node.css({left:t+"px",top:s+"px"});if(settings.zoomtype=="reverse"){$(this.image).css({position:"absolute",left:-(this.node.left+1-smallimage.bleft)+"px",top:-(this.node.top+1-smallimage.btop)+"px"})}largeimage.setposition()};this.hide=function(){img.css({opacity:1});this.node.hide()};this.show=function(){if(settings.zoomtype!="innerzoom"&&(settings.lens||settings.zoomtype=="drag")){this.node.show()}if(settings.zoomtype=="reverse"){img.css({opacity:settings.imageopacity})}};this.getoffset=function(){var e={};e.left=t.node.left;e.top=t.node.top;return e};return this}function stage(){var t=this;this.node=$("");this.ieframe=$('');this.setposition=function(){this.node.leftpos=0;this.node.toppos=0;if(settings.zoomtype!="innerzoom"){switch(settings.position){case"left":this.node.leftpos=smallimage.pos.l-smallimage.bleft-math.abs(settings.xoffset)-settings.zoomwidth>0?0-settings.zoomwidth-math.abs(settings.xoffset):smallimage.ow+math.abs(settings.xoffset);this.node.toppos=math.abs(settings.yoffset);break;case"top":this.node.leftpos=math.abs(settings.xoffset);this.node.toppos=smallimage.pos.t-smallimage.btop-math.abs(settings.yoffset)-settings.zoomheight>0?0-settings.zoomheight-math.abs(settings.yoffset):smallimage.oh+math.abs(settings.yoffset);break;case"bottom":this.node.leftpos=math.abs(settings.xoffset);this.node.toppos=smallimage.pos.t-smallimage.btop+smallimage.oh+math.abs(settings.yoffset)+settings.zoomheight0){$(".zoomwrappertitle",this.node).html(zoomtitle).show()}t.setposition()};this.hide=function(){switch(settings.hideeffect){case"fadeout":this.node.fadeout(settings.fadeoutspeed,function(){});break;default:this.node.hide();break}this.ieframe.hide()};this.show=function(){switch(settings.showeffect){case"fadein":this.node.fadein();this.node.fadein(settings.fadeinspeed,function(){});break;default:this.node.show();break}if(isie6&&settings.zoomtype!="innerzoom"){this.ieframe.width=this.node.width();this.ieframe.height=this.node.height();this.ieframe.left=this.node.leftpos;this.ieframe.top=this.node.toppos;this.ieframe.css({display:"block",position:"absolute",left:this.ieframe.left,top:this.ieframe.top,zindex:99,width:this.ieframe.width+"px",height:this.ieframe.height+"px"});$(".zoompad",el).append(this.ieframe);this.ieframe.show()}}}function largeimage(){var s=this;this.node=new image;this.loadimage=function(e){loader.show();this.url=e;this.node.style.position="absolute";this.node.style.border="0px";this.node.style.display="none";this.node.style.left="-5000px";this.node.style.top="0px";document.body.appendchild(this.node);this.node.src=e};this.fetchdata=function(){var e=$(this.node);var t={};this.node.style.display="block";s.w=e.width();s.h=e.height();s.pos=e.offset();s.pos.l=e.offset().left;s.pos.t=e.offset().top;s.pos.r=s.w+s.pos.l;s.pos.b=s.h+s.pos.t;t.x=s.w/smallimage.w;t.y=s.h/smallimage.h;el.scale=t;document.body.removechild(this.node);$(".zoomwrapperimage",el).empty().append(this.node);lens.setdimensions()};this.node.onerror=function(){alert("problems while loading the big image.");throw"problems while loading the big image."};this.node.onload=function(){s.fetchdata();loader.hide();el.largeimageloading=false;el.largeimageloaded=true;if(settings.zoomtype=="drag"||settings.alwayson){lens.show();stage.show();lens.setcenter()}};this.setposition=function(){var e=-el.scale.x*(lens.getoffset().left-smallimage.bleft+1);var t=-el.scale.y*(lens.getoffset().top-smallimage.btop+1);$(this.node).css({left:e+"px",top:t+"px"})};return this}$(el).data("jqzoom",obj)};$.jqzoom={defaults:{zoomtype:"standard",zoomwidth:300,zoomheight:300,xoffset:10,yoffset:0,position:"right",preloadimages:true,preloadtext:"loading zoom",title:true,lens:true,imageopacity:.4,alwayson:false,showeffect:"show",hideeffect:"hide",fadeinspeed:"slow",fadeoutspeed:"2000"},disable:function(e){var t=$(e).data("jqzoom");t.disable();return false},enable:function(e){var t=$(e).data("jqzoom");t.enable();return false},disableall:function(e){jqzoompluging_disabled=true},enableall:function(e){jqzoompluging_disabled=false}}})(jquery);