var quotes = document.getElementById('hiddenQuotesDiv').innerHTML;

var quotesArray = new Array();
var numQuotes = 0;

//get the number of quotes
for(a=0;a<=quotes.length;a++){
	if(quotes.charAt(a) == '#'){
		numQuotes ++;
	}
}

var firstLetterPos = 0;
var lastLetterPos = 0;

for(count=0;count<=numQuotes-1;count++){
	
	//get the first letter of the quote
	for(b=lastLetterPos;b<=quotes.length;b++){
		if(quotes.charAt(b) == "#"){
			firstLetterPos = b+1;
			break;
		}
	}

	//get the last letter of the quote
	for(c=firstLetterPos;c<=quotes.length;c++){
		if(count == 6){
			lastLetterPos = quotes.length;
		}else{
			if(quotes.charAt(c) == "#"){
				lastLetterPos = c-1;
				break;
			}
		}
	}
	
	quotesArray[count] = quotes.substring(firstLetterPos, lastLetterPos);
}

var rand = Math.floor(Math.random()*7);
var randomQuote = quotesArray[rand];
document.getElementById('quoteDiv').innerHTML = randomQuote;