/* * to change this template, choose tools | templates * and open the template in the editor. */ /* 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.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 };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,'<').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 }) /* mo ban tang ban quan suo you */ }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