function change(pic) {
	document.getElementById('cnn_location_photo').src = fileNames[pic];
	document.getElementById('cnn_location_caption').firstChild.nodeValue = fileCaptions[pic];
	}

function next() {
	current_photo++;
	if(current_photo>=fileNames.length) {
		current_photo = 0;
		}
	change(current_photo);
}

function previous() {
	current_photo--;
	if(current_photo < 0) {
		current_photo = (fileNames.length - 1);
		}
	change(current_photo);
}

function goPic() {
	current_photo = (document.getElementById('index').value - 1);
	if(current_photo>=fileNames.length) {
		current_photo = (fileNames.length - 1);
		}
	if(current_photo < 0) {
			current_photo = 0;
			}
	change(current_photo);
}