function ImageGallery(d,j,f,e,h,a,b){this.cycleDelay=b;this.imageCount=j;this.initialCycleTime=f;this.cycleCounter=1;this.totalHeight=0;this.div=document.getElementById("cycleDiv"+d);this.uniqueID=d;this.stopCycle=0;this.intervalSet=0;this.direction=e;this.RolloverToLargerImages=h;this.rolloverDisplaying=0;this.cycleLoop=a;this.distanceTraveled=0;switch(this.direction){case 0:this.offset="offsetLeft";this.increase=1;this.style="left";this.widthHeight="width";this.clientwidthHeight="offsetWidth";this.ID="img";break;case 1:this.offset="offsetLeft";this.increase=0;this.style="left";this.widthHeight="width";this.clientwidthHeight="offsetWidth";this.ID="img";break;case 2:this.offset="offsetTop";this.increase=1;this.style="top";this.widthHeight="height";this.clientwidthHeight="offsetHeight";this.ID="DIV";break;case 3:this.offset="offsetTop";this.increase=0;this.style="top";this.widthHeight="height";this.clientwidthHeight="offsetHeight";this.ID="DIV";break}var g;var c;for(c=1;c<=this.imageCount;c++){g=document.getElementById(this.ID+this.uniqueID+"_"+c);g.style.position="relative";g.style[this.style]="0px";if(this.direction<2){this.totalHeight=this.totalHeight+g[this.widthHeight]}else{this.totalHeight=this.totalHeight+g.offsetHeight}}if(this.increase==1){for(c=1;c<=this.imageCount;c++){g=document.getElementById(this.ID+this.uniqueID+"_"+c);g.style[this.style]=-this.totalHeight+this.div[this.clientwidthHeight]+"px"}}if(this.cycleDelay>0){setTimeout("thediv"+this.uniqueID+".DoCycle()",this.cycleDelay)}else{this.DoCycle()}}ImageGallery.prototype.setStop=function(a){this.stopCycle=1;this.currentImage=a;if(this.RolloverToLargerImages){setTimeout("thediv"+this.uniqueID+".DoRollover("+a+")",2000)}};ImageGallery.prototype.setGo=function(){this.stopCycle=0;this.RemoveRollover()};ImageGallery.prototype.RemoveRollover=function(a){if(this.rolloverDisplaying){this.rolloverDisplaying=0;document.body.removeChild(this.rolloverImage)}};ImageGallery.prototype.DoRollover=function(b){if(this.stopCycle&&b==this.currentImage){this.RemoveRollover();this.rolloverDisplaying=1;var a=document.getElementById(this.ID+this.uniqueID+"_"+(b+1));rolloverImage=new Image();rolloverImage.src=arrayofRollovers[this.uniqueID][b];rolloverImage.style.position="absolute";rolloverImage.id="rolloverImage";this.rolloverImage=rolloverImage;document.body.appendChild(rolloverImage);width=rolloverImage.width;height=rolloverImage.height;if(this.direction<2){rolloverImage.width=a.width+a.width*0.5;rolloverImage.height=height*(rolloverImage.width/width)}else{rolloverImage.width=a.offsetWidth+a.offsetWidth*0.5;rolloverImage.height=height*(rolloverImage.width/width)}clientOffsetL=0;clientOffsetT=0;var c=a;if(c.offsetParent){clientOffsetL=c.offsetLeft;clientOffsetT=c.offsetTop;while((c=c.offsetParent)){clientOffsetL+=c.offsetLeft;clientOffsetT+=c.offsetTop}}rolloverImage.style.top=parseInt(clientOffsetT)+"px";rolloverImage.style.left=parseInt(clientOffsetL-rolloverImage.width)+"px"}};ImageGallery.prototype.DoCycle=function(){var f;var e;var d=0;var k=0;var a=this.div[this.clientwidthHeight];var b;if(!this.stopCycle){if(!this.cycleLoop){if(this.distanceTraveled>=this.totalHeight){return}this.distanceTraveled++}f=document.getElementById(this.ID+this.uniqueID+"_"+1);if(f.offsetParent!=this.div){f=this.div;if(f.offsetParent){k=f[this.offset];while((f=f.offsetParent)){k+=f[this.offset]}}}var g;var h=0;for(var c=1;c<=this.imageCount;c++){f=document.getElementById(this.ID+this.uniqueID+"_"+c);if(this.direction<2){h+=f[this.widthHeight]}else{h+=f.offsetHeight}if(this.increase==1){f.style[this.style]=parseInt(f.style[this.style],10)+1+"px";if(f[this.offset]-k>a){this.div.removeChild(f);this.div.insertBefore(f,this.div.childNodes[0]);for(b=1;b<=this.imageCount;b++){g=document.getElementById(this.ID+this.uniqueID+"_"+b);g.style[this.style]=-this.totalHeight+a+1+"px"}break}}else{f.style[this.style]=parseInt(f.style[this.style],10)-1+"px";if((parseInt(f[this.offset],10)-k)+(this.direction<2?parseInt(f[this.widthHeight],10):f.offsetHeight)<0){this.div.appendChild(this.div.removeChild(f));for(b=1;b<=this.imageCount;b++){g=document.getElementById(this.ID+this.uniqueID+"_"+b);g.style[this.style]=0+"px"}break}}}this.totalHeight=Math.max(this.totalHeight,h)}if(!this.intervalSet){this.intervalSet=1;setInterval("thediv"+this.uniqueID+".DoCycle()",Math.max((1000/(this.totalHeight/this.imageCount))*this.initialCycleTime,20))}};

