function photoalbumNextMouseOver() {
	if (photoalbum_currentImage < photoalbumImgs.length-1) {
		document.images['nextButton'].src = "../images/photoalbum_next_over.gif";
	}
}

function photoalbumNextMouseOut() {
	if (photoalbum_currentImage < photoalbumImgs.length-1) {
		document.images['nextButton'].src = "../images/photoalbum_next_off.gif";
	}
}

function photoalbumPreviousMouseOver() {
	if (photoalbum_currentImage > 1) {
		document.images['previousButton'].src = "../images/photoalbum_previous_over.gif";
	}
}

function photoalbumPreviousMouseOut() {
	if (photoalbum_currentImage > 1) {
		document.images['previousButton'].src = "../images/photoalbum_previous_off.gif";
	}
}

function photoalbumNext() {
	if (photoalbum_currentImage < photoalbumImgs.length-1) {
		document.images['photoalbum_num_'+photoalbum_currentImage].src = "../images/photoalbum_number_" + photoalbum_currentImage + "_off.gif";
		photoalbum_currentImage++;
		document.images['photoalbum_num_'+photoalbum_currentImage].src = "../images/photoalbum_number_" + photoalbum_currentImage + ".gif";
		document.images['photoalbumImage'].src = photoalbumImgs[photoalbum_currentImage];
		document.form1.caption.value = photoalbumCaptions[photoalbum_currentImage];
	}
	if (photoalbum_currentImage == photoalbumImgs.length-1) {
		document.images['nextButton'].src = "../images/photoalbum_next_off.gif";	
	}
}

function photoalbumPrevious() {
	if (photoalbum_currentImage > 1) {
		document.images['photoalbum_num_'+photoalbum_currentImage].src = "../images/photoalbum_number_" + photoalbum_currentImage + "_off.gif";
		photoalbum_currentImage--;
		document.images['photoalbum_num_'+photoalbum_currentImage].src = "../images/photoalbum_number_" + photoalbum_currentImage + ".gif";
		document.images['photoalbumImage'].src = photoalbumImgs[photoalbum_currentImage];
		document.form1.caption.value = photoalbumCaptions[photoalbum_currentImage];
	}
	if (photoalbum_currentImage == 1) {
		document.images['previousButton'].src = "../images/photoalbum_previous_off.gif";	
	}
}

function numberMouseOver(i){
	if (photoalbum_currentImage != i){
		document.images['photoalbum_num_'+i].src = "../images/photoalbum_number_" + i + "_over.gif";
	}
}

function numberMouseOut(i){
	if (photoalbum_currentImage != i){
		document.images['photoalbum_num_'+i].src = "../images/photoalbum_number_" + i + "_off.gif";
	}
}

function selectImage(i){
	if (photoalbum_currentImage != i){
		document.images['photoalbum_num_'+photoalbum_currentImage].src = "../images/photoalbum_number_" + photoalbum_currentImage + "_off.gif";
		document.images['photoalbum_num_'+i].src = "../images/photoalbum_number_" + i + ".gif";
		document.images['photoalbumImage'].src = photoalbumImgs[i];
		document.form1.caption.value = photoalbumCaptions[i];
		photoalbum_currentImage = i;
	}
}

function imagePreloader() {
     // create object
     imageObj = new Image();

	// start preloading
     for(i=1; i<=photoalbumImgs.length; i++) {
          imageObj.src=photoalbumImgs[i];
     }
} 

//the following lines should not be included in any function
//window.onload = imagePreloader;