var includeCaption=true,zoomTime=5,zoomSteps=15,includeFade=1,minBorder=90,shadowSettings="0px 5px 25px rgba(0, 0, 0, ",zoomImagesURI="/images/zoom/",myWidth=0,myHeight=0,myScroll=0;myScrollHeight=myScrollWidth=0;
var zoomOpen=false,preloadFrame=1,preloadActive=false,preloadTime=0,imgPreload=new Image,preloadAnimTimer=0,zoomActive=[],zoomTimer=[],zoomOrigW=[],zoomOrigH=[],zoomOrigX=[],zoomOrigY=[],zoomID="ZoomBox",theID="ZoomImage",zoomCaption="ZoomCaption",zoomCaptionDiv="ZoomCapDiv",traversionArray=[],isTraversion=false;if(navigator.userAgent.indexOf("MSIE")!=-1)var browserIsIE=true;
function setupZoom(){prepZooms();initTraversion();insertZoomHTML(isTraversion);zoomdiv=document.getElementById(zoomID);zoomimg=document.getElementById(theID)}
function prepZooms(){if(document.getElementsByTagName){var a=document.getElementsByTagName("a");for(i=0;i<a.length;i++)if(a[i].getAttribute("href"))if(a[i].getAttribute("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)/gi)!=-1){if(a[i].getAttribute("rel")!="nozoom"){a[i].onclick=function(c){return zoomClick(this,c)};a[i].onmouseover=function(){zoomPreload(this)}}}else if(a[i].getAttribute("rel")=="zoom"){a[i].onclick=function(c){return zoomClick(this,c)};a[i].onmouseover=function(){zoomPreload(this)}}}}
function zoomPreload(a){var c=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=c}}
function preloadAnimStart(){preloadTime=new Date;document.getElementById("ZoomSpin").style.left=myWidth/2+"px";document.getElementById("ZoomSpin").style.top=myHeight/2+myScroll+"px";document.getElementById("ZoomSpin").style.visibility="visible";preloadFrame=1;document.getElementById("SpinImage").src=zoomImagesURI+"zoom-spin-"+preloadFrame+".png";preloadAnimTimer=setInterval("preloadAnim()",100)}
function preloadAnim(){if(preloadActive!=false){document.getElementById("SpinImage").src=zoomImagesURI+"zoom-spin-"+preloadFrame+".png";preloadFrame++;if(preloadFrame>12)preloadFrame=1}else{document.getElementById("ZoomSpin").style.visibility="hidden";clearInterval(preloadAnimTimer);preloadAnimTimer=0;zoomIn(preloadFrom)}}
function zoomClick(a,c){var b=getShift(c);isTraversion&&overlayTraversion(a);if(!c&&window.event&&(window.event.metaKey||window.event.altKey))return true;else if(c&&(c.metaKey||c.altKey))return true;getSize();if(preloadActive==true){if(preloadAnimTimer==0){preloadFrom=a;preloadAnimStart()}}else zoomIn(a,b);return false}
function zoomIn(a,c){zoomimg.src=a.getAttribute("href");if(a.childNodes[0].width){startW=a.childNodes[0].width;startH=a.childNodes[0].height;startPos=findElementPos(a.childNodes[0])}else{startW=50;startH=12;startPos=findElementPos(a)}hostX=startPos[0];hostY=startPos[1];if(document.getElementById("scroller"))hostX-=document.getElementById("scroller").scrollLeft;endW=imgPreload.width;endH=imgPreload.height;if(zoomActive[theID]!=true){if(document.getElementById("ShadowBox"))document.getElementById("ShadowBox").style.visibility=
"hidden";else if(!browserIsIE){if(fadeActive.ZoomImage){clearInterval(fadeTimer.ZoomImage);fadeActive.ZoomImage=false;fadeTimer.ZoomImage=false}document.getElementById("ZoomImage").style.webkitBoxShadow=shadowSettings+"0.0)"}document.getElementById("ZoomClose").style.visibility="hidden";if(includeCaption){document.getElementById(zoomCaptionDiv).style.visibility="hidden";if(a.getAttribute("title")&&includeCaption)document.getElementById(zoomCaption).innerHTML=a.getAttribute("title");else document.getElementById(zoomCaption).innerHTML=
""}zoomOrigW[theID]=startW;zoomOrigH[theID]=startH;zoomOrigX[theID]=hostX;zoomOrigY[theID]=hostY;zoomimg.style.width=startW+"px";zoomimg.style.height=startH+"px";zoomdiv.style.left=hostX+"px";zoomdiv.style.top=hostY+"px";includeFade==1&&setOpacity(0,zoomID);zoomdiv.style.visibility="visible";sizeRatio=endW/endH;if(endW>myWidth-minBorder){endW=myWidth-minBorder;endH=endW/sizeRatio}if(endH>myHeight-minBorder){endH=myHeight-minBorder;endW=endH*sizeRatio}zoomChangeX=myWidth/2-endW/2-hostX;zoomChangeY=
myHeight/2-endH/2-hostY+myScroll;zoomChangeW=endW-startW;zoomChangeH=endH-startH;tempSteps=c?zoomSteps*7:zoomSteps;zoomCurrent=0;if(includeFade==1){fadeCurrent=0;fadeAmount=-100/tempSteps}else fadeAmount=0;zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')",zoomTime);zoomActive[theID]=
true}}
function zoomOut(a,c){tempSteps=getShift(c)?zoomSteps*7:zoomSteps;if(zoomActive[theID]!=true){if(document.getElementById("ShadowBox"))document.getElementById("ShadowBox").style.visibility="hidden";else if(!browserIsIE){if(fadeActive.ZoomImage){clearInterval(fadeTimer.ZoomImage);fadeActive.ZoomImage=false;fadeTimer.ZoomImage=false}document.getElementById("ZoomImage").style.webkitBoxShadow=shadowSettings+"0.0)"}document.getElementById("ZoomClose").style.visibility="hidden";if(includeCaption&&document.getElementById(zoomCaption).innerHTML!=
"")document.getElementById(zoomCaptionDiv).style.visibility="hidden";startX=parseInt(zoomdiv.style.left);startY=parseInt(zoomdiv.style.top);startW=zoomimg.width;startH=zoomimg.height;zoomChangeX=zoomOrigX[theID]-startX;zoomChangeY=zoomOrigY[theID]-startY;zoomChangeW=zoomOrigW[theID]-startW;zoomChangeH=zoomOrigH[theID]-startH;zoomCurrent=0;if(includeFade==1){fadeCurrent=0;fadeAmount=100/tempSteps}else fadeAmount=0;zoomTimer[theID]=setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+
startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+startX+", "+zoomChangeX+", "+startY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')",zoomTime);zoomActive[theID]=true}}
function zoomDoneIn(a){zoomOpen=true;a=document.getElementById(a);if(document.getElementById("ShadowBox")){setOpacity(0,"ShadowBox");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)}else browserIsIE||fadeElementSetup("ZoomImage",0,0.8,5,0,"shadow");if(includeCaption&&document.getElementById(zoomCaption).innerHTML!=""){zoomcapd=document.getElementById(zoomCaptionDiv);zoomcapd.style.top=parseInt(a.style.top)+(a.offsetHeight+15)+"px";zoomcapd.style.left=myWidth/2-zoomcapd.offsetWidth/2+"px";zoomcapd.style.visibility="visible"}browserIsIE||setOpacity(0,"ZoomClose");document.getElementById("ZoomClose").style.visibility="visible";browserIsIE||
fadeElementSetup("ZoomClose",0,100,5);document.onkeydown=getKey;window.onkeydown=function(c){if(c.keyCode==32)return false}}function zoomDone(a,c){zoomOpen=false;zoomOrigH[c]="";zoomOrigW[c]="";document.getElementById(a).style.visibility="hidden";zoomActive[c]=false;document.onkeypress=null}
function zoomElement(a,c,b,d,e,f,g,k,h,n,o,j,p,l,m){if(b==j+1){zoomActive[c]=false;clearInterval(zoomTimer[c]);m!=""&&eval(m)}else{if(p==1)l<0?setOpacity(Math.abs(b*l),a):setOpacity(100-b*l,a);moveW=cubicInOut(b,d,e,j);moveH=cubicInOut(b,f,g,j);moveX=cubicInOut(b,k,h,j);moveY=cubicInOut(b,n,o,j);document.getElementById(a).style.left=moveX+"px";document.getElementById(a).style.top=moveY+"px";zoomimg.style.width=moveW+"px";zoomimg.style.height=moveH+"px";b++;clearInterval(zoomTimer[c]);zoomTimer[c]=
setInterval("zoomElement('"+a+"', '"+c+"', "+b+", "+d+", "+e+", "+f+", "+g+", "+k+", "+h+", "+n+", "+o+", "+j+", "+p+", "+l+", '"+m+"')",zoomTime)}}
function getKey(a){theKey=a?a.keyCode:event.keyCode;theKey==27&&zoomOut(this,a);if(isTraversion){if(theKey==37){a=document.getElementById("ZoomPrev");if(a.style.display!="none"){a=a.getAttribute("href");a=parseInt(a[a.length-1]);newImageTraversion(a)}}if(theKey==39||theKey==32){a=document.getElementById("ZoomNext");if(a.style.display!="none"){a=a.getAttribute("href");a=parseInt(a[a.length-1]);newImageTraversion(a)}}}}
function initTraversion(){traversionArray=getTraversionArray();if(traversionArray[1])isTraversion=true}
function getTraversionArray(){for(var a=[],c=document.getElementsByTagName("a"),b=0,d=0;d<c.length;d++)if(c[d].getAttribute("href"))if(c[d].getAttribute("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)/gi)!=-1){if(c[d].getAttribute("rel")!="nozoom"){a[b]=c[d];a[b].setAttribute("id","zoomno"+b);b++}}else if(c[d].getAttribute("rel")=="zoom"){a[b]=c[d];a[b].setAttribute("id","zoomno"+b);b++}return a}
function overlayTraversion(a){a=a.getAttribute("id");imageNo=parseInt(a[a.length-1]);a=document.getElementById("ZoomPrev");var c=document.getElementById("ZoomNext");a.style.display="none";c.style.display="none";if(imageNo>0){a.style.display="block";var b=-1+imageNo;a.setAttribute("href","#zoomno"+b);a.onclick=function(){return newImageTraversion(b)}}if(imageNo<traversionArray.length-1){c.style.display="block";var d=1+imageNo;c.setAttribute("href","#zoomno"+d);c.onclick=function(){return newImageTraversion(d)}}}
function newImageTraversion(a){document.getElementById("ZoomPrev").style.display="none";document.getElementById("ZoomNext").style.display="none";preloadActive=true;preloadAnimStart();var c=document.getElementById("ZoomImage"),b=document.getElementById("zoomno"+a);a=b.getAttribute("href");c.onload=function(){document.getElementById("ZoomSpin").style.visibility="hidden";clearInterval(preloadAnimTimer);preloadAnimTimer=0;preloadActive=false;overlayTraversion(b);c.onload=""};c.setAttribute("src",a);return false}
function fadeOut(a){a.id&&fadeElementSetup(a.id,100,0,10)}function fadeIn(a){a.id&&fadeElementSetup(a.id,0,100,10)}var fadeActive=[],fadeQueue=[],fadeTimer=[],fadeClose=[],fadeMode=[];function fadeElementSetup(a,c,b,d,e,f){if(fadeActive[a]==true)fadeQueue[a]=[a,c,b,d];else{fadeSteps=d;fadeCurrent=0;fadeAmount=(c-b)/fadeSteps;fadeTimer[a]=setInterval("fadeElement('"+a+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')",15);fadeActive[a]=true;fadeMode[a]=f;fadeClose[a]=e==1?true:false}}
function fadeElement(a,c,b,d){if(c==d){clearInterval(fadeTimer[a]);fadeActive[a]=false;fadeTimer[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{c++;if(fadeMode[a]=="shadow")if(b<0)document.getElementById(a).style.webkitBoxShadow=shadowSettings+Math.abs(c*b)+")";else document.getElementById(a).style.webkitBoxShadow=shadowSettings+
(100-c*b)+")";else b<0?setOpacity(Math.abs(c*b),a):setOpacity(100-c*b,a);clearInterval(fadeTimer[a]);fadeTimer[a]=setInterval("fadeElement('"+a+"', '"+c+"', '"+b+"', '"+d+"')",15)}}function setOpacity(a,c){var b=document.getElementById(c).style;if(navigator.userAgent.indexOf("Firefox")!=-1)if(a==100)a=99.9999;b.filter="alpha(opacity="+a+")";b.opacity=a/100}function linear(a,c,b,d){return b*a/d+c}function sineInOut(a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c}
function cubicIn(a,c,b,d){return b*(a/=d)*a*a+c}function cubicOut(a,c,b,d){return b*((a=a/d-1)*a*a+1)+c}function cubicInOut(a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c}function bounceOut(a,c,b,d){return(a/=d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c}
function getSize(){if(self.innerHeight){myWidth=window.innerWidth;myHeight=window.innerHeight;myScroll=window.pageYOffset}else if(document.documentElement&&document.documentElement.clientHeight){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;myScroll=document.documentElement.scrollTop}else if(document.body){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;myScroll=document.body.scrollTop}if(window.innerHeight&&window.scrollMaxY){myScrollWidth=
document.body.scrollWidth;myScrollHeight=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){myScrollWidth=document.body.scrollWidth;myScrollHeight=document.body.scrollHeight}else{myScrollWidth=document.body.offsetWidth;myScrollHeight=document.body.offsetHeight}}function getShift(a){var c=false;if(!a&&window.event)c=window.event.shiftKey;else if(a)(c=a.shiftKey)&&a.stopPropagation();return c}
function findElementPos(a){var c=0,b=0;do{c+=a.offsetLeft;b+=a.offsetTop}while(a=a.offsetParent);return[c,b]}
function insertZoomHTML(a){var c=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="525";c.insertBefore(b,c.firstChild);var d=document.createElement("img");d.setAttribute("id","SpinImage");d.setAttribute("src",zoomImagesURI+"zoom-spin-1.png");b.appendChild(d);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";c.insertBefore(d,b.nextSibling);b=document.createElement("img");b.onclick=function(h){zoomOut(this,h);return false};b.setAttribute("src",zoomImagesURI+"spacer.gif");b.setAttribute("id","ZoomImage");b.setAttribute("border","0");b.setAttribute("style","-webkit-box-shadow: "+shadowSettings+"0.0)");b.style.display="block";b.style.width="10px";b.style.height="10px";d.appendChild(b);b=document.createElement("div");
b.setAttribute("id","ZoomClose");b.style.position="absolute";if(a){var e=document.createElement("div");e.setAttribute("id","ZoomTraverse");e.style.position="absolute";e.style.width="100%";e.style.height="100%";e.style.left="0";e.style.top="0";var f=document.createElement("a");f.setAttribute("id","ZoomPrev");f.style.position="absolute";f.style.width="50%";f.style.height="100%";f.style.left="0";f.style.top="0";var g=document.createElement("span");g.innerHTML="Previous";f.appendChild(g);g=document.createElement("a");
g.setAttribute("id","ZoomNext");g.style.position="absolute";g.style.width="50%";g.style.height="100%";g.style.right="0";g.style.top="0";var k=document.createElement("span");k.innerHTML="Next";g.appendChild(k);e.appendChild(f);e.appendChild(g)}if(browserIsIE){b.style.left="-1px";b.style.top="0px"}else{b.style.left="-15px";b.style.top="-15px"}b.style.visibility="hidden";a&&d.appendChild(e);d.appendChild(b);a=document.createElement("img");a.onclick=function(h){zoomOut(this,h);return false};a.setAttribute("src",
zoomImagesURI+"closebox.png");a.setAttribute("width","30");a.setAttribute("height","30");a.setAttribute("border","0");a.style.cursor="pointer";b.appendChild(a);if(!document.getElementById("ZoomImage").style.webkitBoxShadow&&!browserIsIE){a=document.createElement("div");a.setAttribute("id","ShadowBox");a.style.position="absolute";a.style.left="50px";a.style.top="50px";a.style.width="100px";a.style.height="100px";a.style.visibility="hidden";a.style.zIndex="498";c.insertBefore(a,d.nextSibling);e=document.createElement("table");
e.setAttribute("border","0");e.setAttribute("width","100%");e.setAttribute("height","100%");e.setAttribute("cellpadding","0");e.setAttribute("cellspacing","0");a.appendChild(e);a=document.createElement("tbody");e.appendChild(a);e=document.createElement("tr");e.style.height="25px";a.appendChild(e);b=document.createElement("td");b.style.width="27px";e.appendChild(b);f=document.createElement("img");f.setAttribute("src",zoomImagesURI+"zoom-shadow1.png");f.setAttribute("width","27");f.setAttribute("height",
"25");f.style.display="block";b.appendChild(f);b=document.createElement("td");b.setAttribute("background",zoomImagesURI+"zoom-shadow2.png");e.appendChild(b);f=document.createElement("img");f.setAttribute("src",zoomImagesURI+"spacer.gif");f.setAttribute("height","1");f.setAttribute("width","1");f.style.display="block";b.appendChild(f);b=document.createElement("td");b.style.width="27px";e.appendChild(b);e=document.createElement("img");e.setAttribute("src",zoomImagesURI+"zoom-shadow3.png");e.setAttribute("width",
"27");e.setAttribute("height","25");e.style.display="block";b.appendChild(e);inRow2=document.createElement("tr");a.appendChild(inRow2);e=document.createElement("td");e.setAttribute("background",zoomImagesURI+"zoom-shadow4.png");inRow2.appendChild(e);b=document.createElement("img");b.setAttribute("src",zoomImagesURI+"spacer.gif");b.setAttribute("height","1");b.setAttribute("width","1");b.style.display="block";e.appendChild(b);e=document.createElement("td");e.setAttribute("bgcolor","#ffffff");inRow2.appendChild(e);
b=document.createElement("img");b.setAttribute("src",zoomImagesURI+"spacer.gif");b.setAttribute("height","1");b.setAttribute("width","1");b.style.display="block";e.appendChild(b);e=document.createElement("td");e.setAttribute("background",zoomImagesURI+"zoom-shadow5.png");inRow2.appendChild(e);b=document.createElement("img");b.setAttribute("src",zoomImagesURI+"spacer.gif");b.setAttribute("height","1");b.setAttribute("width","1");b.style.display="block";e.appendChild(b);e=document.createElement("tr");
e.style.height="26px";a.appendChild(e);a=document.createElement("td");a.style.width="27px";e.appendChild(a);b=document.createElement("img");b.setAttribute("src",zoomImagesURI+"zoom-shadow6.png");b.setAttribute("width","27");b.setAttribute("height","26");b.style.display="block";a.appendChild(b);a=document.createElement("td");a.setAttribute("background",zoomImagesURI+"zoom-shadow7.png");e.appendChild(a);b=document.createElement("img");b.setAttribute("src",zoomImagesURI+"spacer.gif");b.setAttribute("height",
"1");b.setAttribute("width","1");b.style.display="block";a.appendChild(b);a=document.createElement("td");a.style.width="27px";e.appendChild(a);e=document.createElement("img");e.setAttribute("src",zoomImagesURI+"zoom-shadow8.png");e.setAttribute("width","27");e.setAttribute("height","26");e.style.display="block";a.appendChild(e)}if(includeCaption){a=document.createElement("div");a.setAttribute("id","ZoomCapDiv");a.style.position="absolute";a.style.visibility="hidden";a.style.marginLeft="auto";a.style.marginRight=
"auto";a.style.zIndex="501";c.insertBefore(a,d.nextSibling);c=document.createElement("table");c.setAttribute("border","0");c.setAttribute("cellPadding","0");c.setAttribute("cellSpacing","0");a.appendChild(c);d=document.createElement("tbody");c.appendChild(d);c=document.createElement("tr");d.appendChild(c);d=document.createElement("td");d.setAttribute("align","right");c.appendChild(d);a=document.createElement("img");a.setAttribute("src",zoomImagesURI+"zoom-caption-l.png");a.setAttribute("width","13");
a.setAttribute("height","26");a.style.display="block";d.appendChild(a);d=document.createElement("td");d.setAttribute("background",zoomImagesURI+"zoom-caption-fill.png");d.setAttribute("id","ZoomCaption");d.setAttribute("valign","middle");d.style.fontSize="14px";d.style.fontFamily="Helvetica";d.style.fontWeight="bold";d.style.color="#ffffff";d.style.textShadow="0px 2px 4px #000000";d.style.whiteSpace="nowrap";c.appendChild(d);d=document.createElement("td");c.appendChild(d);c=document.createElement("img");
c.setAttribute("src",zoomImagesURI+"zoom-caption-r.png");c.setAttribute("width","13");c.setAttribute("height","26");c.style.display="block";d.appendChild(c)}};

