/*global getElementById, innerHTML, src */
"use strict";

function change_hdri(base, index, suffix, id, captions) {
	var prefix, next, last, source; 
	prefix = 'http://www.foxtrot-uniform-charlie-kilo.eu/';
	next = parseInt(index, 10) + 1;
	last = parseInt(index, 10) + 2;
	source = document.getElementById(id).src;

	if (source === prefix + base + index + '.' + suffix) {
		document.getElementById(id).src = prefix + base + next + '.' + suffix;
		document.getElementById(id + '_txt').innerHTML = captions[1];
	}
	else if (source === prefix + base + next + '.' + suffix) {
		document.getElementById(id).src = prefix + base + last + '.' + suffix;
		document.getElementById(id + '_txt').innerHTML = captions[2];
	}
	else if (source === prefix + base + last + '.' + suffix) {
		document.getElementById(id).src = prefix + base + index + '.' + suffix;
		document.getElementById(id + '_txt').innerHTML = captions[0];
	}
}