<!-- //IMAGE GENERATION
//images are named using numerical serial numbers and set
//into the array for scrolling through on home page.
img_array=new Array(51);
array_length=img_array.length;

for(i=1;i<=array_length;i++){
	img_array[i] = "gallery/thumbs/"+i+".jpg";
}

var rnd=Math.floor(Math.random()*img_array.length);

//function is called while page is loading
function IDjs__randfrstimg(){
	//writes a random image from the above array to html
	document.write("<img src='"+img_array[rnd]+"' alt='click for full gallery' name='img_holder' width='150' height='150' id='img_holder' />");
}

//SLIDE SHOW WITH NEXT AND PREVIOUS FUNCTION
obj_img_array=new Array();

if(document.images){
	//Preload images and image objects

	for(i=1;i<=array_length;i++){
		obj_img_array[i]=new Image;
		obj_img_array[i].src=img_array[i];
	}
} else {
	//set to null if document.images is not supported by browser

	for(i=1;i<=array_length;i++){
		obj_img_array[i]="";
	}
}

current_img_num=rnd;

var previous;
var next;

//this function handles the next and previous buttons/ links
//that control the slide show
function slideshow(slide_direction) {
	if(document.images)	{
		switch(slide_direction){
			case "previous":
				current_img_num--;
				begin_autoslide("false");
				break;
			case "next":
				current_img_num++;
				begin_autoslide("false");
				break;
			default:
				current_img_num++;
				break;
		}
		if(current_img_num>array_length){
			current_img_num=1;
		} else if(current_img_num<1){
			current_img_num=array_length;
		}
		document.img_holder.src=obj_img_array[current_img_num].src;
	}
}

function begin_autoslide(go__state){
	if(go__state!="false"){
		slideshow_timer=setInterval("slideshow()", 3000);
	} else {
		clearInterval(slideshow_timer);
	}
}