/************************************************************************* This code is from Dynamic Web Coding at www.dyn-web.com Copyright 2003-4 by Sharon Paine Get full source code at www.dyn-web.com/scripts/rotate-rand/ See Terms of Use at www.dyn-web.com/bus/terms.html regarding conditions under which you may use this code. This notice must be retained in the code as is! *************************************************************************/ function initImgRotation() { // create rotating image objects here // arguments: image name, rotation speed var rotator1 = new rotateImgObj('img1',5000); // add the images to rotate into that image object rotator1.addImages( 'wood.jpg','branches.jpg', 'horse.jpg', 'lighthouse.jpg'); rotator1.rotate(); rotateImgObj.start(); } // If all the images you wish to display are in the same location, you can specify the path here rotateImgObj.imagesPath = "http://www.dioceseofgaylord.org/assets/insiderot/winter/"; rotateImgObj.counter = 0; // no need to edit code below ///////////////////////////////////////////////////////////////////// rotateImgObjs = []; // holds all rotating image objects defined // constructor function rotateImgObj(nm,s) { this.speed=s; this.ctr=0; this.timer=0; this.imgObj = document.images[nm]; // get reference to the image object this.index = rotateImgObjs.length; rotateImgObjs[this.index] = this; this.animString = "rotateImgObjs[" + this.index + "]"; } rotateImgObj.prototype = { addImages: function() { // preloads images this.imgObj.imgs = []; for (var i=0; arguments[i]; i++) { this.imgObj.imgs[i] = new Image(); this.imgObj.imgs[i].src = rotateImgObj.imagesPath + arguments[i]; } }, rotate: function() { // controls rotation var ctr = rotateImgObj.counter; //Math.floor( Math.random() * this.imgObj.imgs.length ); rotateImgObj.counter++; if(rotateImgObj.counter >= this.imgObj.imgs.length){ rotateImgObj.counter = 0; } if (ctr == this.ctr) ctr = (ctr > 0)? --ctr: ++ctr; this.ctr = ctr; if ( typeof this.imgObj.filters != "undefined" ) { this.imgObj.style.filter = 'blendTrans(duration=1)'; if (this.imgObj.filters.blendTrans) this.imgObj.filters.blendTrans.Apply(); } this.imgObj.src = this.imgObj.imgs[this.ctr].src; if ( typeof this.imgObj.filters != "undefined" && this.imgObj.filters.blendTrans ) this.imgObj.filters.blendTrans.Play(); } } // sets up rotation for all defined rotateImgObjs rotateImgObj.start = function() { for (var i=0; i