// JavaScript Document
var i=2;
var c=0;


/*Called on page load. Starts automatic slide show*/
function autoSlide() {
	setInterval ( "nextSlide()", 4000 );
}

/*Displays successive slide*/
function nextSlide() {
	if (c==0){
		if (i==4) {
			makeVisible('four','buttonfour');
		}
		if (i==3) {
			makeVisible('three','buttonthree');
		}
		if (i==2) {
			makeVisible('two','buttontwo');
		}
		if (i==1) {
			makeVisible('one','buttonone');
		}
		i++;
		if (i==5) {
			i=1;
		}
	}
}

/*Called on button click. Stops auto slide show and calls function to change picture*/
function stopAuto(id,buttonid) {
	c=1;
	makeVisible(id,buttonid)
}

/*Changes picture*/
function makeVisible(id,buttonid) {
	hideAll();
	thisDiv = document.getElementById(id);
	thisDiv.style.display = 'block';
	thisButton = document.getElementById(buttonid);
	thisButton.style.display = 'block';
}
	
/*Hides all pictures*/
function hideAll() {
	thisDiv = document.getElementById('one');
	thisDiv.style.display = 'none';
	thisDiv = document.getElementById('two');
	thisDiv.style.display = 'none';
	thisDiv = document.getElementById('three');
	thisDiv.style.display = 'none';
	thisDiv = document.getElementById('four');
	thisDiv.style.display = 'none';
	thisButton = document.getElementById('buttonone');
	thisButton.style.display = 'none';
	thisButton = document.getElementById('buttontwo');
	thisButton.style.display = 'none';
	thisButton = document.getElementById('buttonthree');
	thisButton.style.display = 'none';
	thisButton = document.getElementById('buttonfour');
	thisButton.style.display = 'none';
}
