//////////////////////////////////////////////////////////////////////
//////////////    TURN OFF WORD WRAP TO EDIT THIS FILE   /////////////
//////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
//   QUESTION FORMAT GOES LIKE THIS:
//   
//   thequestions[QUESTION TYPE][NEXT NUMBER] = new Array("THE QUESTION","CORRECT ANSWER","WRONG ANSWER1","WRONG ANSWER2","WRONG ANSWER3");
//   
//   QUESTION TYPE:  0=easy, 1=middle, 2=hard
//   NEXT NUMBER:  Must be the next number of the type.
//   QUESTION:  Your question
//   CORRECT ANSWER:  The correct answer
//   WRONG ANSWER:  The wrong answer
//   
//   The computer will randomly shuffle the correct and wrong answers so you don't have to worry about the correct answer always being in the first choice.
//   If you are going to use a " in the questions, you need to tye the following: \"
//   If you have any questions, contact me.
///////////////////////////////////////////////////////////////////

var EASY = 0
var MIDDLE = 1
var HARD = 2

thetitle = "Millionaire Game"
thedesc = ""
thesound = "disabled"
thequestions = new Array(3);
thequestions[EASY] = new Array();
thequestions[MIDDLE] = new Array();
thequestions[HARD] = new Array();
_lifeline1 = "Get a new question";
_lifeline2 = "5050";
_lifeline3 = "Poll";

getQuestions()

function getQuestions()
{
	var xmlDoc, nodes, i
	var id, desc, option1, option2, option3, option4

	var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
	xmlDoc.async="false"
	xmlDoc.load("millionaire.xml")

	thetitle = xmlDoc.selectSingleNode("millionaire/title").text
	thedesc = xmlDoc.selectSingleNode("millionaire/desc").text
	thesound = xmlDoc.selectSingleNode("millionaire/sound").text
	_lifeline1 = xmlDoc.selectSingleNode("millionaire/lifeline[@id='1']").text
	_lifeline2 = xmlDoc.selectSingleNode("millionaire/lifeline[@id='2']").text
	_lifeline3 = xmlDoc.selectSingleNode("millionaire/lifeline[@id='3']").text

	//get easy questions
	nodes = xmlDoc.selectNodes("millionaire/question[@type='easy']")
	//loop thru the nodes
	for (i=0;i<nodes.length;i++)
	{
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[1].text
		option1 = nodes[i].childNodes[2].childNodes[0].text
		option2 = nodes[i].childNodes[2].childNodes[1].text
		option3 = nodes[i].childNodes[2].childNodes[2].text
		option4 = nodes[i].childNodes[2].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[EASY][i] = new Array(desc,option1,option2,option3,option4,picture)


	}
	
	//get middle questions
	nodes = xmlDoc.selectNodes("millionaire/question[@type='middle']")
	//loop thru the nodes
	for (i=0;i<nodes.length;i++)
	{
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[1].text
		option1 = nodes[i].childNodes[2].childNodes[0].text
		option2 = nodes[i].childNodes[2].childNodes[1].text
		option3 = nodes[i].childNodes[2].childNodes[2].text
		option4 = nodes[i].childNodes[2].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[MIDDLE][i] = new Array(desc,option1,option2,option3,option4,picture)
	}

	//get hard questions
	nodes = xmlDoc.selectNodes("millionaire/question[@type='hard']")

	//loop thru the nodes
	for (i=0;i<nodes.length;i++)
	{
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[1].text
		option1 = nodes[i].childNodes[2].childNodes[0].text
		option2 = nodes[i].childNodes[2].childNodes[1].text
		option3 = nodes[i].childNodes[2].childNodes[2].text
		option4 = nodes[i].childNodes[2].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[HARD][i] = new Array(desc,option1,option2,option3,option4,picture)
	}

	xmlDoc = null
}

