// JavaScript Document

function pawslideshowNext() {
	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.getElementById("pawTable").style.backgroundImage = 'url(' + photoalbumImgs[photoalbum_currentImage] + ')';    

		if (document.form1.av_id) { // if field exists
			document.form1.av_id.value = photoalbumIDs[photoalbum_currentImage];
		}
	}
	if (photoalbum_currentImage == photoalbumImgs.length-1) {
		document.images['nextButton'].src = "../images/photoalbum_next_off.gif";	
	}
}

function pawslideshowPrevious() {
	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.getElementById("pawTable").style.backgroundImage = 'url(' + photoalbumImgs[photoalbum_currentImage] + ')';    
		if (document.form1.av_id) { // if field exists
			document.form1.av_id.value = photoalbumIDs[photoalbum_currentImage];
		}
	}
	if (photoalbum_currentImage == 1) {
		document.images['previousButton'].src = "../images/photoalbum_previous_off.gif";	
	}
}


function pawslideshowSelectImage(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.getElementById("pawTable").style.backgroundImage = 'url(' + photoalbumImgs[i] + ')';    
		//document.images['photoalbumImage'].src = photoalbumImgs[i];
		document.form1.caption.value = photoalbumCaptions[i];
		photoalbum_currentImage = i;
		
		if (document.form1.av_id) { // if field exists
			document.form1.av_id.value = photoalbumIDs[photoalbum_currentImage];
		}

	}
}

/*
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;
