// JavaScript Document

//an array of quotes
var gallery =  new Array();
	gallery[0] = "What seemed like a scene from one of our favourite movies, Sam Pekinpah's western classic 'The Wild Bunch' was about to become a reality. However there were no stunt men only a bunch of black youths pretending to be hit men. We were not men in black, but young black men caught up in a web of gangs, guns, drugs, sex and violence that would change the course of our lives forever.";

/* DO NOT MODIFY BELOW THIS LINE **************************************************/

//global variables

var prev = gallery.length-1;
var current = 0;
var next = 1;

//when the page loads, make the first quote in the array display
function init() {
	if(document.all){
     document.getElementById('quotearea').innerText = gallery[current];	
	} else{
		document.getElementById('quotearea').textContent = gallery[current];
	}
}

//Change the quote to the next in the array. Loop to the start in the case of being at the end of the array
function nextQuote() {
	
	if (current == (gallery.length-1)) {
		prev = current;
		current = 0;
		next = 1;
	}
	else {
		prev = current;
		current = next;
		next++;
	}
	if(document.all){
     document.getElementById('quotearea').innerText = gallery[current];	
	} else{
		document.getElementById('quotearea').textContent = gallery[current];
	}
}

//change the quote to the previous in array. Loop to the end in the case of being at the start of the array
function prevQuote() {
	if (current == 0) {
		next = 0;
		current = gallery.length-1;
		prev = gallery.length-2;;		
	}
	else {
		next =  current;
		current = prev;	
		prev--;
	}
	if(document.all){
     document.getElementById('quotearea').innerText = gallery[current];	
	} else{
		document.getElementById('quotearea').textContent = gallery[current];
	}
}