// ----------------------------------------------------------------------
// GLOBAL VARIABLE
// ----------------------------------------------------------------------  

var QA_LIST = new Array();

// ----------------------------------------------------------------------
// CREATE Q&A OBJECTS
// ----------------------------------------------------------------------

function qaObj(question,answer) {

  this.q = question;
  this.a = answer;
	
  QA_LIST[QA_LIST.length] = this;
	}

// ----------------------------------------------------------------------
// PICK RANDOM Q&A PAIR
// ----------------------------------------------------------------------

function getRandomQA() {

	return (Math.floor(Math.random() * QA_LIST.length));
  }

// ----------------------------------------------------------------------
// DISPLAY RANDOM Q&A PAIRS
// ----------------------------------------------------------------------

function displayQA() {

  var x       = getRandomQA();
  var y       = getRandomQA();
  var z       = getRandomQA();

  while (y == x) {
    y = getRandomQA();
  	}

  while (z == x || z == y) {
    z = getRandomQA();
  	}
    
  var qa1  = QA_LIST[x];
  var qa2  = QA_LIST[y];
  var qa3  = QA_LIST[z];
	
	document.write('<p class=\"question\">' + qa1.q + '</p>');
	document.write(qa1.a);
	
	}