// Slideshow coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// Utility Functions

function newImage(src){
	img = new Image();
	img.src = src;
	return img;
}
function imageSwap(img,obj,div){
	if(document.layers && div != null){
		document.layers[div].document.images[img].src = obj.src;
	}else{
		document.images[img].src = obj.src;
	}
}
// SlideShow Functions
curFrame = 0;
function previousFrame(){
	advanceFrame('previous');
}
function nextFrame(){
	advanceFrame('next');
}
function advanceFrame(direction){
	if(direction == 'next'){
		curFrame = (curFrame < frameList.length-1) ? curFrame+1 : 0 ;
	}else{
		curFrame = (curFrame > 0) ? curFrame-1 : frameList.length-1 ;
	}
	imageSwap('SlideShowImage',frameList[curFrame][0]);
	if(frameList[curFrame][1] != null){
		setTimeout('advanceFrame("'+direction+'")', frameList[curFrame][1]);
	}
}
// SlideShow Definition
imageObj = [
	newImage('hats/hatshow1.jpg'),
	newImage('hats/hatshow2.jpg'),
	newImage('hats/hatshow3.jpg'),
	newImage('hats/hatshow4.jpg'),
	newImage('hats/hatshow5.jpg'),
	newImage('hats/hatshow6.jpg'),
	newImage('hats/hatshow7.jpg'),
	newImage('hats/hatshow8.jpg'),
	newImage('hats/hatshow9.jpg'),
	newImage('hats/hatshow10.jpg'),
];

frameList = [
	[imageObj[0],  null],
	[imageObj[1],  null],
	[imageObj[2],  null],
	[imageObj[3],  null],
	[imageObj[4],  null],
	[imageObj[5],  null],
	[imageObj[6],  null],
	[imageObj[7],  null],
	[imageObj[8],  null],
	[imageObj[9],  null],
];
