//////////////////////////////////////////////////////////////////////
//////////////    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 = "DoubleIT 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("gamebuilder.xml")
	
	root = xmlDoc.documentElement

	thetitle = root.childNodes[0].getAttributeNode("title").text
	thedesc = root.childNodes[0].getAttributeNode("desc").text
	thesound = root.childNodes[0].childNodes[1].getAttributeNode("sound").text
	_lifeline1 = root.childNodes[0].childNodes[1].getAttributeNode("lifeline1").text
	_lifeline2 = root.childNodes[0].childNodes[1].getAttributeNode("lifeline2").text
	_lifeline3 = root.childNodes[0].childNodes[1].getAttributeNode("lifeline3").text

	//get easy questions
	nodes = xmlDoc.selectNodes("gamebuilder/item")
	//loop thru the nodes
	
	a = 0;
	b = 0;
	c = 0;
	
	for (i=0;i<nodes.length;i++)
	{
		if(nodes[i].childNodes[7].text == "easy"){
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[6].text
		option1 = nodes[i].childNodes[1].childNodes[0].text
		option2 = nodes[i].childNodes[1].childNodes[1].text
		option3 = nodes[i].childNodes[1].childNodes[2].text
		option4 = nodes[i].childNodes[1].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[EASY][a] = new Array(desc,option1,option2,option3,option4,picture)
		a++;
		}

		else if(nodes[i].childNodes[7].text == "middle"){
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[6].text
		option1 = nodes[i].childNodes[1].childNodes[0].text
		option2 = nodes[i].childNodes[1].childNodes[1].text
		option3 = nodes[i].childNodes[1].childNodes[2].text
		option4 = nodes[i].childNodes[1].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[MIDDLE][b] = new Array(desc,option1,option2,option3,option4,picture)
		b++;
		}
 
		else if(nodes[i].childNodes[7].text == "hard"){
		//get values from xml document
		id = nodes[i].getAttribute("id")
		desc = nodes[i].childNodes[0].text
		picture = nodes[i].childNodes[6].text
		option1 = nodes[i].childNodes[1].childNodes[0].text
		option2 = nodes[i].childNodes[1].childNodes[1].text
		option3 = nodes[i].childNodes[1].childNodes[2].text
		option4 = nodes[i].childNodes[1].childNodes[3].text
		//alert(id+";"+desc+";"+option1+";"+option2+";"+option3+";"+option4)

		//set values to thequestions array
		thequestions[HARD][c] = new Array(desc,option1,option2,option3,option4,picture)
		c++;
		}
	}

	xmlDoc = null
}


