//************

// -------------------- Image Scroll ---------------------------------------------------- 
// Image Scroll version 1.2
// By Robin Mayne
// Copyright (c) 2001 Robin Mayne. All Rights Reserved.

// Set the document images names that will be replaced, in the order they appear on the page
//var imgName = new Array("footerlogo1","footerlogo2","footerlogo3","footerlogo4");
//var scrollPosition = 1;	// Set the starting scroll position


// Set the info for each item in the scroll set, by loading into an array
var arraynum = 0;
var scrollobj = new Array();

function scrollInfo(linkpath, offimg, onimg, imgalt) {
    arraynum++;
  	scrollobj[arraynum] = new Array(3);
    scrollobj[arraynum][0] = new Image();
    scrollobj[arraynum][0].src = offimg;
    scrollobj[arraynum][0].alt = imgalt;
    
    scrollobj[arraynum][1] = new Image();
    scrollobj[arraynum][1].src = onimg;
    scrollobj[arraynum][1].alt = imgalt;
    scrollobj[arraynum][2] = linkpath;
}
// arraynum is now set at the number of total items in the scroll set


//************


function scrollOver(direction,scrollAmount) // Controls the scrolling of the items either 'left' or 'right', and the amount to scroll
{
	var scrollMove;
	if(direction == "left") {
		scrollMove = -1;
	}
	else { // direction = right
		scrollMove = 1;
	}
	
	for (s = 0; s < scrollAmount; s++) {
		scrollPosition = scrollPosition + scrollMove;	
		if(scrollPosition == 0) { // start at end
			scrollPosition = arraynum;
		}
		if(scrollPosition > arraynum) { // start at beginning
		scrollPosition = 1;
		}
	}
	// loop through all images to be replaced
	var scrollnum = scrollPosition;
	for (a = 0; a < imgName.length; a++) { // set all images to the new image sources in the array
		document[imgName[a]].src = scrollobj[scrollnum][0].src;		
		scrollnum = scrollnum + 1;
		if(scrollnum > arraynum) {
			scrollnum = 1;
		}
	}

}

function scrollOnMouse(name) // Controls rollover images of the item
{
	//alert(document[name].src);
	for (a = 1; a < scrollobj.length; a++) { 
		//alert(document[name].src);
		//alert(scrollobj[a][0].src);
		
		if(document[name].src == scrollobj[a][0].src) { // image is off
			//alert('off');
			document[name].alt = scrollobj[a][1].alt;
			document[name].src = scrollobj[a][1].src;   // turn corresponding image on			 
		} 
		
		else if(document[name].src == scrollobj[a][1].src) { // image is on
			//alert('on');
			document[name].alt = scrollobj[a][0].alt;
			document[name].src = scrollobj[a][0].src;   // turn corresponding image off
		}
	}
}

function scrollGoTo(name) // Links to corresponding linkpath of the item
{
		for (a = 1; a < scrollobj.length; a++) { 
		if((document[name].src == scrollobj[a][0].src) || (document[name].src == scrollobj[a][1].src)) { // this is the image (on or off state)
			location.href = scrollobj[a][2];
		} 
	}
}

function scrollLinkStatus(name) // Sets window status to display link path of the item
{
	if(!name) {
		window.status = '';
	}
	else {
		for (x = 1; x < scrollobj.length; x++) { 
			if((document[name].src == scrollobj[x][0].src) || (document[name].src == scrollobj[x][1].src)) { // this is the image (on or off state)
				window.status = scrollobj[x][2]; 
			}	
		}
	}
}

// ----------------------- End Image Scroll------------------------------------------------------
