
var ctr=1;
//var num_of_quotes = 3; //maximum number of quotes

function next() {
	var num_of_quotes = document.getElementById('num_quotes').value;

	if (ctr == num_of_quotes) { //if it is the last quote, go back to the first one
		ctr = 0;
	}
	
	if(ctr==0) { // after getting back to the first record, set the last record to hidden
		set_prev_hidden(num_of_quotes);
	} else { 
		set_prev_hidden(ctr);
	}
	
	ctr++; // increment to get the next quote id
	document.getElementById('quote'+ctr).style.visibility = 'visible';
}

function prev() {
	/*if(ctr<=1) {
		ctr = num_of_quotes;
	}*/

	if(ctr>1) {
		set_prev_hidden(ctr);
		ctr--;
		document.getElementById('quote'+ctr).style.visibility = 'visible';
	}
}

function set_prev_hidden (id) {
	document.getElementById('quote'+id).style.visibility = 'hidden';
}