
imageRotatorCurrentImageNumber = 1;
imageRotatorImageCount = 20;
imageRotatorCurrentOpacity = 1;
imageRotatorCurrentImage = document.createElement("img");
imageRotatorNextImage = document.createElement("img");
imageRotatorCurrentImage.src = '../images/photos/tourn1-0.jpg';
imageRotatorCurrentImage.style.width = '360px';
imageRotatorCurrentImage.style.height = '257px';
imageRotatorNextImage.src = '../images/photos/tourn1-1.jpg';
imageRotatorNextImage.style.width = '360px';
imageRotatorNextImage.style.height = '257px';
imageRotatorNextImage.style.opacity = '0';
imageRotatorNextImage.style.filter = 'alpha(opacity=0)';

rotateImage = function () {
	var nextOpacity, temp;
	if (imageRotatorCurrentOpacity > 0) {
		imageRotatorCurrentOpacity = imageRotatorCurrentOpacity - .10;
		nextOpacity = 1 - imageRotatorCurrentOpacity;
		imageRotatorCurrentImage.style.opacity = imageRotatorCurrentOpacity;
		imageRotatorCurrentImage.style.filter = 'alpha(opacity=' + (imageRotatorCurrentOpacity*100) + ')';
		imageRotatorNextImage.style.opacity = nextOpacity;
		imageRotatorNextImage.style.filter = 'alpha(opacity=' + (nextOpacity*100) + ')';
		setTimeout("rotateImage();", 100);
	}
	else {
		if (imageRotatorCurrentImageNumber == imageRotatorImageCount) {
			if (navigator.userAgent.indexOf('Gecko') > 0) return;
			imageRotatorCurrentImageNumber = 1;
		}
		else {
			imageRotatorCurrentImageNumber = imageRotatorCurrentImageNumber + 1;
		}
		temp = imageRotatorCurrentImage;
		imageRotatorCurrentImage = imageRotatorNextImage;
		imageRotatorNextImage = temp;
		imageRotatorNextImage.src = '../images/photos/tourn1-' + imageRotatorCurrentImageNumber + '.jpg';
		imageRotatorCurrentOpacity = 1;
		setTimeout("rotateImage();", 4000);
	}
}


imageFlipper = {current: 0, images: [], target: null};
function initImageFlipper(myImages, myTarget) {
	imageFlipper.current = 0;
	imageFlipper.target = myTarget;
	imageFlipper.images = new Array(myImages.length);
	for (var i = 0; i < myImages.length; i++) {
		imageFlipper.images[i] = new Image();
		imageFlipper.images[i].src = myImages[i];
	}
	myTarget.onload = null;
	var interval = setInterval('flipImg()', 2000);
}

function flipImage(target) {
	imageFlipper.target = target;
	target.onload = null;
	var interval = setInterval('flipImg()', 2000);
}

function flipImg() {
	imageFlipper.current = (imageFlipper.current + 1) % imageFlipper.images.length;
	imageFlipper.target.src = imageFlipper.images[imageFlipper.current].src;
}


/* Copyright (c) 2007, Mental Models. All rights reserved.
 *========================================================================
 * Modifications history
 *========================================================================
 * $Log: ImageRotator.js,v $
 * Revision 1.4  2007/11/09 02:32:27  mike
 * Added first portfolio page
 *
 * Revision 1.3  2007/11/06 04:10:43  mike
 * Changed directory name to images/client-logos
 *
 * Revision 1.2  2007/11/06 03:55:19  mike
 * CVS comment added
 *
 *========================================================================
 */
