/*********************

linked to new gallery.htm
by Richard Wiseman
21,12,2011

**********************/


var imageNo=1 // first image to display as main image
var allThumbs=18// number of images in gallery and thumb file
var firstThumb=1;//first thumb to display
var lastThumb=5;// last to display

function displayImg(fileNo){
	imageNo=fileNo
	image = new Image
	document.mainImg.src = "gallery/"+imageNo+".jpg";

	
	
}
			
function showThumbs(num){
	firstThumb=firstThumb+num;
	lastThumb=lastThumb+num;
	
	if(firstThumb<1){//not below 0
	firstThumb=1
	}
	if(firstThumb>allThumbs-4){// not above max -5
	firstThumb=allThumbs-4
	}
	if(lastThumb>allThumbs){// not above max
	lastThumb=allThumbs
	}
	if(lastThumb<5){// not below 5 
	lastThumb=5
	}
	
	
	
	var allTags=document.getElementsByTagName('*');//get all tags and put in allTags
	
	//reset all tags with a number as id to display=none
	for(i=1; i<allThumbs+1; i++) {
	
		for(c=0; c<allTags.length; c++) {
			if(allTags[c].className==i){
					allTags[c].style.display='none';	
			}
		}

	}
	
	//now desplay the next thumbs
	
	for(i=1; i<allThumbs; i++) {
	
		for(c=0; c<allTags.length; c++) {
			if(allTags[c].className>=firstThumb&&allTags[c].className<=lastThumb){
					allTags[c].style.display='';	
			}
		}
	}
	
	
	
	
}

