var MagicZoom_ua='msie'; var W=navigator.userAgent.toLowerCase(); if(W.indexOf("opera")!=-1){ MagicZoom_ua='opera' }else if(W.indexOf("msie")!=-1){ MagicZoom_ua='msie' }else if(W.indexOf("safari")!=-1){ MagicZoom_ua='safari' }else if(W.indexOf("mozilla")!=-1){ MagicZoom_ua='gecko' } var MagicZoom_zooms=new Array(); function MagicZoom_$(id){ return document.getElementById(id) }; function MagicZoom_getStyle(el,styleProp){ if(el.currentStyle){ var y=el.currentStyle[styleProp];y=parseInt(y)?y:'0px' }else if(window.getComputedStyle){ var css=document.defaultView.getComputedStyle(el,null); var y=css?css[styleProp]:null }else{ y=el.style[styleProp]; y=parseInt(y)?y:'0px' } return y }; function MagicZoom_getBounds(e){ if(e.getBoundingClientRect){ var r=e.getBoundingClientRect(); var wx=0; var wy=0; if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){ wy=document.body.scrollTop; wx=document.body.scrollLeft }else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){ wy=document.documentElement.scrollTop; wx=document.documentElement.scrollLeft } return{'left':r.left+wx,'top':r.top+wy,'right':r.right+wx,'bottom':r.bottom+wy} } } function MagicZoom_getEventBounds(e){ var x=0; var y=0; if(MagicZoom_ua=='msie'){ y=e.clientY; x=e.clientX; if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){ y=e.clientY+document.body.scrollTop; x=e.clientX+document.body.scrollLeft }else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){ y=e.clientY+document.documentElement.scrollTop; x=e.clientX+document.documentElement.scrollLeft } }else{ y=e.clientY; x=e.clientX; y+=window.pageYOffset; x+=window.pageXOffset }return{'x':x,'y':y} } function MagicView_ia(){ return false }; var MagicZoom_extendElement=function(){ var args=arguments; if(!args[1]) args=[this,args[0]]; for(var property in args[1]) args[0][property]=args[1][property]; return args[0] }; function MagicZoom_addEventListener(obj,event,listener){ if(MagicZoom_ua=='gecko'||MagicZoom_ua=='opera'||MagicZoom_ua=='safari'){ try{ obj.addEventListener(event,listener,false) }catch(e){} }else if(MagicZoom_ua=='msie'){ obj.attachEvent("on"+event,listener) } }; function MagicZoom_removeEventListener(obj,event,listener){ if(MagicZoom_ua=='gecko'||MagicZoom_ua=='opera'||MagicZoom_ua=='safari'){ obj.removeEventListener(event,listener,false) }else if(MagicZoom_ua=='msie'){ obj.detachEvent("on"+event,listener) } }; function MagicZoom_concat(){ var result=[]; for(var i=0;i'+this.settings['; this.smallImageCont.appendChild(this.loadingCont) } this.baseuri=''; this.safariOnLoadStarted=false; MagicZoom_zooms.push(this); this.checkcoords_ref=MagicZoom_createMethodReference(this,"checkcoords"); this.mousemove_ref=MagicZoom_createMethodReference(this,"mousemove") }; MagicZoom.prototype.stopZoom=function(){ MagicZoom_removeEventListener(window.document,"mousemove",this.checkcoords_ref); MagicZoom_removeEventListener(this.smallImageCont,"mousemove",this.mousemove_ref); if(this.settings["position"]=="custom"){ MagicZoom_$(this.smallImageCont.id+"-big").removeChild(this.bigImageCont) }else{ this.smallImageCont.removeChild(this.bigImageCont) } this.smallImageCont.removeChild(this.pup) }; MagicZoom.prototype.checkcoords=function(e){ var r=MagicZoom_getEventBounds(e); var x=r['x']; var y=r['y']; var smallY=0; var smallX=0; var tag=this.smallImage; while(tag&&tag.tagName!="BODY"&&tag.tagName!="HTML"){ smallY+=tag.offsetTop; smallX+=tag.offsetLeft; tag=tag.offsetParent } if(MagicZoom_ua=='msie'){ var r=MagicZoom_getBounds(this.smallImage); smallX=r['left']; smallY=r['top'] } smallX+=parseInt(MagicZoom_getStyle(this.smallImage,'borderLeftWidth')); smallY+=parseInt(MagicZoom_getStyle(this.smallImage,'borderTopWidth')); if(MagicZoom_ua!='msie'||!(document.compatMode&&'backcompat'==document.compatMode.toLowerCase())){ smallX+=parseInt(MagicZoom_getStyle(this.smallImage,'paddingLeft')); smallY+=parseInt(MagicZoom_getStyle(this.smallImage,'paddingTop')) } if(x>parseInt(smallX+this.smallImageSizeX)){ this.hiderect(); return false } if(xparseInt(smallY+this.smallImageSizeY)){ this.hiderect(); return false } if(y=this.smallImageSizeX){ this.positionX=this.smallImageSizeX-this.popupSizeX/2 }if((this.positionY+this.popupSizeY/2)>=this.smallImageSizeY){ this.positionY=this.smallImageSizeY-this.popupSizeY/2 }if((this.positionX-this.popupSizeX/2)<=0){ this.positionX=this.popupSizeX/2 }if((this.positionY-this.popupSizeY/2)<=0){ this.positionY=this.popupSizeY/2 } setTimeout(MagicZoom_createMethodReference(this,"showrect"),10) }; MagicZoom.prototype.showrect=function(){ var pleft=this.positionX-this.popupSizeX/2; var ptop=this.positionY-this.popupSizeY/2; var perX=pleft*(this.bigImageSizeX/this.smallImageSizeX); var perY=ptop*(this.bigImageSizeY/this.smallImageSizeY); if(document.documentElement.dir=='rtl'){ perX=(this.positionX+this.popupSizeX/2-this.smallImageSizeX)*(this.bigImageSizeX/this.smallImageSizeX) } pleft+=parseInt(MagicZoom_getStyle(this.smallImage,'borderLeftWidth')); ptop+=parseInt(MagicZoom_getStyle(this.smallImage,'borderTopWidth')); if(MagicZoom_ua!='msie'||!(document.compatMode&&'backcompat'==document.compatMode.toLowerCase())){ pleft+=parseInt(MagicZoom_getStyle(this.smallImage,'paddingLeft')); ptop+=parseInt(MagicZoom_getStyle(this.smallImage,'paddingTop')) } this.pup.style.left=pleft+'px'; this.pup.style.top=ptop+'px'; this.pup.style.visibility="visible"; if((this.bigImageSizeX-perX)(parseInt(this.bigImageCont.style.height)-headerH)){ if((this.bigImageSizeY-perY)<(parseInt(this.bigImageCont.style.height)-headerH)){ perY=this.bigImageSizeY-parseInt(this.bigImageCont.style.height)+headerH } } this.bigImage.style.left=(-perX)+'px'; this.bigImage.style.top=(-perY)+'px'; this.bigImageCont.style.top=this.bigImageContStyleTop; this.bigImageCont.style.display='block'; this.bigImageCont.style.visibility='visible'; this.bigImage.style.display='block'; this.bigImage.style.visibility='visible'; this.recalculating=false }; MagicZoom.prototype.hiderect=function(){ if(this.settings&&this.settings["bigImage_always_visible"]==true) return; if(this.pup){ this.pup.style.visibility="hidden" } this.bigImageCont.style.top='-10000px'; if(MagicZoom_ua=='msie'){ this.smallImageCont.style.zIndex=0 } }; MagicZoom.prototype.recalculatePopupDimensions=function(){ this.popupSizeX=parseInt(this.bigImageCont.style.width)/(this.bigImageSizeX/this.smallImageSizeX); if(this.settings&&this.settings["header"]!=""){ this.popupSizeY=(parseInt(this.bigImageCont.style.height)-19)/(this.bigImageSizeY/this.smallImageSizeY) }else{ this.popupSizeY=parseInt(this.bigImageCont.style.height)/(this.bigImageSizeY/this.smallImageSizeY) } if(this.popupSizeX>this.smallImageSizeX){ this.popupSizeX=this.smallImageSizeX } if(this.popupSizeY>this.smallImageSizeY){ this.popupSizeY=this.smallImageSizeY } this.popupSizeX=Math.round(this.popupSizeX); this.popupSizeY=Math.round(this.popupSizeY); if(!(document.compatMode&&'backcompat'==document.compatMode.toLowerCase())){ var bw=parseInt(MagicZoom_getStyle(this.pup,'borderLeftWidth')); this.pup.style.width=(this.popupSizeX-2*bw)+'px'; this.pup.style.height=(this.popupSizeY-2*bw)+'px' }else{ this.pup.style.width=this.popupSizeX+'px'; this.pup.style.height=this.popupSizeY+'px' } }; MagicZoom.prototype.initPopup=function(){ this.pup=document.createElement("DIV"); this.pup.className='MagicZoomPup'; this.pup.style.zIndex=10; this.pup.style.visibility='hidden'; this.pup.style.position='absolute'; this.pup.style["opacity"]=parseFloat(this.settings['opacity']/100.0); this.pup.style["-moz-opacity"]=parseFloat(this.settings['opacity']/100.0); this.pup.style["-html-opacity"]=parseFloat(this.settings['opacity']/100.0); this.pup.style["filter"]="alpha(Opacity="+this.settings['opacity']+")"; this.smallImageCont.appendChild(this.pup); this.recalculatePopupDimensions(); this.smallImageCont.unselectable="on"; this.smallImageCont.style.MozUserSelect="none"; this.smallImageCont.onselectstart=MagicView_ia; this.smallImageCont.oncontextmenu=MagicView_ia }; MagicZoom.prototype.initBigContainer=function(){ var bigimgsrc=this.bigImage.src; if(this.bigImageSizeY0){ var zoom=MagicZoom_zooms.pop(); zoom.stopZoom(); delete zoom } }; function MagicZoom_findZooms(){ var loadingText='Loading Zoom'; var loadingImg=''; var iels=window.document.getElementsByTagName("IMG"); for(var i=0;i