var includeCaption=1,zoomTime=5,zoomSteps=10,fade=1,minBorder=90,zoomImageURI="img/",debugShadow=0,myWidth=0,myHeight=0,myScroll=0,zoomOpen=false,preloadFrame=1,preloadActive=false,preloadTime=0,imgPreload=new Image,zoomActive=new Array,zoomTimer=new Array,zoomOrigW=new Array,zoomOrigH=new Array,zoomOrigX=new Array,zoomOrigY=new Array,zoomID="ZoomBox",theID="ZoomImage",theCap="ZoomCaption",theCapDiv="ZoomCapDiv";function setupZoom(){prepZooms();insertZoomHTML();zoomdiv=document.getElementById(zoomID);zoomimg=document.getElementById(theID)}function prepZooms(){if(!document.getElementsByTagName)return;var a=document.getElementsByTagName("a");for(i=0;i<a.length;i++)if(a[i].getAttribute("href")&&a[i].getAttribute("rel"))if(a[i].getAttribute("rel").indexOf("zoom:")==0)a[i].onclick=function(){zoomClick(this);return false}}function zoomPreload(a){var b=a.getAttribute("href");if(imgPreload.src.indexOf(a.getAttribute("href").substr(a.getAttribute("href").lastIndexOf("/")))==-1){preloadActive=true;imgPreload=new Image;imgPreload.onload=function(){preloadActive=false};imgPreload.src=b}}function preloadAnimStart(){preloadTime=new Date;document.getElementById("ZoomSpin").style.left=myWidth/2+"px";document.getElementById("ZoomSpin").style.top=myHeight/2+myScroll+"px";preloadFrame=1;document.getElementById("SpinImage").src=zoomImageURI+"zoom-spin-"+preloadFrame+".png";preloadAnimTimer=setInterval("preloadAnimPending()",100)}function preloadAnimPending(a){if(preloadActive!=false)if(new Date-preloadTime>1000){document.getElementById("ZoomSpin").style.visibility="visible";clearInterval(preloadAnimTimer);preloadAnimTimer=setInterval("preloadAnim()",100)}else;else{clearInterval(preloadAnimTimer);zoomIn(preloadFrom)}}function preloadAnim(a){if(preloadActive!=false){document.getElementById("SpinImage").src=zoomImageURI+"zoom-spin-"+preloadFrame+".png";preloadFrame++;if(preloadFrame>12)preloadFrame=1}else{document.getElementById("ZoomSpin").style.visibility="hidden";clearInterval(preloadAnimTimer);zoomIn(preloadFrom)}}function zoomClick(a){getSize();if(preloadActive==true){preloadFrom=a;preloadAnimStart()}else zoomIn(a)}function zoomIn(a){theRel=a.getAttribute("rel");var b=theRel.substring(5,theRel.length).split(",");if(b[0]==undefined||b[1]==undefined||b[2]==undefined)alert("Missing zoom arguments!");if(b[3]==undefined||b[3]==0||b[3]==1)rollOverImg="";else rollOverImg=b[3];image=a.getAttribute("href");var c=b[2];if(b[4]==1){var d=b[0];var e=b[1]}else{hostimgXX=document.getElementById(c);widthIni=hostimgXX.width;heightIni=hostimgXX.height;if(widthIni>heightIni){var d=b[0];var e=heightIni*d/widthIni}else{var e=b[1];var d=widthIni*e/heightIni}}if(zoomActive[theID]!=true){document.getElementById("ShadowBox").style.visibility="hidden";document.getElementById("ZoomClose").style.visibility="hidden";if(includeCaption==1){zoomcap=document.getElementById(theCap);zoomcapd=document.getElementById(theCapDiv);if(a.getAttribute("title")&&includeCaption==1){zoomcapd.style.display="block";zoomcap.innerHTML=a.getAttribute("title")}else zoomcapd.style.display="none"}zoomimg.src=image;hostimg=document.getElementById(c);startW=hostimg.width;startH=hostimg.height;if(startW==undefined&&startH==undefined){startW=50;startH=12}var f=0;var g=0;var h=hostimg;do{f+=h.offsetLeft;g+=h.offsetTop}while(h=h.offsetParent);zoomOrigW[theID]=startW;zoomOrigH[theID]=startH;zoomOrigX[theID]=f;zoomOrigY[theID]=g;zoomimg.style.width=startW+"px";zoomimg.style.height=startH+"px";zoomdiv.style.left=f+"px";zoomdiv.style.top=g+"px";if(fade==1)setOpacity(0,zoomID);zoomdiv.style.visibility="visible";sizeRatio=d/e;if(d>myWidth-minBorder){d=myWidth-minBorder;e=d/sizeRatio}if(e>myHeight-minBorder){e=myHeight-minBorder;d=e*sizeRatio}zoomCurrent=0;zoomAmountW=(d-startW)/zoomSteps;zoomAmountH=(e-startH)/zoomSteps;zoomAmountX=(myWidth/2-d/2-f)/zoomSteps;zoomAmountY=(myHeight/2-e/2-g+myScroll)/zoomSteps;if(fade==1){fadeCurrent=0;fadeAmount=(0-100)/zoomSteps}else fadeAmount=0;zoomimg.src=image;zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+e+", "+d+", "+zoomAmountH+", "+zoomAmountW+", "+zoomAmountX+", "+zoomAmountY+", "+zoomSteps+", "+fade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')",zoomTime);zoomActive[theID]=true}}function zoomOut(){if(zoomActive[theID]!=true){document.getElementById("ShadowBox").style.visibility="hidden";document.getElementById("ZoomClose").style.visibility="hidden";endH=zoomOrigH[theID];endW=zoomOrigW[theID];endX=zoomOrigX[theID];endY=zoomOrigY[theID];startH=zoomimg.height;startW=zoomimg.width;startX=parseInt(zoomdiv.style.left);startY=parseInt(zoomdiv.style.top);zoomCurrent=0;zoomAmountW=(endW-startW)/zoomSteps;zoomAmountH=(endH-startH)/zoomSteps;getSize();zoomAmountX=(endX-startX)/zoomSteps;zoomAmountY=(endY-startY)/zoomSteps;if(fade==1){fadeCurrent=0;fadeAmount=(100-0)/zoomSteps}else fadeAmount=0;zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+endH+", "+endW+", "+zoomAmountH+", "+zoomAmountW+", "+zoomAmountX+", "+zoomAmountY+", "+zoomSteps+", "+fade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')",zoomTime);zoomActive[theID]=true}}function zoomDoneIn(a,b){zoomOpen=true;if(debugShadow==1)setOpacity(0,"ZoomImage");setOpacity(0,"ShadowBox");setOpacity(0,"ZoomClose");a=document.getElementById(a);shadowdiv=document.getElementById("ShadowBox");shadowLeft=parseInt(a.style.left)-13;shadowTop=parseInt(a.style.top)-8;shadowWidth=a.offsetWidth+26;shadowHeight=a.offsetHeight+26;shadowdiv.style.width=shadowWidth+"px";shadowdiv.style.height=shadowHeight+"px";shadowdiv.style.left=shadowLeft+"px";shadowdiv.style.top=shadowTop+"px";document.getElementById("ShadowBox").style.visibility="visible";fadeElementSetup("ShadowBox",0,100,5);document.getElementById("ZoomClose").style.visibility="visible";fadeElementSetup("ZoomClose",0,100,5)}function zoomDone(a,b){zoomOpen=false;zoomOrigH[b]="";zoomOrigW[b]="";document.getElementById(a).style.visibility="hidden";zoomActive[b]==false}function zoomElement(zoomdiv,theID,zoomCurrent,zoomEndH,zoomEndW,zoomAmountH,zooomAmountW,zoomAmountX,zoomAmountY,zoomSteps,fade,fadeAmount,execWhenDone){zoomCurrent++;if(fade!=0)if(fadeAmount<0)setOpacity(Math.abs(zoomCurrent*fadeAmount),zoomdiv);else setOpacity(100-zoomCurrent*fadeAmount,zoomdiv);document.getElementById(zoomdiv).style.left=parseInt(document.getElementById(zoomdiv).style.left)+zoomAmountX+"px";document.getElementById(zoomdiv).style.top=parseInt(document.getElementById(zoomdiv).style.top)+zoomAmountY+"px";zoomimg.style.width=parseInt(zoomimg.style.width)+zoomAmountW+"px";zoomimg.style.height=parseInt(zoomimg.style.height)+zoomAmountH+"px";if(zoomCurrent==zoomSteps){zoomActive[theID]=false;clearInterval(zoomTimer[theID]);zoomimg.style.width=parseInt(zoomEndW)+"px";zoomimg.style.height=parseInt(zoomEndH)+"px";if(execWhenDone!="")eval(execWhenDone)}else{clearInterval(zoomTimer[theID]);zoomTimer[theID]=setInterval("zoomElement('"+zoomdiv+"', 'ZoomImage', "+zoomCurrent+", "+zoomEndH+", "+zoomEndW+", "+zoomAmountH+", "+zoomAmountW+", "+zoomAmountX+", "+zoomAmountY+", "+zoomSteps+", "+fade+", "+fadeAmount+", '"+execWhenDone+"')",zoomTime)}}function zoomMouseOver(){if(rollOverImg!="")if(document.getElementById("ZoomImage").src!=rollOverImg)document.getElementById("ZoomImage").src=rollOverImg}function zoomMouseOut(){if(rollOverImg!="")if(document.getElementById("ZoomImage").src!=image)document.getElementById("ZoomImage").src=image}function getSize(){if(document.all){myWidth=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;myHeight=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;myScroll=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop}else{myWidth=window.innerWidth;myHeight=window.innerHeight;myScroll=window.pageYOffset}}var fadeActive=new Array,fadeQueue=new Array,fadeTimer=new Array,fadeClose=new Array;function fadeElementSetup(a,b,c,d,e){if(fadeActive[a]==true)fadeQueue[a]=new Array(a,b,c,d);else{fadeSteps=d;fadeCurrent=0;fadeAmount=(b-c)/fadeSteps;fadeTimer[a]=setInterval("fadeElement('"+a+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')",40);fadeActive[a]=true;if(e==1)fadeClose[a]=true;else fadeClose[a]=false}}function fadeElement(a,b,c,d){b++;if(c<0)setOpacity(Math.abs(b*c),a);else setOpacity(100-b*c,a);if(b==d){clearInterval(fadeTimer[a]);fadeActive[a]=false;if(fadeClose[a]==true)document.getElementById(a).style.visibility="hidden";if(fadeQueue[a]&&fadeQueue[a]!=false){fadeElementSetup(fadeQueue[a][0],fadeQueue[a][1],fadeQueue[a][2],fadeQueue[a][3]);fadeQueue[a]=false}}else{clearInterval(fadeTimer[a]);fadeTimer[a]=setInterval("fadeElement('"+a+"', '"+b+"', '"+c+"', '"+d+"')",40)}}function setOpacity(a,b){var c=document.getElementById(b).style;if(navigator.userAgent.indexOf("Firefox")!=-1)if(a==100)a=99.999;c.filter="alpha(opacity="+a+")";c.KhtmlOpacity=a/100;c.MozOpacity=a/100;c.opacity=a/100}function insertZoomHTML(){var a=document.getElementsByTagName("body").item(0),b=document.createElement("div");b.setAttribute("id","ZoomSpin");b.style.position="absolute";b.style.left="10px";b.style.top="10px";b.style.visibility="hidden";b.style.zIndex="500";a.insertBefore(b,a.firstChild);var c=document.createElement("img");c.setAttribute("id","SpinImage");c.setAttribute("src",zoomImageURI+"zoom-spin-1.png");b.appendChild(c);var d=document.createElement("div");d.setAttribute("id","ZoomBox");d.style.position="absolute";d.style.left="10px";d.style.top="10px";d.style.visibility="hidden";d.style.zIndex="499";a.insertBefore(d,b.nextSibling);var e=document.createElement("a");e.setAttribute("href","javascript:zoomOut();");d.appendChild(e);var f=document.createElement("img");f.setAttribute("src",zoomImageURI+"spacer.gif");f.setAttribute("id","ZoomImage");f.setAttribute("border","0");f.setAttribute("onMouseOver","zoomMouseOver();");f.setAttribute("onMouseOut","zoomMouseOut();");f.style.display="block";f.style.width="10px";f.style.height="10px";e.appendChild(f);var g=document.createElement("div");g.setAttribute("id","ZoomClose");g.style.position="absolute";g.style.left="-15px";g.style.top="-15px";g.style.filter="alpha(opacity=0)";g.style.MozOpacity="0";g.style.opacity="0";g.style.visibility="hidden";d.appendChild(g);var h=document.createElement("a");h.setAttribute("href","javascript:zoomOut(1);");g.appendChild(h);var i=document.createElement("img");i.setAttribute("src",zoomImageURI+"closebox.png");i.setAttribute("width","30");i.setAttribute("height","30");i.setAttribute("border","0");h.appendChild(i);var j=document.createElement("div");j.setAttribute("id","ShadowBox");j.style.position="absolute";j.style.left="50px";j.style.top="50px";j.style.width="100px";j.style.height="100px";j.style.visibility="hidden";j.style.zIndex="45";a.insertBefore(j,d.nextSibling);var k=document.createElement("table");if(debugShadow==1)k.setAttribute("border","2");else k.setAttribute("border","0");k.setAttribute("width","100%");k.setAttribute("height","100%");k.setAttribute("cellpadding","0");k.setAttribute("cellspacing","0");j.appendChild(k);var l=document.createElement("tr");l.style.height="25px";k.appendChild(l);var m=document.createElement("td");m.style.width="27px";l.appendChild(m);var n=document.createElement("img");n.setAttribute("src",zoomImageURI+"zoom-shadow1.png");n.setAttribute("width","27");n.setAttribute("height","25");n.style.display="block";m.appendChild(n);var o=document.createElement("td");o.setAttribute("background",zoomImageURI+"zoom-shadow2.png");l.appendChild(o);var p=document.createElement("img");p.setAttribute("src",zoomImageURI+"spacer.gif");p.setAttribute("height","1");p.setAttribute("width","1");p.style.display="block";o.appendChild(p);var q=document.createElement("td");q.style.width="27px";l.appendChild(q);var r=document.createElement("img");r.setAttribute("src",zoomImageURI+"zoom-shadow3.png");r.setAttribute("width","27");r.setAttribute("height","25");r.style.display="block";q.appendChild(r);inRow2=document.createElement("tr");k.appendChild(inRow2);var s=document.createElement("td");s.setAttribute("background",zoomImageURI+"zoom-shadow4.png");inRow2.appendChild(s);var t=document.createElement("img");t.setAttribute("src",zoomImageURI+"spacer.gif");t.setAttribute("height","1");t.setAttribute("width","1");t.style.display="block";s.appendChild(t);var u=document.createElement("td");u.setAttribute("bgcolor","#ffffff");inRow2.appendChild(u);var v=document.createElement("img");v.setAttribute("src",zoomImageURI+"spacer.gif");v.setAttribute("height","1");v.setAttribute("width","1");v.style.display="block";u.appendChild(v);var w=document.createElement("td");w.setAttribute("background",zoomImageURI+"zoom-shadow5.png");inRow2.appendChild(w);var x=document.createElement("img");x.setAttribute("src",zoomImageURI+"spacer.gif");x.setAttribute("height","1");x.setAttribute("width","1");x.style.display="block";w.appendChild(x);var y=document.createElement("tr");y.style.height="26px";k.appendChild(y);var z=document.createElement("td");z.style.width="27px";y.appendChild(z);var A=document.createElement("img");A.setAttribute("src",zoomImageURI+"zoom-shadow6.png");A.setAttribute("width","27");A.setAttribute("height","26");A.style.display="block";z.appendChild(A);var B=document.createElement("td");B.setAttribute("background",zoomImageURI+"zoom-shadow7.png");y.appendChild(B);var C=document.createElement("img");C.setAttribute("src",zoomImageURI+"spacer.gif");C.setAttribute("height","1");C.setAttribute("width","1");C.style.display="block";B.appendChild(C);var D=document.createElement("td");D.style.width="27px";y.appendChild(D);var E=document.createElement("img");E.setAttribute("src",zoomImageURI+"zoom-shadow8.png");E.setAttribute("width","27");E.setAttribute("height","26");E.style.display="block";D.appendChild(E);if(includeCaption==1){var F=document.createElement("div");F.setAttribute("id","ZoomCapDiv");F.style.display="none";F.style.marginLeft="13px";F.style.marginRight="13px";j.appendChild(F);var G=document.createElement("table");G.setAttribute("border","0");G.setAttribute("cellpadding","0");G.setAttribute("cellspacing","0");G.setAttribute("align","center");F.appendChild(G);var H=document.createElement("tr");G.appendChild(H);var I=document.createElement("td");H.appendChild(I);var J=document.createElement("img");J.setAttribute("src",zoomImageURI+"zoom-caption-l.png");J.setAttribute("width","13");J.setAttribute("height","26");J.style.display="block";I.appendChild(J);var K=document.createElement("td");K.setAttribute("background",zoomImageURI+"zoom-caption-fill.png");K.setAttribute("id","ZoomCaption");K.setAttribute("valign","middle");K.style.fontSize="14px";K.style.fontFamily="Helvetica";K.style.fontWeight="bold";K.style.color="#ffffff";K.style.textShadow="0px 2px 4px #000000";K.style.whiteSpace="nowrap";H.appendChild(K);var L=document.createElement("td");H.appendChild(L);var M=document.createElement("img");M.setAttribute("src",zoomImageURI+"zoom-caption-r.png");M.setAttribute("width","13");M.setAttribute("height","26");M.style.display="block";L.appendChild(M)}}