
/*------Initialize Global Varibles------------------------------#
#								#
#	Each slide will package itself in the position Array.	#
#______________________________________________________________*/

i = 0;				// index of current img
x = 0;				// # of images
imgCache = new Array(x);	// Array of cached images 
position = new Array(x);	// Array of image names

/*------Class slide Constructor---------------------------------#
#								#
#	Each slide is an image, with basic properties		#
#	Width, Height (both hardwired) & Name.			#
#______________________________________________________________*/

function slide(src) 
	{	
	// Save image name and allocate empty cache slot
	this.Width = 480;
	this.Height = 320;
	this.src = src;
	position[x] = this;
	
	imgCache[x] = new Image;
	imgCache[x].Width = 480;
	imgCache[x].Height = 320;

	x++;
	}

function cache(i)
	{
	return;
	// Download image into cache slot, if it isn't already there.
	if( !imgCache[i].src )
		imgCache[i].src = position[i].src;
	}

/*------slide Navigation Functions------------------------------*/


function slideFirst() 
	{
	// Show first slide
	i = 0;
	showslide(i);
	// Cache the remainder
	for( n = 1; n < x; n++ )
		cache( n );
	}

function slideNext() 
	{
	// Show next slide
	if( ++i == x ) 
		i = 0; 
	showslide(i);
	}			

function slidePrev() 
	{						
	if ( --i < 0 ) 
		i = x-1;
	showslide(i);
	}

/*------slide Display Function----------------------------------*/


function showslide(i) 
	{
	if( imgCache[i].src )
		document.images[show].src = imgCache[i].src;		
	else
		document.images[show].src = position[i].src;
	}

/*------Start the Show------------------------------------------*/

show = "show"
window.onload = slideFirst

