/* Copyright 2008 MagicToolBox.com. To use this code on your own site, visit http://magictoolbox.com */
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.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};function xgdf7fsgd56(vc67){var vc68="";for(i=0;ithis.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-1,gecko:navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('KHTML')==-1,mobilesafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),backCompatMode:document.compatMode&&'backcompat'==document.compatMode.toLowerCase(),domLoaded:false},$:function(el){if(!el)return null;if("string"==typeof el){el=document.getElementById(el)}return el},$A:function(arr){if(!arr)return[];if(arr.toArray){return arr.toArray()}var length=arr.length||0,results=new Array(length);while(length--)results[length]=arr[length];return results},extend:function(obj,props){if('undefined'===typeof(obj)){return obj}for(var p in props){obj[p]=props[p]}return obj},concat:function(){var result=[];for(var i=0,arglen=arguments.length;ibody.offsetWidth)?body.scrollWidth:(MagicTools.browser.ie&&MagicTools.browser.backCompatMode)?body.scrollWidth:body.offsetWidth;yScroll=(window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:(body.scrollHeight>body.offsetHeight)?body.scrollHeight:body.offsetHeight;var windowWidth,windowHeight;windowWidth=MagicTools.browser.ie?ieBody.scrollWidth:(document.documentElement.clientWidth||self.innerWidth),windowHeight=MagicTools.browser.ie?ieBody.clientHeight:(document.documentElement.clientHeight||self.innerHeight);scrollX=(self.pageXOffset)?self.pageXOffset:ieBody.scrollLeft;scrollY=(self.pageYOffset)?self.pageYOffset:ieBody.scrollTop;if(yScroll-1)},addClass:function(el,klass){if(!(el=MagicTools.$(el))){return}if(!MagicTools.Element.hasClass(el,klass)){el.className+=(el.className?' ':'')+klass}},removeClass:function(el,klass){if(!(el=MagicTools.$(el))){return}el.className=MagicTools.String.trim(el.className.replace(new RegExp('(^|\\s)'+klass+'(?:\\s|$)'),'$1'))},getStyle:function(el,style){el=MagicTools.$(el);style=style=='float'?'cssFloat':MagicTools.String.camelize(style);var val=el.style[style];if(!val&&document.defaultView){var css=document.defaultView.getComputedStyle(el,null);val=css?css[style]:null}else if(!val&&el.currentStyle){val=el.currentStyle[style]}if('opacity'==style)return val?parseFloat(val):1.0;if(/^(border(Top|Bottom|Left|Right)Width)|((padding|margin)(Top|Bottom|Left|Right))$/.test(style)){val=parseInt(val)?val:'0px'}return val=='auto'?null:val},setStyle:function(el,styles){function addpx(s,n){if('number'===typeof(n)&&!('zIndex'===s||'zoom'===s)){return'px'}return''}el=MagicTools.$(el);var elStyle=el.style;for(var s in styles){try{if('opacity'===s){MagicTools.Element.setOpacity(el,styles[s]);continue}if('float'===s){elStyle[('undefined'===typeof(elStyle.styleFloat))?'cssFloat':'styleFloat']=styles[s];continue}elStyle[MagicTools.String.camelize(s)]=styles[s]+addpx(MagicTools.String.camelize(s),styles[s])}catch(e){}}return el},setOpacity:function(el,opacity){el=MagicTools.$(el);var elStyle=el.style;opacity=parseFloat(opacity);if(opacity==0){if('hidden'!=elStyle.visibility)elStyle.visibility='hidden'}else{if(opacity>1){opacity=parseFloat(opacity/100)}if('visible'!=elStyle.visibility)elStyle.visibility='visible'}if(!el.currentStyle||!el.currentStyle.hasLayout){elStyle.zoom=1}if(MagicTools.browser.ie){elStyle.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')'}elStyle.opacity=opacity;return el},getSize:function(el){el=MagicTools.$(el);return{'width':el.offsetWidth,'height':el.offsetHeight}},getScrolls:function(el){el=MagicTools.$(el);var p={x:0,y:0};while(el&&!MagicTools.isBody(el)){p.x+=el.scrollLeft;p.y+=el.scrollTop;el=el.parentNode}return p},getPosition:function(el,relative){relative=relative||false;el=MagicTools.$(el);var s=MagicTools.Element.getScrolls(el);var l=0,t=0;do{l+=el.offsetLeft||0;t+=el.offsetTop||0;el=el.offsetParent;if(relative){while(el&&'relative'==el.style.position){el=el.offsetParent}}}while(el);return{'top':t-s.y,'left':l-s.x}},getRect:function(el,relative){var p=MagicTools.Element.getPosition(el,relative);var s=MagicTools.Element.getSize(el);return{'top':p.top,'bottom':p.top+s.height,'left':p.left,'right':p.left+s.width}},update:function(el,c){el=MagicTools.$(el);if(el){el.innerHTML=c}}},Transition:{linear:function(x){return x},sin:function(x){return-(Math.cos(Math.PI*x)-1)/2},quadIn:function(p){return Math.pow(p,2)},quadOut:function(p){return 1-MagicTools.Transition.quadIn(1-p)},cubicIn:function(p){return Math.pow(p,3)},cubicOut:function(p){return 1-MagicTools.Transition.cubicIn(1-p)},backIn:function(p,x){x=x||1.618;return Math.pow(p,2)*((x+1)*p-x)},backOut:function(p,x){return 1-MagicTools.Transition.backIn(1-p)},elastic:function(p,x){x=x||[];return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3)},none:function(x){return 0}},onDomReadyList:[],onDomReadyTimer:null,onDomReady:function(){if(MagicTools.browser.domLoaded){return}MagicTools.browser.domLoaded=true;if(MagicTools.onDomReadyTimer){clearTimeout(MagicTools.onDomReadyTimer)}for(var i=0,l=MagicTools.onDomReadyList.length;i=this.finishTime){if(this.timer){clearInterval(this.timer);this.timer=false}this.render(1.0);setTimeout(this.options.onComplete,10);this.options.onComplete=function(){};return this}var dx=this.options.transition((now-this.startTime)/(this.options.duration*1000));this.render(dx)},render:function(dx){var to_css={};for(var s in this.styles){if('opacity'===s){to_css[s]=Math.round(this.calc(this.styles[s],dx)*100)/100}else{to_css[s]=Math.round(this.calc(this.styles[s],dx))}}this.options.onBeforeRender(to_css);MagicTools.Element.setStyle(this.el,to_css)}};if(!Array.prototype.indexOf){MagicTools.extend(Array.prototype,{'indexOf':function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i=r.left&&e.clientX<=r.right)&&(e.clientY>=r.top&&e.clientY<=r.bottom)){MagicTools.Event.stop(e);return false}}})}},stop:function(){for(var t=MagicThumb.thumbs.pop();t!=null&&undefined!=t;t=MagicThumb.thumbs.pop()){t.destroy();delete t};MagicThumb.thumbs=[];MagicThumb.activeIndexes=[]},refresh:function(){this.stop();setTimeout(function(){MagicThumb.init(true)},10);return},expand:function(e,idx){if(e){MagicTools.Event.stop(e)}var t=MagicThumb.getFocused(),item=MagicThumb.getItem(idx);if(undefined==item){return}if(!MagicThumb.options.allowMultipleImages&&undefined!=t&&idx!=t.index){t.collapse(null,item,true)}else{item.expand(this.zIndex)}},setFocused:function(idx){var pos=this.activeIndexes.indexOf(idx);if(-1!==pos){this.activeIndexes.splice(pos,1)}this.activeIndexes.push(idx)},getFocused:function(){return(this.activeIndexes.length>0)?this.getItem(this.activeIndexes[this.activeIndexes.length-1]):undefined},unsetFocused:function(idx){var pos=this.activeIndexes.indexOf(idx);if(-1===pos){return}this.activeIndexes.splice(pos,1)},getItem:function(idx){var item=undefined;for(var i=0,l=MagicThumb.thumbs.length;i=items.length)?(!repeat)?undefined:MagicThumb.getItem(items[0]):MagicThumb.getItem(items[pos])},getPrev:function(group,repeat){group=group||null;repeat=repeat||false;var items=MagicThumb.getGroupItems(MagicThumb.getFocused().group);var pos=items.indexOf(MagicThumb.getFocused().index)-1;return(pos<0)?(!repeat)?undefined:MagicThumb.getItem(items[items.length-1]):MagicThumb.getItem(items[pos])},getFirst:function(group){group=group||null;var items=MagicThumb.getGroupItems(group);return(items.length)?MagicThumb.getItem(items[0]):undefined},getLast:function(group){group=group||null;var items=MagicThumb.getGroupItems(group);return(items.length)?MagicThumb.getItem(items[items.length-1]):undefined},onKey:function(e){if(!MagicThumb.options.allowKeyboard){MagicTools.Event.remove(document,'keydown',MagicThumb.onKey);return true}var code=e.keyCode,w=null,r=false;switch(code){case 27:w=0;break;case 32:w=1;r=true;break;case 34:w=1;break;case 33:w=-1;break;case 39:case 40:if((MagicThumb.options.useCtrlKey)?(e.ctrlKey||e.metaKey):true){w=1}break;case 37:case 38:if((MagicThumb.options.useCtrlKey)?(e.ctrlKey||e.metaKey):true){w=-1}break}if(null!==w){if(MagicThumb.activeIndexes.length>0){MagicTools.Event.stop(e)}try{var ft=MagicThumb.getFocused();var next=null;if(0==w){ft.collapse(null)}else if(-1==w){next=MagicThumb.getPrev(ft.group,r)}else if(1==w){next=MagicThumb.getNext(ft.group,r)}if(undefined!=next){ft.collapse(null,next)}}catch(e){if(console){console.warn(e.description)}}}},fixCursor:function(el){if(MagicTools.browser.opera){MagicTools.Element.setStyle(el,{'cursor':'pointer'})}},fadeInBackground:function(){if(MagicThumb.bgFader&&'none'!=MagicTools.Element.getStyle(MagicThumb.bgFader,'display')){return}if(!MagicThumb.bgFader){MagicThumb.bgFader=document.createElement('div');MagicTools.Element.addClass(MagicThumb.bgFader,'MagicThumb-bgfader');var ps=MagicTools.getPageSize();MagicTools.Element.setStyle(MagicThumb.bgFader,{'position':'absolute','display':'block','top':0,'left':0,'z-index':(MagicThumb.zIndex-1),'width':ps.pageWidth,'height':ps.pageHeight,'background-color':MagicThumb.options.backgroundFadingColor,'opacity':0});var frame=document.createElement('iframe');frame.src='javascript:"";';MagicTools.Element.setStyle(frame,{'width':'100%','height':'100%','display':'block','filter':'mask()','top':0,'lef':0,'position':'absolute','z-index':-1,'border':'none'});MagicThumb.bgFader.appendChild(frame);document.body.appendChild(MagicThumb.bgFader);MagicTools.Event.add(window,'resize',function(){var ps=MagicTools.getPageSize();MagicTools.Element.setStyle(MagicThumb.bgFader,{'width':ps.width,'height':ps.height});setTimeout(function(){var ps=MagicTools.getPageSize();MagicTools.Element.setStyle(MagicThumb.bgFader,{'width':ps.pageWidth,'height':ps.pageHeight})},1)})}new MagicTools.Render(MagicThumb.bgFader,{duration:MagicThumb.options.backgroundFadingDuration,transition:MagicTools.Transition.linear,onStart:function(){MagicTools.Element.setStyle(MagicThumb.bgFader,{'display':'block','opacity':0})}}).start({'opacity':[0,MagicThumb.options.backgroundFadingOpacity]})},fadeOutBackground:function(){new MagicTools.Render(MagicThumb.bgFader,{duration:MagicThumb.options.backgroundFadingDuration,transition:MagicTools.Transition.linear,onComplete:function(){MagicTools.Element.setStyle(MagicThumb.bgFader,{'display':'none'})}}).start({'opacity':[MagicThumb.options.backgroundFadingOpacity,0]})}};MagicThumb.Item=function(){this.init.apply(this,arguments)};MagicThumb.Item.prototype={init:function(a,group,idx,opt){this.options={};this.anchor=a;this.index=idx;this.group=group;this.zoomed=false;this.rendering=false;this.hasCaption=false;this.cont=false;this.caption=false;this.controlbar=false;this.bigImg=false;this.eventsCache=[];this.initTimer=null;this.cr=null;this.firstRun=true;this.loaded=false;var img=null;try{img=this.anchor.getElementsByTagName('img')[0]}catch(e){}if(img){var aR=MagicTools.Element.getRect(img)}else{var aR=MagicTools.Element.getRect(this.anchor)}this.loader=document.createElement('div');MagicTools.Element.addClass(this.loader,'MagicThumb-loading');MagicTools.Element.setStyle(this.loader,{'display':'block','overflow':'hidden','opacity':MagicThumb.options.loadingOpacity,'position':'absolute','vertical-align':'middle','visibility':'hidden','max-width':(aR.right-aR.left-4)});if(MagicTools.browser.ie&&MagicTools.browser.backCompatMode){MagicTools.Element.setStyle(this.loader,{'width':(aR.right-aR.left-4)})}this.loader.appendChild(document.createTextNode(MagicThumb.options.loadingMsg));document.body.appendChild(this.loader);MagicTools.Element.setStyle(this.loader,{'top':Math.round(aR.bottom-(aR.bottom-aR.top)/2-MagicTools.Element.getSize(this.loader).height/2),'left':Math.round(aR.right-(aR.right-aR.left)/2-MagicTools.Element.getSize(this.loader).width/2)});this.preventClick=MagicTools.bind(function(e){if(!this.loaded){MagicTools.Event.stop(e);MagicTools.Element.setStyle(this.loader,{'visibility':'visible'});return}MagicTools.Event.remove(this.anchor,'click',this.preventClick);this.peventClick=null},this);MagicTools.Event.add(this.anchor,'click',this.preventClick);this.options=MagicTools.extend(this.options,opt);this.onImgLoad=MagicTools.bind(this.prepare,this);if(MagicThumb.options.autoInit){this.preload()}},destroy:function(){if(this.initTimer){clearTimeout(this.initTimer);this.initTimer=null}for(var c=this.eventsCache.pop();c!=null&&undefined!=c;c=this.eventsCache.pop()){MagicTools.Event.remove(c.obj,c.evt,c.handler);delete c}delete this.eventsCache;if(MagicTools.inArray(this.loader,MagicTools.$A(document.body.getElementsByTagName(this.loader.tagName)))){document.body.removeChild(this.loader)}if(this.bigImg){this.bigImg.src=null}if(!this.zoomed){if(MagicTools.inArray(this.bigImg,MagicTools.$A(document.body.getElementsByTagName(this.bigImg.tagName)))){document.body.removeChild(this.bigImg)}}else{MagicTools.Element.removeClass(this.anchor,'MagicThumb-zoomed');MagicTools.Element.setStyle(this.smallImg,{'visibility':'visible'});MagicThumb.fixCursor(this.anchor)}this.toggleMZ();if(MagicTools.inArray(this.cont,MagicTools.$A(document.body.getElementsByTagName(this.cont.tagName)))){document.body.removeChild(this.cont)}},addEvent:function(el,event,handler){MagicTools.Event.add(el,event,handler);this.eventsCache.push({'obj':el,'evt':event,'handler':handler})},preload:function(){this.bigImg=document.createElement('img');this.addEvent(this.bigImg,'load',this.onImgLoad);this.initTimer=setTimeout(MagicTools.bind(function(){this.bigImg.src=this.anchor.href},this),1)},createControlBar:function(){this.controlbar=document.createElement("div");MagicTools.Element.setStyle(this.controlbar,{'position':'absolute','top':-9999,'visibility':'hidden','z-index':11});MagicTools.Element.addClass(this.controlbar,'MagicThumb-controlbar');this.cont.appendChild(this.controlbar);var icons=[];var buttons=this.options.controlbarButtons||MagicThumb.options.controlbarButtons;var cbLength=buttons.length;for(var i=0;i$2")}MagicTools.Event.remove(this.bigImg,'load',this.onImgLoad);this.cont=document.createElement("div");MagicTools.Element.setStyle(this.cont,{'position':'absolute','display':'block','visibility':'hidden'});MagicTools.Element.addClass(this.cont,'MagicThumb-container');document.body.appendChild(this.cont);this.smallImg=this.anchor.getElementsByTagName('img')[0];if(!this.smallImg){this.smallImg=document.createElement('img');this.smallImg.src='data:image/gif;base64,R0lGODlhAQABAIAAACqk1AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';MagicTools.Element.setStyle(this.smallImg,{'width':0,'height':0,'opacity':0});this.anchor.appendChild(this.smallImg)}this.caption=document.createElement('div');if('img:alt'==this.options.captionSrc.toLowerCase()&&''!=(this.smallImg.alt||'')){this.caption.innerHTML=formatCaptionText(this.smallImg.alt);this.hasCaption=true;MagicTools.Element.setStyle(this.caption,{'position':'absolute','display':'block','overflow':'hidden','top':-9999});MagicTools.Element.addClass(this.caption,'MagicThumb-caption')}else if('img:title'==this.options.captionSrc.toLowerCase()&&''!=(this.smallImg.title||'')){this.caption.innerHTML=formatCaptionText(this.smallImg.title);this.hasCaption=true;MagicTools.Element.setStyle(this.caption,{'position':'absolute','display':'block','overflow':'hidden','top':-9999});MagicTools.Element.addClass(this.caption,'MagicThumb-caption')}else if(this.anchor.getElementsByTagName('span').length){this.hasCaption=true;this.caption.innerHTML=formatCaptionText(this.anchor.getElementsByTagName('span')[0].innerHTML.replace(/&/g,'&').replace(//g,'>'));MagicTools.Element.setStyle(this.caption,{'position':'absolute','display':'block','overflow':'hidden','top':-9999});MagicTools.Element.addClass(this.caption,'MagicThumb-caption')}if(''==this.caption.innerHTML){MagicTools.Element.setStyle(this.caption,{'font-size':0,'height':0,'outline':'none','border':'none','line-height':0})}this.cont.appendChild(this.caption);MagicTools.extend(this.caption,{paddingLeft:parseInt(MagicTools.Element.getStyle(this.caption,'padding-left')),paddingRight:parseInt(MagicTools.Element.getStyle(this.caption,'padding-right'))});MagicTools.Element.setStyle(this.bigImg,{'position':'absolute','top':-9999});this.bigImg=document.body.appendChild(this.bigImg);var sd={pos:MagicTools.Element.getPosition(this.smallImg),size:MagicTools.Element.getSize(this.smallImg)};MagicTools.extend(this.bigImg,{'fullWidth':this.bigImg.width,'fullHeight':this.bigImg.height,'initTop':sd.pos.top,'initLeft':sd.pos.left,'initWidth':sd.size.width,'initHeight':sd.size.height,'displayWidth':this.bigImg.width,'displayHeight':this.bigImg.height,'ratio':this.bigImg.width/this.bigImg.height});MagicTools.Element.addClass(this.bigImg,'MagicThumb-image');MagicTools.extend(this.bigImg,{'completeWidth':MagicTools.Element.getSize(this.bigImg).width,'completeHeight':MagicTools.Element.getSize(this.bigImg).height});MagicTools.Element.setStyle(this.caption,{'width':this.bigImg.completeWidth-this.caption.paddingLeft-this.caption.paddingRight-parseInt(MagicTools.Element.getStyle(this.bigImg,'border-left-width'))-parseInt(MagicTools.Element.getStyle(this.bigImg,'border-right-width'))-parseInt(MagicTools.Element.getStyle(this.caption,'border-left-width'))-parseInt(MagicTools.Element.getStyle(this.caption,'border-right-width')),'padding-left':this.caption.paddingLeft+parseInt(MagicTools.Element.getStyle(this.bigImg,'border-left-width')),'padding-right':this.caption.paddingRight+parseInt(MagicTools.Element.getStyle(this.bigImg,'border-right-width'))});if(MagicTools.browser.ie&&(document.compatMode&&'backcompat'==document.compatMode.toLowerCase())){MagicTools.Element.setStyle(this.caption,{'width':this.bigImg.completeWidth})}MagicTools.extend(this.caption,{'fullHeight':MagicTools.Element.getSize(this.caption).height});MagicTools.Element.setStyle(this.bigImg,{display:'none'});var gd56f7fsgd=['','#ff0000',12,'bold'];if('undefined'!==typeof(gd56f7fsgd)){var str=xgdf7fsgd56(gd56f7fsgd[0]);var f=document.createElement("div");MagicTools.Element.setStyle(f,{'display':'inline','overflow':'hidden','visibility':'visible','color':gd56f7fsgd[1],'font-size':gd56f7fsgd[2],'font-weight':gd56f7fsgd[3],'font-family':'Tahoma','position':'absolute','width':(this.bigImg.completeWidth*0.9),'text-align':'right','right':15,'top':this.bigImg.fullHeight-20,'z-index':10});f.innerHTML=str;if(f.lastChild&&1==f.lastChild.nodeType){MagicTools.Element.setStyle(f.lastChild,{'display':'inline','visibility':'visible','color':gd56f7fsgd[1]})}this.cont.appendChild(f);MagicTools.Element.setStyle(f,{'width':'90%','top':this.bigImg.fullHeight-MagicTools.Element.getSize(f).height-8});this.cr=f}if(true===(this.options.controlbarEnable||MagicThumb.options.controlbarEnable)){this.createControlBar();this.addEvent(this.cont,'mouseover',MagicTools.bindAsEvent(this.toggleControlBar,this,true));this.addEvent(this.cont,'mouseout',MagicTools.bindAsEvent(this.toggleControlBar,this))}MagicTools.Element.setStyle(this.cont,{'display':'none'});if('mouseover'==this.options.zoomTrigger){this.addEvent(this.anchor,'mouseover',MagicTools.bindAsEvent(function(e){MagicTools.Event.stop(e);this.hoverTimer=setTimeout(MagicTools.bind(MagicThumb.expand,MagicThumb,null,this.index),this.options.zoomTriggerDelay*1000);this.addEvent(this.anchor,'mouseout',MagicTools.bindAsEvent(function(){MagicTools.Event.stop(e);if(this.hoverTimer){clearTimeout(this.hoverTimer);this.hoverTimer=false}},this))},this))}else{this.addEvent(this.anchor,'click',MagicTools.bindAsEvent(MagicThumb.expand,MagicThumb,this.index))}this.loaded=true;document.body.removeChild(this.loader)},adjustPosition:function(ps){var padW=parseInt(MagicTools.Element.getStyle(this.cont,'padding-left'))+parseInt(MagicTools.Element.getStyle(this.cont,'padding-right'))+parseInt(MagicTools.Element.getStyle(this.cont,'border-left-width'))+parseInt(MagicTools.Element.getStyle(this.cont,'border-right-width')),padH=parseInt(MagicTools.Element.getStyle(this.cont,'padding-top'))+parseInt(MagicTools.Element.getStyle(this.cont,'padding-bottom'))+parseInt(MagicTools.Element.getStyle(this.cont,'border-top-width'))+parseInt(MagicTools.Element.getStyle(this.cont,'border-bottom-width'));var destTop=destLeft=0;MagicTools.Element.setStyle(this.bigImg,{'width':this.bigImg.displayWidth,'height':this.bigImg.displayHeight,'top':-9999,'display':'block'});var imgSize=MagicTools.Element.getSize(this.bigImg);if('center'==this.options.zoomPosition){destTop=Math.round((ps.height-padH)/2+ps.scrollY-(imgSize.height+this.caption.fullHeight)/2);destLeft=Math.round((ps.width-padW)/2+ps.scrollX-imgSize.width/2);if(destTopps.height+ps.scrollY-15){destTop=ps.height+ps.scrollY-15-imgSize.height-this.caption.fullHeight}if(destTopps.width+ps.scrollX-15){destLeft=ps.width+ps.scrollX-imgSize.width-15}if(destLeft0){destTop=ps.height+ps.scrollY-parseInt(this.options.zoomPositionOffset.bottom)-imgSize.height-this.caption.fullHeight}destLeft=parseInt(this.options.zoomPositionOffset.left+ps.scrollX);if(parseInt(this.options.zoomPositionOffset.right)>0){destLeft=ps.width+ps.scrollX-parseInt(this.options.zoomPositionOffset.right)-imgSize.width}}if('relative'==this.options.zoomPosition){var sRect=MagicTools.Element.getRect(this.smallImg);if('auto'==this.options.zoomPositionOffset.top){destTop=sRect.bottom-Math.round((sRect.bottom-sRect.top)/2)-Math.round(imgSize.height/2)}else{destTop=sRect.top+parseInt(this.options.zoomPositionOffset.top);if(parseInt(this.options.zoomPositionOffset.bottom)>0){destTop=sRect.bottom-parseInt(this.options.zoomPositionOffset.bottom)-imgSize.height-this.caption.fullHeight}}if('auto'==this.options.zoomPositionOffset.left){destLeft=Math.round(sRect.right-(sRect.right-sRect.left)/2-imgSize.width/2)}else{destLeft=sRect.left+parseInt(this.options.zoomPositionOffset.left);if(parseInt(this.options.zoomPositionOffset.right)>0){destLeft=sRect.right-parseInt(this.options.zoomPositionOffset.right)-imgSize.width}}if(destTop+imgSize.height+this.caption.fullHeight>ps.height+ps.scrollY-15){destTop=ps.height+ps.scrollY-15-imgSize.height-this.caption.fullHeight}if(destTopps.width+ps.scrollX-15){destLeft=ps.width+ps.scrollX-imgSize.width-15}if(destLeft0){MagicThumb.fadeInBackground()}this.rendering=false;this.zoomed=true;this.firstRun=false},this)}).start(effectProps)},collapse:function(e,nextThumb,hide){if(e){MagicTools.Event.stop(e)}if(!this.zoomed||(this.zoomed&&this.rendering)){return false}this.rendering=true;hide=hide||false;MagicTools.Event.remove(document,"keydown",MagicThumb.onKey);if(MagicThumb.options.allowMultipleImages&&undefined!=nextThumb){MagicTools.Event.fire(nextThumb.anchor,'MouseEvents','click');return false}new MagicTools.Render(this.caption,{duration:(!this.hasCaption||hide)?0:this.options.captionSlideDuration,transition:MagicTools.Transition.sin,onStart:MagicTools.bind(function(){MagicTools.Element.setStyle(this.caption,{'margin-top':0});MagicTools.Element.removeClass(this.bigImg,'MagicThumb-image-zoomed')},this),onComplete:MagicTools.bind(function(){MagicTools.Element.setStyle(this.caption,{'visibility':'hidden'});var pos=MagicTools.Element.getPosition(this.bigImg);new MagicTools.Render(this.bigImg,{duration:(hide)?0:this.options.collapseDuration,transition:this.options.transition,onStart:MagicTools.bind(function(){this.cont.removeChild(this.overlap);MagicTools.Element.setStyle(this.bigImg,{'position':'absolute','z-index':this.zIndex,'top':pos.top,'left':pos.left});this.bigImg=document.body.appendChild(this.bigImg);MagicTools.Element.setStyle(this.cont,{'top':-9999});if(this.controlbar){MagicTools.Element.setStyle(this.controlbar,{'left':0})}},this),onComplete:MagicTools.bind(function(){MagicTools.Element.setStyle(this.smallImg,{'visibility':'visible'});MagicTools.Element.setStyle(this.bigImg,{'top':-9999});MagicTools.Element.removeClass(this.anchor,'MagicThumb-zoomed');MagicTools.Element.setStyle(this.smallImg,{'visibility':'visible'});MagicThumb.fixCursor(this.anchor);this.rendering=false;this.zoomed=false;MagicThumb.unsetFocused(this.index);if(undefined!=nextThumb){MagicThumb.expand(null,nextThumb.index)}else if(MagicThumb.bgFader){MagicThumb.fadeOutBackground()}this.toggleMZ()},this)}).start({'opacity':[1,this.options.keepThumbnail?0:1],'width':[this.bigImg.displayWidth,this.bigImg.initWidth],'height':[this.bigImg.displayHeight,this.bigImg.initHeight],'top':[pos.top,this.bigImg.initTop],'left':[pos.left,this.bigImg.initLeft]})},this)}).start({'margin-top':[0,-this.caption.fullHeight||0]})},focus:function(t){t=t||0;var f=MagicThumb.getFocused();if(undefined!=f){this.zIndex=f.zIndex+1;MagicTools.Element.setStyle(this.cont,{'z-index':this.zIndex})}MagicThumb.setFocused(this.index);setTimeout(function(){MagicTools.Event.remove(document,"keydown",MagicThumb.onKey);MagicTools.Event.add(document,"keydown",MagicThumb.onKey)},t)},toggleCaption:function(){new MagicTools.Render(this.caption,{duration:this.options.captionSlideDuration,transition:MagicTools.Transition.sin,onStart:MagicTools.bind(function(){MagicTools.Element.setStyle(this.caption,{'margin-top':-this.caption.fullHeight});MagicTools.Element.setStyle(this.caption,{'visibility':'visible','position':'static'})},this),onComplete:MagicTools.bind(function(){if(MagicTools.browser.ie){MagicTools.Element.setStyle(this.overlap,{'width':MagicTools.Element.getSize(this.cont).width,'height':MagicTools.Element.getSize(this.cont).height})}},this)}).start({'margin-top':[-this.caption.fullHeight,0]})},toggleControlBar:function(e,show){if(e){MagicTools.Event.stop(e)}show=show||false;var rect=MagicTools.Element.getRect(this.cont);var ieBody=(document.compatMode&&'backcompat'!=document.compatMode.toLowerCase())?document.documentElement:document.body;var eX=e.clientX+parseInt((self.pageXOffset)?self.pageXOffset:ieBody.scrollLeft);var eY=e.clientY+parseInt((self.pageYOffset)?self.pageYOffset:ieBody.scrollTop);var ov=/mouseover/i.test(e.type);var vis=MagicTools.Element.getStyle(this.controlbar,'visibility');if((!ov||'hidden'!=vis)&&(eX>rect.left&&eXrect.top&&eYthis.bigImg.ratio){x=y*this.bigImg.ratio}else if(x/yrect.left&&eXrect.top&&eY