/******************************************************************************
	Description:	Image rotation javascript. 

	Version History:
	KRB Nov 23 2004:	Original Version 
	
******************************************************************************
	Copyright © 2004 EZ Estimating, All Rights Reserved
	Author: www.softwarecarpenters.com
******************************************************************************/

//<!--

var irImages = new Array();
var irAltText = new Array();
var ImageIndex = 0;
var intervalId;


//Browser Sniff
var isIE6 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isDHTML = (isIE5 || isIE6 || isNS6);
var isPc = navigator.userAgent.indexOf("Windows") != -1;
var isMac = !isPc;


// Photo array columns
var SRC = 0;			
var TITLE = 1;
var LINK = 2;				

// Start the SlideShow
function StartSlideShow(pause) {

		NextImage();
		
		clearInterval(intervalId);
		intervalId = setInterval("NextImage()",pause * 1000);

}

// Stop the SlideShow
function StopSlideShow() {

		clearInterval(intervalId);
		
}

// Rotate to the next photo in the photo gallery.
function NextImage() {

    // Increment Photo Index 
    ImageIndex++
    if (ImageIndex > (irImages.length-1)) 
        ImageIndex = 0

		// Set the photo gallery photo html elements 
		UpdateElements();

}


// Rotate to the Previous photo in the photo gallery.
function PreviousImage() {

    // Decrement Photo Index 
    ImageIndex--
    if (ImageIndex < 0 ) 
        ImageIndex = irImages.length-1

		// Set the photo gallery photo html elements 
		UpdateElements();

}

// Update the all elements for Image change.
function UpdateElements() {
		
	var obj = null;

	// Get object reference
	obj = document.getElementById("Canvas");
	
	// Filter transition for IE only
	if (isIE6 || isIE5) {
	
		// Apply filter
		obj.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=1.5)";
		obj.filters[0].apply();
		obj.src = irImages[ImageIndex]
		obj.alt = irAltText[ImageIndex]
		obj.filters[0].play();

	}
	else
	{

		//alert(irImages.length);
		obj.src = irImages[ImageIndex]
		obj.alt = irAltText[ImageIndex]

	}

}

//-->

