answerNums=new Array(4);

function getQuestions(){
	questions=new Array(35);
	chosen=new Array(5);	
	for(i=0; i<35; i++){
		questions[i]=new Array(4);
	}

	questions[0]=["Who is credited with the design of the clock?", "Edmund Beckett Denison", "Benjamin Lewis Vulliamy", "Benjamin Hall", 0];
	questions[1]=["Electric winding of the clock was installed in what year?", "1858", "1908", "1912", 2];
	questions[2]=["What is the weight of the hour bell?", "10.5 tonnes", "13.5 tonnes", "16 tonnes", 1];
	questions[3]=["By what name were the Westminster Chimes originally known?", "The Cambridge Chimes", "The Coventry Chimes", "The London Chimes", 0];
	questions[4]=["In what year was Big Ben first broadcast by the BBC?", "1921", "1923", "1931", 1];
	questions[5]=["What is the time required for one swing of the pendulum?", "0.5 seconds", "1 second", "2 seconds", 2];
	questions[6]=["The 1976 disaster was caused by the failure of which component?", "The escapement", "The electric winding motor", "The fly-governor shaft", 2];
	questions[7]=["What is the diameter of each of the dials?", "23 feet", "25 feet", "29.5 feet", 0];
	questions[8]=["The Royal Astronomer, Sir George Airy, specified that the clock be accurate to:", "One minute", "One second", "One millisecond", 1];
	questions[9]=["How many bells are in the belfry?", "Four", "Five", "Six", 1];
	questions[10]=["How many times does the Roman numeral I appear on each dial?", "Five", "Seventeen", "Twenty", 1];
	questions[11]=["Each dial is composed of how many individual pieces of glass?", "125", "312", "365", 1];
	questions[12]=["The Westminster Chimes are taken from which musical work?", "Handel's <I>'Messiah'</I>", "Verdi's <I>'Requiem'</I>", "Elgar's <I>'Enigma Variations'</I>", 0];
	questions[13]=["The accuracy of Great clock is due mainly to its incorporation of which device?", "The fly governor", "The mercury compensated pendulum", "The double three-legged gravity escapement", 2];
	questions[14]=["The name Big Ben properly refers to what?", "The hour bell", "The clock", "The largest of the quarter chime bells", 0];
	questions[15]=["The inscription below the dials refers to which Queen?", "Queen Anne", "Queen Elizabeth I", "Queen Victoria", 2];
	questions[16]=["The exact moment of the full hour is marked by which event?", "The commencement of the chimes", "The first stroke of Big Ben", "The last stroke of Big Ben", 1];
	questions[17]=["The architect, Sir Charles Barry, originally intended that the quarters would be struck on how many bells?", "Two", "Four", "Eight", 2];
	questions[18]=["What was Edmund Beckett Denison's profession", "Lawyer", "Engineer", "Teacher", 0];
	questions[19]=["The second Big Ben bell cracked in the belfry after being used for about how long?", "One month", "Two months", "Two years", 0];
	questions[20]=["According to the inscription on the clock mechanism, in which year was the mechanism made?", "1844", "1854", "1859", 1];
	questions[21]=["According to the inscription on the clock mechanism, in which year was the mechanism installed in the tower?", "1844", "1854", "1859", 2];
	questions[22]=["What note does the hour bell sound?", "C", "E", "F", 1];
	questions[23]=["How many times is the hour bell struck in one full day?", "24 times", "78 times", "156 times", 2];
	questions[24]=["Which of the following does the clock tower NOT contain?", "Astronomical Observatory", "Ventilating chimney for House of Commons", "Prison Cell", 0];
	questions[25]=["Where was the original hour bell when it cracked while being sounded?", "The bell foundry", "New Palace Yard", "Trafalgar Square", 1];
	questions[26]=["The heaviest of the clock's driving weights, 1.25 tons, powers which function?", "The hands", "Quarter chiming", "Hour striking", 1];
	questions[27]=["Prior to the installation of electric winding, the heaviest weights (1.0 and 1.25 tons) were raised by which method?", "Hand crank", "Steam engine", "Water power", 0];
	questions[28]=["The double three-legged gravity escapement increases the clock's accuracy by:", "allowing the pendulum to make a smaller swing", "allowing the pendulum to make a swing of constant size", "delivering a varying force to the pendulum to compensate for errors", 1];
	questions[29]=["It is likely that the hour bell was nicknamed 'Big Ben' after which of the following?", "Sir Benjamin Hall", "Benjamin Lewis Vulliamy", "Ben Nevis", 0];
	questions[30]=["The purpose of the fly fan is to:", "control the speed of striking", "cool the bearings in the mechanism", "quieten the sound of the bells", 0];
	questions[31]=["How many dials are on the tower?", "One", "Two", "Four", 2];
	questions[32]=["How many hands are on each dial?", "One", "Two", "Three", 1];
	questions[33]=["How often does the chiming barrel make a complete revolution?", "Every 15 minutes", "Every hour", "Every 1.5 hours", 2];
	questions[34]=["Many doubted that the clock would be capable of being accurate to one second. This was because:", "The hands were so large", "The pendulum was so long", "The driving weights were so heavy", 0];

	for(i=0; i<5; i++){
		do{
			qNum=getRandNum();
		}while(isAlreadyChosen(i, qNum, chosen));
		chosen[i]=qNum;
		answerNums[i]=questions[qNum][4];
		document.write("<BR><BR><B>" + (i+1) + ". " + questions[qNum][0] + "</B>");
		document.write("<BR><INPUT TYPE='RADIO' NAME='q" + (i+1) + "'>" + questions[qNum][1]);
		document.write("<BR><INPUT TYPE='RADIO' NAME='q" + (i+1) + "'>" + questions[qNum][2]);
		document.write("<BR><INPUT TYPE='RADIO' NAME='q" + (i+1) + "'>" + questions[qNum][3]);
	}
}

function isAlreadyChosen(i, qNum, chosen){
	flag=0;
	for(r=0; r<i; r++){
		if(chosen[r]==qNum){
			flag=1;
		}
	}
	return(flag);
}

function getRandNum(){
	num=Math.round(Math.random()*12345678);
	randNum=num%35;
	return randNum;
}

function validate(form){
	var flag=0;
	for(i=0; i<form.elements.length-3; i++){
		if(form.elements[i].checked){
			flag++;
		}
	}
	if(flag!=5){
		alert("You did not answer all the questions!");
		return(0);
	}
	else{
		return(1);
	}
}
