var panzoom=function(){var cvi_sztimer,cvi_szactive,cvi_szimage=null;return{image:null,add:function(img,options){options=options||{};var id,roundTo=function(val,dig){var num=val;if(val>8191&&val<10485){val=val-5000;num=Math.round(val*Math.pow(10,dig))/Math.pow(10,dig);num=num+5000}else{num=Math.round(val*Math.pow(10,dig))/Math.pow(10,dig)}return num},tmp,uniqueID=function(){var val=Date.parse(new Date())+Math.floor(Math.random()*100000000000);return val.toString(16)};if(!img.controlsId){if(document.images&&panzoom.get&&document.getElementsByTagName){if(img.naturalWidth&&img.naturalHeight){img.xfactor=roundTo(img.naturalWidth/img.width,4);img.yfactor=roundTo(img.naturalHeight/img.height,4);img.maxwidth=img.naturalWidth;img.maxheight=img.naturalHeight}else{tmp=new Image();tmp.src=img.src;img.xfactor=roundTo(tmp.width/img.width,4);img.yfactor=roundTo(tmp.height/img.height,4);img.maxwidth=tmp.width;img.maxheight=tmp.height;tmp=null}img.borderColor=options.borderColor||'#369b93';img.borderWidth=options.borderWidth||2;img.cursorPath=options.cursorPath||'/assets/cursors/';img.overview=options.overview||true;img.overviewHighlight=options.overviewHighlight||'#fe0002';img.overviewOpacity=options.overviewOpacity?parseInt(Math.min(Math.max(0,options.overviewOpacity),100),10):75;img.overviewSize=(options.overviewSize?parseInt(Math.min(Math.max(10,options.overviewSize),50),10):25)/100;img.zoomDelay=options.zoomDelay?parseInt(Math.min(Math.max(5,options.zoomDelay),100),10):50;img.zoomin=img.zoomout=false;img.style.visibility='visible';img.parentNode.style.position=(img.parentNode.style.position=='static'||img.parentNode.style.position===''?'relative':img.parentNode.style.position);img.parentNode.style.height=img.height+'px';img.parentNode.style.width=img.width+'px';img.parentNode.style.padding='0px';img.parentNode.style.overflow='hidden';img.parentNode.style.MozUserSelect='none';img.parentNode.style.KhtmlUserSelect='none';img.parentNode.unselectable='on';img.parentNode.style.border=img.borderWidth+'px solid '+img.borderColor;img.style.MozUserSelect='none';img.style.KhtmlUserSelect='none';img.unselectable='on';img.style.display='block';img.style.position='absolute';img.left=0;img.top=0;img.style.left='0px';img.style.top='0px';img.minwidth=img.width;img.minheight=img.height;img.maxleft=img.maxwidth-img.minwidth;img.maxtop=img.maxheight-img.minheight;img.style.width=img.width+'px';img.style.height=img.height+'px';img.style.cursor='crosshair';img.pointer=img.style.cursor;img.trident=window.msie?1:0;img.webkit=window.webkit?1:0;img.gecko=window.gecko?1:0;img.presto=window.opera?1:0;img.bmode=(img.trident&&(document.compatMode=='BackCompat'||document.compatMode=='QuirksMode')?true:false);if(img.id===''){img.id=uniqueID()}id=img.id;img.parentNode.appendChild(document.set('div',{'id':img.id+'_Controls','style':'cursor:default;display:block;height:30px;font-size:1px;left:3px;line-height:1px;position:absolute;top:3px;width:'+img.width+'px'},[document.set('a',{'class':'zoom-in','id':img.id+'_ZoomInLink','onclick':function(event){panzoom.setCursor(this,1,id);event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:0px;position:absolute;top:0px;width:30px;','title':'Click or Press the [+] Key to Zoom In'},'Zoom In'),document.set('a',{'class':'zoom-out','id':img.id+'_ZoomOutLink','onclick':function(event){panzoom.setCursor(this,0,id);event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:30px;position:absolute;top:0px;width:30px;','title':'Click or Press the [-] Key to Zoom Out'},'Zoom Out'),document.set('a',{'class':'zoom-info','id':img.id+'_InfoLink','onclick':function(event){alert('To pan (move the image), do one of the following:\n\n• Click and drag the image\n• Press the up arrow on your keyboard to move up.\n• Press the down arrow on your keyboard to move down.\n• Press the left arrow on your keyboard to move left.\n• Press the right arrow on your keyboard to move right.\n\nHolding Shift down while pressing an arrow key makes the image move faster, while holding Alt down makes the image move slower.\n\nAdditionally, you can zoom in or out by pressing the + or - keys.\nYou can also move the cursor over the image and use the mouse scroll wheel to zoom in or out.');event.preventDefault()},'style':'cursor:pointer;display:block;height:24px;position:absolute;right:36px;top:4px;width:24px;','title':'Info'},'Info'),document.set('a',{'class':'zoom-close','id':img.id+'_CloseLink','onclick':function(event){lightbox.end();event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;position:absolute;right:6px;top:0px;width:30px;','title':'Close'},'Close')]));img.controlsId=img.id+'_Controls';img.zoomInLinkId=img.id+'_ZoomInLink';img.zoomOutLinkId=img.id+'_ZoomOutLink';img.parentNode.appendChild(document.set('div',{'id':img.id+'_zoomLevel','style':'color:#ffffff;cursor:default;display:block;filter:alpha(opacity=100);font-family:Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:bold;height:30px;left:70px;line-height:30px;opacity:1;overflow:hidden;position:absolute;top:3px;visibility:hidden;width:9em;'},[document.set('div',{'style':'background-color:#000000;display:block;filter:alpha(opacity=60);height:30px;left:0px;opacity:0.6;position:absolute;top:0px;width:9em;'}),document.set('div',{'id':img.id+'_zoomLevelText','style':'color:#ffffff;display:block;filter:alpha(opacity=100);height:30px;left:0px;overflow:hidden;position:absolute;text-align:center;top:0px;vertical-align:middle;width:9em;'},'100 / '+parseInt(img.xfactor*100,10)+' %')]));img.zoomLevelId=img.id+'_zoomLevel';img.zoomLevelTextId=img.id+'_zoomLevelText';img.parentNode.appendChild(document.set('div',{'id':img.id+'_overview','style':'border-top:'+img.borderWidth+'px solid '+img.borderColor+';border-left:'+img.borderWidth+'px solid '+img.borderColor+';bottom:0px;display:block;height:'+(img.height*img.overviewSize)+'px;position:absolute;right:0px;visibility:hidden;width:'+(img.width*img.overviewSize)+'px;-khtml-user-select:none;-moz-user-select:none;-webkit-user-select:none;','unselectable':'on'},[document.set('img',{'onmousedown':panzoom.catchDrag,'src':img.src,'style':'bottom:0px;display:block;height:'+(img.height*img.overviewSize)+'px;position:absolute;right:0px;width:'+(img.width*img.overviewSize)+'px;'}),document.set('div',{'id':img.id+'_overviewHighlight','maxleft':0,'maxtop':0,'onmousedown':panzoom.startMove,'style':'border:1px solid '+img.overviewHighlight+';display:block;font-size:1px;height:'+parseInt((img.height*img.overviewSize)-(img.bmode?0:2),10)+'px;left:0px;line-height:1px;position:absolute;top:0px;width:'+parseInt((img.width*img.overviewSize)-(img.bmode?0:2),10)+'px;'})]));if(img.trident){panzoom.get(img.id+'_overviewHighlight').style.background='url("'+img.cursorPath+'nop.gif") transparent';panzoom.get(img.id+'_overviewHighlight').style.filter='alpha(opacity='+img.overviewOpacity+')'}else{panzoom.get(img.id+'_overviewHighlight').style.opacity=img.overviewOpacity/100}img.overviewId=img.id+'_overview';img.overviewHighlightId=img.id+'_overviewHighlight';img.parentNode.appendChild(document.set('div',{'id':img.id+'_PanControls','style':'bottom:3px;cursor:default;display:block;height:90px;font-size:1px;left:3px;line-height:1px;position:absolute;width:60px'},[document.set('a',{'class':'pan-up','id':img.id+'_ZoomInLink','onmousedown':function(event){cvi_szactive=this.parentNode.parentNode.getElementsByTagName('img')[0].id;cvi_szimage=true;panzoom.panKey(0,32,false,false)},'onmouseup':function(){cvi_szimage=false},'onclick':function(event){event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:15px;position:absolute;top:0px;width:30px;','title':'Click or Press the [Up] Key to Pan Up'},'Pan Up'),document.set('a',{'class':'pan-down','id':img.id+'_ZoomOutLink','onmousedown':function(event){cvi_szactive=this.parentNode.parentNode.getElementsByTagName('img')[0].id;cvi_szimage=true;panzoom.panKey(0,-32,false,false)},'onmouseup':function(){cvi_szimage=false},'onclick':function(event){event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:15px;position:absolute;top:60px;width:30px;','title':'Click or Press the [Down] Key to Pan Down'},'Pan Down'),document.set('a',{'class':'pan-left','id':img.id+'_ZoomInLink','onmousedown':function(event){cvi_szactive=this.parentNode.parentNode.getElementsByTagName('img')[0].id;cvi_szimage=true;panzoom.panKey(-32,0,false,false)},'onmouseup':function(){cvi_szimage=false},'onclick':function(event){event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:30px;position:absolute;top:30px;width:30px;','title':'Click or Press the [Left] Key to Pan Left'},'Pan Left'),document.set('a',{'class':'pan-right','id':img.id+'_ZoomInLink','onmousedown':function(event){cvi_szactive=this.parentNode.parentNode.getElementsByTagName('img')[0].id;cvi_szimage=true;panzoom.panKey(32,0,false,false)},'onmouseup':function(){cvi_szimage=false},'onclick':function(event){event.preventDefault()},'style':'cursor:pointer;display:block;height:30px;left:0px;position:absolute;top:30px;width:30px;','title':'Click or Press the [Right] Key to Pan Right'},'Pan Right')]));img.panControlsId=img.id+'_PanControls';img.oncontextmenu=function(){return false};img.onmousedown=panzoom.catchKey;img.onmouseover=panzoom.catchOver;img.onmouseout=panzoom.catchOut}else{img.style.visibility='visible'}}return false},remove:function(img){if(img&&typeof img.controlsId==='string'){var elements='overviewId,zoomLevelId,controlsId,panControlsId'.split(','),i,parent=img.parentNode;img.onmousedown=img.onmousemove=null;document.onmousemove=document.onmouseup=document.onkeydown=document.onkeyup=document.onkeypress=null;if(img.gecko){window.removeEventListener('DOMMouseScroll',panzoom.catchWheel,false)}else{window.onmousewheel=null}for(i=0;i<elements.length;i+=1){parent.removeChild(panzoom.get(img[elements[i]]))}img.width=img.minwidth;img.height=img.minheight;img.left=img.top=0;img.style.width=img.minwidth+'px';img.style.height=img.minheight+'px';img.style.left='0px';img.style.top='0px';img.style.cursor='default';img.controlsId=false}return false},moveto:function(img,x,y){var h,minmaxFloat=function(v,i,x){var d=parseFloat(v);if(d>x){d=x}else if(d<i){d=i}return d},v,view;if(img&&x&&y&&typeof img.controlsId==='string'){if(img.width>img.minwidth||img.height>img.minheight){if(typeof x=='string'){if(x.match(/^([+\-])?\d*([\.])?\d*$/)){x=Math.round((minmaxFloat(x,-180,180)+180)*(img.maxwidth/360))}else if(x.match(/^\d*([\.])?\d*([%]){1,1}$/)){x=Math.round(img.maxwidth*(Math.max(0,Math.min(100,parseFloat(x)))/100))}else{x=0}}if(typeof y=='string'){if(y.match(/^([+\-])?\d*([\.])?\d*$/)){y=Math.round(((minmaxFloat(y,-90,90)*-1)+90)*(img.maxheight/180))}else if(y.match(/^\d*([\.])?\d*([%]){1,1}$/)){y=Math.round(img.maxheight*(Math.max(0,Math.min(100,parseFloat(y)))/100))}else{y=0}}h=Math.max(0,Math.min(img.maxleft,(x*(img.width/img.maxwidth))-(img.minwidth/2)));v=Math.max(0,Math.min(img.maxtop,(y*(img.height/img.maxheight))-(img.minheight/2)));img.style.left=(h*-1)+'px';img.style.top=(v*-1)+'px';img.left=(h*-1);img.top=(v*-1);if(img.overview){view=panzoom.get(img.overviewHighlightId).style;view.left=Math.round((Math.abs(parseInt(img.style.left,10))/(img.width/img.minwidth))*img.overviewSize)-(img.bmode?2:0)+'px';view.top=Math.round((Math.abs(parseInt(img.style.top,10))/(img.height/img.minheight))*img.overviewSize)-(img.bmode?2:0)+'px'}}}return false},get:function(v){return document.getElementById(v)},setOverview:function(img){var view=panzoom.get(img.overviewHighlightId);view.style.width=(Math.round((img.overviewSize*img.minwidth)/(img.width/img.minwidth))-(img.bmode?0:2))+'px';view.style.height=(Math.round((img.overviewSize*img.minheight)/(img.height/img.minheight))-(img.bmode?0:2))+'px';view.style.left=Math.round((Math.abs(img.left)/(img.width/img.minwidth))*img.overviewSize)-(img.bmode?2:0)+'px';view.style.top=Math.round((Math.abs(img.top)/(img.height/img.minheight))*img.overviewSize)-(img.bmode?2:0)+'px';view.maxleft=(img.minwidth*img.overviewSize)-(img.bmode?0:2)-parseInt(view.style.width,10);view.maxtop=(img.minheight*img.overviewSize)-(img.bmode?0:2)-parseInt(view.style.height,10)},findXY:function(ele){var d={x:ele.offsetLeft,y:ele.offsetTop},t;if(ele.offsetParent){t=panzoom.findXY(ele.offsetParent);d.x+=t.x;d.y+=t.y}return d},getMousePosition:function(ex,ey,px,py){var k={ox:0,oy:0,ex:ex,ey:ey},ox,oy;if(self.pageXOffset||self.pageYOffset){ox=self.pageXOffset;if(ox>0&&px==ex){ex-=ox}oy=self.pageYOffset;if(oy>0&&py==ey){ey-=oy}}else if(document.documentElement){ox=document.documentElement.scrollLeft;oy=document.documentElement.scrollTop}else if(document.body){ox=document.body.scrollLeft;oy=document.body.scrollTop}k.ox=ox;k.oy=oy;k.ex=ex;k.ey=ey;return k},setCursor:function(element,d,id){var img=panzoom.get(id);img.zoomin=img.zoomout=false;element.removeClass('zoomhover');panzoom.get(d==1?img.zoomOutLinkId:img.zoomInLinkId).removeClass('zoomhover');if(d==1&&(parseInt(img.style.width,10)<img.maxwidth||parseInt(img.style.height,10)<img.maxheight)){element.addClass('zoomhover');img.zoomin=true;if(img.gecko){img.style.cursor='-moz-zoom-in'}else if(img.webkit){img.style.cursor='-webkit-zoom-in'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-in.cur"),crosshair'}else{img.style.cursor='crosshair'}}else if(d===0&&(parseInt(img.style.width,10)>img.minwidth||parseInt(img.style.height,10)>img.minheight)){element.addClass('zoomhover');img.zoomout=true;if(img.gecko){img.style.cursor='-moz-zoom-out'}else if(img.webkit){img.style.cursor='-webkit-zoom-out'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-out.cur"),crosshair'}else{img.style.cursor='crosshair'}}else{img.style.cursor=img.pointer}},zoomIn:function(id,ct,st,sw,ew,sh,eh,sx,ex,sy,ey){var mw,mh,mx,my,obj=panzoom.get(id);if(parseInt(obj.style.width,10)<obj.maxwidth||parseInt(obj.style.height,10)<obj.maxheight){clearInterval(cvi_sztimer);mw=Math.max(obj.minwidth,Math.min(obj.maxwidth,Math.round(ew*ct/st+sw)));mx=Math.round(ex*ct/st+sx);mh=Math.max(obj.minheight,Math.min(obj.maxheight,Math.round(eh*ct/st+sh)));my=Math.round(ey*ct/st+sy);obj.style.width=mw+'px';obj.style.height=mh+'px';obj.style.left=mx+'px';obj.style.top=my+'px';ct+=1;panzoom.get(obj.zoomLevelTextId).innerHTML=parseInt((mw/obj.minwidth)*100,10)+' / '+parseInt(obj.xfactor*100,10)+' %';cvi_sztimer=setInterval('panzoom.zoomIn("'+id+'",'+ct+','+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',obj.zoomDelay)}else{clearInterval(cvi_sztimer)}},zoomOut:function(id,rm,ct,st,sw,ew,sh,eh,sx,ex,sy,ey){var mw,mh,mx,my,obj=panzoom.get(id);if(parseInt(obj.style.width,10)>obj.minwidth||parseInt(obj.style.height,10)>obj.minheight){clearInterval(cvi_sztimer);mw=Math.max(obj.minwidth,Math.min(obj.maxwidth,Math.round(ew*ct/st+sw)));mx=Math.round(ex*ct/st+sx);mh=Math.max(obj.minheight,Math.min(obj.maxheight,Math.round(eh*ct/st+sh)));my=Math.round(ey*ct/st+sy);obj.style.width=mw+'px';obj.style.height=mh+'px';obj.style.left=mx+'px';obj.style.top=my+'px';ct+=1;panzoom.get(obj.zoomLevelTextId).innerHTML=parseInt((mw/obj.minwidth)*100,10)+' / '+parseInt(obj.xfactor*100,10)+' %';cvi_sztimer=setInterval('panzoom.zoomOut("'+id+'",'+rm+','+ct+','+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',obj.zoomDelay)}else{clearInterval(cvi_sztimer);if(obj.webkit&&rm){panzoom.stopZoom()}}},stopZoom:function(){var img=panzoom.image;document.onmouseup=null;clearInterval(cvi_sztimer);img.zoomin=img.zoomout=false;img.left=parseInt(img.style.left,10);img.top=parseInt(img.style.top,10);img.width=parseInt(img.style.width,10);img.height=parseInt(img.style.height,10);img.maxleft=img.width-img.minwidth;img.maxtop=img.height-img.minheight;if(img.width>img.minwidth||img.height>img.minheight){if(img.trident){img.style.cursor='url("'+img.cursorPath+'grab.cur"),move'}else{img.style.cursor='move'}if(img.overview){panzoom.setOverview(img);panzoom.get(img.overviewId).style.visibility='visible'}}else{img.style.cursor='crosshair';if(img.overview){panzoom.get(img.overviewId).style.visibility='hidden'}}panzoom.get(img.zoomInLinkId).removeClass('zoomhover');panzoom.get(img.zoomOutLinkId).removeClass('zoomhover');img.pointer=img.style.cursor;panzoom.get(img.zoomLevelTextId).innerHTML=parseInt((img.width/img.minwidth)*100,10)+' / '+parseInt(img.xfactor*100,10)+' %';cvi_sztimer=setInterval('panzoom.fadeInfo("'+img.id+'",100)',30);panzoom.image=null},catchDrag:function(e){return false},catchWheel:function(e){var d,v=0;e=e?e:window.event;if(e.wheelDelta){v=e.wheelDelta/120;d=(v<0?0:1)}else if(e.detail){v=-e.detail/3;d=(v<0?0:1)}if(cvi_szactive!==null&&v!==0){cvi_szimage=true;panzoom.initZoom(d,(d==1?2:1),true)}if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}return false},catchOver:function(e){cvi_szactive=this.id;if(this.trident){document.attachEvent('onmousewheel',panzoom.catchWheel)}else if(this.gecko){window.addEventListener('DOMMouseScroll',panzoom.catchWheel,false)}else{window.onmousewheel=document.onmousewheel=panzoom.catchWheel}document.onkeyup=panzoom.upKey;document.onkeypress=panzoom.pressKey;document.onkeydown=panzoom.downKey;return false},catchOut:function(){cvi_szactive=null;if(this.trident){document.detachEvent('onmousewheel',panzoom.catchWheel)}else if(this.gecko){window.removeEventListener('DOMMouseScroll',panzoom.catchWheel,false)}else{window.onmousewheel=document.onmousewheel=null}document.onkeydown=document.onkeypress=document.onkeyup=null},catchKey:function(e){e=e?e:window.event;clearInterval(cvi_sztimer);var eh,ew,ex,ey,img,k,mm=false,px=0,py=0,rm=false,sh,st,sw,sx,sy,t,zoomLevel;img=panzoom.image=this;zoomLevel=panzoom.get(img.zoomLevelId).style;if(e.which){mm=(e.which==2);rm=(e.which==3)}else if(e.button){mm=(e.button==4);rm=(e.button==2)}if(img.trident){zoomLevel.filter='alpha(opacity=100)'}else{zoomLevel.opacity=1}zoomLevel.visibility='hidden';ex=e.clientX;ey=e.clientY;if(e.pageX||e.pageY){px=e.pageX;py=e.pageY}k=panzoom.getMousePosition(ex,ey,px,py);t=panzoom.findXY(img.parentNode);img.mouseX=Math.min(Math.max(k.ex+k.ox-t.x,0),img.minwidth);img.mouseY=Math.min(Math.max(k.ey+k.oy-t.y,0),img.minheight);if(((e.altKey&&!e.shiftKey)||rm||img.zoomout)&&(img.width>img.minwidth||img.height>img.minheight)){if(img.gecko){img.style.cursor='-moz-zoom-out'}else if(img.webkit){img.style.cursor='-webkit-zoom-out'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-out.cur"),crosshair'}else{img.style.cursor='crosshair'}img.pointer=img.style.cursor;if(!img.zoomout){panzoom.get(img.zoomOutLinkId).addClass('zoomhover');img.zoomout=true}sw=img.width;ew=(img.width-img.minwidth)*-1;sh=img.height;eh=(img.height-img.minheight)*-1;sx=parseInt(img.style.left,10);ex=sx*-1;sy=parseInt(img.style.top,10);ey=sy*-1;st=Math.max(1,Math.round((img.width/img.minwidth)*3));document.onmouseup=panzoom.stopZoom;zoomLevel.visibility='visible';cvi_sztimer=setInterval('panzoom.zoomOut("'+img.id+'",'+rm+','+(img.webkit&&rm?1:0)+','+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',img.zoomDelay)}else if(((!e.altKey&&e.shiftKey)||mm||img.zoomin)&&(img.width<img.maxwidth||img.height<img.maxheight)){if(img.gecko){img.style.cursor='-moz-zoom-in'}else if(img.webkit){img.style.cursor='-webkit-zoom-in'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-in.cur"),crosshair'}else{img.style.cursor='crosshair'}img.pointer=img.style.cursor;if(!img.zoomin){panzoom.get(img.zoomInLinkId).addClass('zoomhover');img.zoomin=true}sw=img.width;ew=img.maxwidth-img.width;sh=img.height;eh=img.maxheight-img.height;sx=parseInt(img.style.left,10);sy=parseInt(img.style.top,10);ex=Math.max(0,Math.min(ew,Math.round(((img.mouseX-sx)*(img.maxwidth/img.width))-(img.minwidth*0.5)+sx)))*-1;ey=Math.max(0,Math.min(eh,Math.round(((img.mouseY-sy)*(img.maxheight/img.height))-(img.minheight*0.5)+sy)))*-1;st=Math.max(1,Math.round((img.maxwidth/img.width)*3));document.onmouseup=panzoom.stopZoom;zoomLevel.visibility='visible';cvi_sztimer=setInterval('panzoom.zoomIn("'+img.id+'",0,'+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',img.zoomDelay)}else if(img.width>img.minwidth||img.height>img.minheight){if(img.gecko){img.style.cursor='-moz-grabbing'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'grabbing.cur"),move'}else{img.style.cursor='move'}img.mouseX=e.clientX;img.mouseY=e.clientY;document.onmousemove=panzoom.whilePan;document.onmouseup=panzoom.stopPan}return false},downKey:function(e){var alt,escape,keycode,shift,w=false;if(!e){e=window.event;escape=27;keycode=e.keyCode}else{escape=e.DOM_VK_ESCAPE;keycode=e.which}alt=e.altKey;shift=e.shiftKey;switch(keycode){case 37:cvi_szimage=true;panzoom.panKey(8,0,shift,alt);break;case 38:cvi_szimage=true;panzoom.panKey(0,8,shift,alt);break;case 39:cvi_szimage=true;panzoom.panKey(-8,0,shift,alt);break;case 40:cvi_szimage=true;panzoom.panKey(0,-8,shift,alt);break;case escape:case 67:case 88:case escape:lightbox.end();break;case 43:case 61:case 107:case 187:if(cvi_szimage===null){cvi_szimage=true;panzoom.initZoom(1,4,w)}break;case 45:case 109:case 189:if(cvi_szimage===null){cvi_szimage=true;panzoom.initZoom(0,4,w)}break}return false},pressKey:function(e){return false},upKey:function(){if(cvi_szactive!==null){cvi_szimage=null}},initZoom:function(d,v,w){var eh,ew,ex,ey,img=panzoom.get(cvi_szactive),sh,st,sw,sx,sy;if(d===0&&(parseInt(img.style.width,10)>img.minwidth||parseInt(img.style.height,10)>img.minheight)){if(img.gecko){img.style.cursor='-moz-zoom-out'}else if(img.webkit){img.style.cursor='-webkit-zoom-out'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-out.cur"),crosshair'}else{img.style.cursor='crosshair'}img.pointer=img.style.cursor;sw=img.width;ew=(img.width-img.minwidth)*-1;sh=img.height;eh=(img.height-img.minheight)*-1;sx=parseInt(img.style.left,10);ex=sx*-1;sy=parseInt(img.style.top,10);ey=sy*-1;st=Math.max(1,Math.round((img.width/img.minwidth)*v));panzoom.zoomKey(d,(w?1:0),w,st,sw,ew,sh,eh,sx,ex,sy,ey)}else if(d==1&&(parseInt(img.style.width,10)<img.maxwidth||parseInt(img.style.height,10)<img.maxheight)){if(img.gecko){img.style.cursor='-moz-zoom-in'}else if(img.webkit){img.style.cursor='-webkit-zoom-in'}else if(img.trident){img.style.cursor='url("'+img.cursorPath+'zoom-in.cur"),crosshair'}else{img.style.cursor='crosshair'}img.pointer=img.style.cursor;sw=img.width;ew=img.maxwidth-img.width;sh=img.height;eh=img.maxheight-img.height;sx=parseInt(img.style.left,10);sy=parseInt(img.style.top,10);ex=Math.max(0,Math.min(ew,Math.round((((img.minwidth/2)-sx)*(img.maxwidth/img.width))-(img.minwidth*0.5)+sx)))*-1;ey=Math.max(0,Math.min(eh,Math.round((((img.minheight/2)-sy)*(img.maxheight/img.height))-(img.minheight*0.5)+sy)))*-1;st=Math.max(1,Math.round((img.maxwidth/img.width)*v));panzoom.zoomKey(d,(w?1:0),w,st,sw,ew,sh,eh,sx,ex,sy,ey)}},zoomKey:function(d,ct,ww,st,sw,ew,sh,eh,sx,ex,sy,ey){var img=panzoom.get(cvi_szactive),mh,mw,mx,my,setoverview=function(){if(img.width>img.minwidth||img.height>img.minheight){if(img.trident){img.style.cursor='url("'+img.cursorPath+'grab.cur"),move'}else{img.style.cursor='move'}if(img.overview){panzoom.setOverview(img);panzoom.get(img.overviewId).style.visibility='visible'}}else{img.style.cursor='crosshair';if(img.overview){panzoom.get(img.overviewId).style.visibility='hidden'}}img.pointer=img.style.cursor;panzoom.get(img.zoomLevelId).style.visibility='hidden'};if(cvi_szactive!==null){if(!img.zoomout&&!img.zoomin){if(d===0&&(parseInt(img.style.width,10)>img.minwidth||parseInt(img.style.height,10)>img.minheight)){mw=Math.max(img.minwidth,Math.min(img.maxwidth,Math.round(ew*ct/st+sw)));mx=Math.round(ex*ct/st+sx);mh=Math.max(img.minheight,Math.min(img.maxheight,Math.round(eh*ct/st+sh)));my=Math.round(ey*ct/st+sy);panzoom.get(img.zoomLevelId).style.visibility='visible';panzoom.get(img.zoomLevelTextId).innerHTML=parseInt((mw/img.minwidth)*100,10)+' / '+parseInt(img.xfactor*100,10)+' %';img.style.width=mw+'px';img.style.height=mh+'px';img.style.left=mx+'px';img.style.top=my+'px';img.width=mw;img.height=mh;img.left=mx;img.top=my;img.maxleft=img.width-img.minwidth;img.maxtop=img.height-img.minheight;ct+=1;if((cvi_szimage||ww)&&(img.width>img.minwidth||img.height>img.minheight)){if(!ww){setTimeout('panzoom.zoomKey('+d+','+ct+','+ww+','+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',50)}else{setoverview();if(cvi_szactive!==null){cvi_szimage=null}}}else{setoverview()}}else if(d==1&&(parseInt(img.style.width,10)<img.maxwidth||parseInt(img.style.height,10)<img.maxheight)){mw=Math.max(img.minwidth,Math.min(img.maxwidth,Math.round(ew*ct/st+sw)));mx=Math.round(ex*ct/st+sx);mh=Math.max(img.minheight,Math.min(img.maxheight,Math.round(eh*ct/st+sh)));my=Math.round(ey*ct/st+sy);panzoom.get(img.zoomLevelId).style.visibility='visible';panzoom.get(img.zoomLevelTextId).innerHTML=parseInt((mw/img.minwidth)*100,10)+' / '+parseInt(img.xfactor*100,10)+' %';img.style.width=mw+'px';img.style.height=mh+'px';img.style.left=mx+'px';img.style.top=my+'px';img.width=mw;img.height=mh;img.left=mx;img.top=my;img.maxleft=img.width-img.minwidth;img.maxtop=img.height-img.minheight;ct+=1;if((cvi_szimage||ww)&&(img.width<img.maxwidth||img.height<img.maxheight)){if(!ww){setTimeout('panzoom.zoomKey('+d+','+ct+','+ww+','+st+','+sw+','+ew+','+sh+','+eh+','+sx+','+ex+','+sy+','+ey+')',50)}else{setoverview();if(cvi_szactive!==null){cvi_szimage=null}}}else{setoverview()}}else{setoverview()}}}},panKey:function(h,v,s,a){if(cvi_szactive!==null){var img=panzoom.get(cvi_szactive),view,x,y;if(img.width>img.minwidth||img.height>img.minheight){x=Math.max(0,Math.min(img.maxleft,Math.abs(parseInt(img.style.left,10))-(s?4*h:a?h/4:h)));y=Math.max(0,Math.min(img.maxtop,Math.abs(parseInt(img.style.top,10))-(s?4*v:a?v/4:v)));img.style.left=(x*-1)+'px';img.style.top=(y*-1)+'px';img.left=(x*-1);img.top=(y*-1);if(img.overview){view=panzoom.get(img.overviewHighlightId).style;view.left=Math.round((Math.abs(parseInt(img.style.left,10))/(img.width/img.minwidth))*img.overviewSize)-(img.bmode?2:0)+'px';view.top=Math.round((Math.abs(parseInt(img.style.top,10))/(img.height/img.minheight))*img.overviewSize)-(img.bmode?2:0)+'px'}if(cvi_szimage){setTimeout('panzoom.panKey('+h+','+v+','+s+','+a+')',50)}}}},fadeInfo:function(id,opacity){clearInterval(cvi_sztimer);var img=panzoom.get(id),obj=panzoom.get(img.zoomLevelId);if(opacity>0&&cvi_szactive==img.id&&!img.zoomin&&!img.zoomout){if(img.trident){obj.style.filter='alpha(opacity='+opacity+')'}else{obj.style.opacity=opacity/100}opacity-=5;cvi_sztimer=setInterval('panzoom.fadeInfo("'+id+'",'+opacity+')',50)}else{if(img.trident){obj.style.filter='alpha(opacity=100)'}else{obj.style.opacity=1}obj.style.visibility='hidden'}},whilePan:function(e){e=e?e:window.event;var img=panzoom.image,x=Math.max(0,Math.min(img.maxleft,Math.abs(parseInt(img.style.left,10))-(e.clientX-img.mouseX))),y=Math.max(0,Math.min(img.maxtop,Math.abs(parseInt(img.style.top,10))-(e.clientY-img.mouseY)));img.style.left=(x*-1)+'px';img.style.top=(y*-1)+'px';img.left=(x*-1);img.top=(y*-1);img.mouseX=e.clientX;img.mouseY=e.clientY;return false},stopPan:function(){var img=panzoom.image,view;document.onmousemove=document.onmouseup=null;if(img.gecko||img.presto){img.style.cursor='move'}else{img.style.cursor=img.pointer}if(img.overview){view=panzoom.get(img.overviewHighlightId).style;view.left=Math.round((Math.abs(parseInt(img.style.left,10))/(img.width/img.minwidth))*img.overviewSize)-(img.bmode?2:0)+'px';view.top=Math.round((Math.abs(parseInt(img.style.top,10))/(img.height/img.minheight))*img.overviewSize)-(img.bmode?2:0)+'px'}panzoom.image=null},startMove:function(e){var view;if(!e){e=window.event;view=e.srcElement}else{view=e.target}cvi_szimage=view.parentNode.parentNode.getElementsByTagName('img')[0].id;view.style.cursor='default';view.mouseX=e.clientX;view.mouseY=e.clientY;document.onmousemove=panzoom.whileMove;document.onmouseup=panzoom.stopMove;return false},whileMove:function(e){var img,left,top,view,x,y;if(!e){e=window.event;view=e.srcElement}else{view=e.target}img=panzoom.get(cvi_szimage);if(view&&(/_overviewHighlight$/).test(view.id)&&view.maxleft&&view.maxtop){left=Math.max(0,Math.min(view.maxleft,Math.abs(parseInt(view.style.left,10))+(e.clientX-view.mouseX)));top=Math.max(0,Math.min(view.maxtop,Math.abs(parseInt(view.style.top,10))+(e.clientY-view.mouseY)));view.style.left=(left-(img.bmode?2:0))+'px';view.style.top=(top-(img.bmode?2:0))+'px';view.mouseX=e.clientX;view.mouseY=e.clientY;x=Math.max(0,Math.min(img.maxleft,Math.abs(left*(img.width/img.minwidth)*(1/img.overviewSize))));y=Math.max(0,Math.min(img.maxtop,Math.abs(top*(img.height/img.minheight)*(1/img.overviewSize))));img.style.left=(x*-1)+'px';img.style.top=(y*-1)+'px';img.left=(x*-1);img.top=(y*-1)}else{document.onmousemove=document.onmouseup=null;img.onmousedown=panzoom.catchKey;cvi_szimage=null}return false},stopMove:function(){document.onmousemove=document.onmouseup=null;panzoom.get(cvi_szimage).onmousedown=panzoom.catchKey;cvi_szimage=null}}}();