
filledsquare = new Array(0,0,0,0,0,0,0,0,0); 

whosturn = 0;
whosturnimage = new Array('x.bmp','o.bmp');
turntext = " ";
questionOn = "n";
NumberOfQuestions = 98;
NewGame = "y";


function StartNewGame()
{
document.r1c1_image.src = "blank.gif";
document.r1c2_image.src = "blank.gif";
document.r1c3_image.src = "blank.gif";
document.r2c1_image.src = "blank.gif";
document.r2c2_image.src = "blank.gif";
document.r2c3_image.src = "blank.gif";
document.r3c1_image.src = "blank.gif";
document.r3c2_image.src = "blank.gif";
document.r3c3_image.src = "blank.gif";
turntext = "x always takes first turn";
window.document.form_12.turn.value = turntext;
window.document.form_10.quest.value = " ";
window.document.form_11.list_11.options(0).text = " ";
window.document.form_11.list_11.options(1).text = " ";
window.document.form_11.list_11.options(2).text = " ";
window.document.form_11.list_11.options(3).text = " ";
window.document.form_11.list_11.selectedIndex = -1;
filledsquare = new Array(0,0,0,0,0,0,0,0,0);
whosturn = 0;
questionOn = "n";
var questnum = 1;
NewGame = "y";
var UnusedQuestions = 0; 
for (loop=0; questnum < NumberOfQuestions + 1; loop++)
{
   qnum = eval('q' + questnum);
   if (qnum.used == 'n')
      {   
       UnusedQuestions = UnusedQuestions + 1;
      } 
   questnum = questnum + 1;      
}  
if (UnusedQuestions < 9)
   {
     alert("Not enough new questions available. Questions will start to be reused");
     clear_all();
   }   
} 


function clear_all()
{
window.location.reload(true);
} 
 
function questionDB(question, answer0, answer1, answer2, answer3, correctanswer,whereisanswer)    
{
this.question = question;
this.answer0 = answer0;
this.answer1 = answer1;
this.answer2 = answer2;
this.answer3 = answer3;
this.correctanswer = correctanswer;
this.used = "n";
this.setusage = setusage;
this.unsetusage = unsetusage;
this.whereisanswer = whereisanswer;
}

function setusage()
{
this.used = "y"
}

function unsetusage()
{
this.used = "n"
}

function theAnswer()
{
if (NewGame == "n")
{
alert(qnum.whereisanswer)
}
else
{
alert("First you must have a question!")
}
}


function randomquest(square)
{
squareno = square;
NewGame = "n"
if (questionOn == "n")
{
 
if (filledsquare[squareno] == 0)
{ 
questionOn = "y" 
var parsenum = NumberOfQuestions +1;
for (loop=0; parsenum > NumberOfQuestions ; loop++)
{
var questnum = Math.random() * 100 + 1; 
var parsenum = parseInt(questnum);
   if (parsenum < NumberOfQuestions +1 )
   {
   qnum = eval('q' + parsenum);
        if (qnum.used == "y")
       {
        parsenum = NumberOfQuestions +1;  
       }
   }
}

window.document.form_10.quest.value = qnum.question
window.document.form_11.list_11.options(0).text = qnum.answer0
window.document.form_11.list_11.options(1).text = qnum.answer1
window.document.form_11.list_11.options(2).text = qnum.answer2
window.document.form_11.list_11.options(3).text = qnum.answer3
window.document.form_11.list_11.selectedIndex = -1
}
else
{
alert("this square is already filled, please select another");
}
}
else
{
alert("please answer the previous question")
} 
}



function checkwinner()
{
    if (((filledsquare[0] =='x') && (filledsquare[1] == 'x') && (filledsquare[2] == 'x'))   
       ||
        ((filledsquare[3] =='x') && (filledsquare[4] == 'x') && (filledsquare[5] == 'x')) 
       ||
        ((filledsquare[6] =='x') && (filledsquare[7] == 'x') && (filledsquare[8] == 'x')) 
       ||
        ((filledsquare[0] =='x') && (filledsquare[3] == 'x') && (filledsquare[6] == 'x')) 
       ||
        ((filledsquare[1] =='x') && (filledsquare[4] == 'x') && (filledsquare[7] == 'x')) 
       ||
        ((filledsquare[2] =='x') && (filledsquare[5] == 'x') && (filledsquare[8] == 'x')) 
       ||
        ((filledsquare[0] =='x') && (filledsquare[4] == 'x') && (filledsquare[8] == 'x')) 
       ||
        ((filledsquare[2] =='x') && (filledsquare[4] == 'x') && (filledsquare[6] == 'x')) 
       ||
        ((filledsquare[0] =='o') && (filledsquare[1] == 'o') && (filledsquare[2] == 'o'))   
       ||
        ((filledsquare[3] =='o') && (filledsquare[4] == 'o') && (filledsquare[5] == 'o')) 
       ||
        ((filledsquare[6] =='o') && (filledsquare[7] == 'o') && (filledsquare[8] == 'o')) 
       ||
        ((filledsquare[0] =='o') && (filledsquare[3] == 'o') && (filledsquare[6] == 'o')) 
       ||
        ((filledsquare[1] =='o') && (filledsquare[4] == 'o') && (filledsquare[7] == 'o')) 
       ||
        ((filledsquare[2] =='o') && (filledsquare[5] == 'o') && (filledsquare[8] == 'o')) 
       ||
        ((filledsquare[0] =='o') && (filledsquare[4] == 'o') && (filledsquare[8] == 'o')) 
       ||
        ((filledsquare[2] =='o') && (filledsquare[4] == 'o') && (filledsquare[6] == 'o'))) 
       { 
             alert("We have a winner! click on button to start a new game")
       }
}
  
function answer()
{
  if (questionOn == "y")
     {
       questionOn = "n" 
     if (window.document.form_11.list_11.selectedIndex == qnum.correctanswer)
     {
        if (whosturn == 0)
          {
           filledsquare[squareno] = "x"
          }
        else
          {
           filledsquare[squareno] = "o";
          }
  
        qnum.setusage();
        if (squareno == 0)
	 {
	   document.r1c1_image.src = whosturnimage[whosturn];
	 }
        else
            if (squareno == 1) 
         {
	   document.r1c2_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 2) 
         {
	   document.r1c3_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 3) 
         {
	   document.r2c1_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 4) 
         {
	   document.r2c2_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 5) 
         {
	   document.r2c3_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 6) 
         {
	   document.r3c1_image.src = whosturnimage[whosturn];
         } 

        else
            if (squareno == 7) 
         {
	   document.r3c2_image.src = whosturnimage[whosturn];
         } 
        else
            if (squareno == 8) 
         {
	   document.r3c3_image.src = whosturnimage[whosturn];
         } 
     }
   checkwinner()     
   if (whosturn == 0)
            {
              whosturn = 1
	      turntext = "it's o's turn"  
	      window.document.form_12.turn.value = turntext; 
            }
   else
            {
            whosturn = 0
	    turntext = "it's x's turn"  
	    window.document.form_12.turn.value = turntext;  
            }        
}       
else
{
alert("please select a square to get a new question");
}

}
/* --------------------------- the questions -------------------------------------- */ 


  q1 = new questionDB("How old was Adam when Seth was born?","21","33","100","130",3,"Genesis 5:3") 
  q2 = new questionDB("Solomon's trading ships returned without the following","gold","pearls","silver","apes",1,"1 Kings 10:22") 
  q3 = new questionDB("How old was Noah when The flood came?","100","130","600","four score and 10",2,"Genesis 7:6")   
  q4 = new questionDB("Jacob and Rachel were","brother and sister","cousins","father and daughter","not related",1,"Genesis 29:10")
  q5 = new questionDB("In the book of Esther, how many times is God mentioned?","0","1","7","77",0,"Esther")
  q6 = new questionDB("How many cubits long was the ark?","100","300","444","the Bible does not say",1,"Genesis 6:15") 
  q7 = new questionDB("Manna tasted like","grasshoppers","quail","wafers made with honey","saltines",2,"Exodus 16:31")
  q8 = new questionDB("How many verses are in the shortest chapter in the Bible?","2","5","9","12",0,"Psalm 117")
  q9 = new questionDB("What was Shadrach's name before it was changed?","Meshach","Abednego","Daniel","Hananiah",3,"Daniel 1:7") 
 q10 = new questionDB("Who said - Can anything good come out of Nazareth?","Peter","Herod","Nathanael","Judas",2,"John 1:46")  
 q11 = new questionDB("In Genesis the forbidden fruit was","an apple","a fig","an avacado","an unknown type",3,"Genesis 3:3a")
 q12 = new questionDB("By trade Paul was a","silversmith","tentmaker","carpenter","fisherman",1,"Acts 18:1-3")
 q13 = new questionDB("Mary's husband Joseph was a ","silversmith","tentmaker","carpenter","fisherman",2,"Matthew 13:15")
 q14 = new questionDB("Luke was a ","medical doctor","tentmaker","carpenter","fisherman",0,"Colossians 4:14")
 q15 = new questionDB("Zacchaeus was a","medical doctor","tentmaker","lawyer","tax collector",3,"Luke 19:2")
 q16 = new questionDB("Tertullus was a","medical doctor","tentmaker","lawyer","tax collector",2,"Acts 24:1")
 q17 = new questionDB("How many times was Paul shipwrecked?","0","1","3","5",2,"2 Corinthians 11:25")
 q18 = new questionDB("Who said - Lord, why cannot I follow you now? I will lay down my life for you.","Peter","John","Mary","Judas",0,"John 13:37")
 q19 = new questionDB("The wife of this person became a pillar of salt","David","Abraham","Isaac","Lot",3,"Genesis 19:26")
 q20 = new questionDB("Abram was from","Oh","Ur","Uz","Oz",1,"Genesis 11:31")
 q21 = new questionDB("The clothes of John the Baptist were made of","cowhide","camelhide","goatskin","camel hair",3,"Matthew 3:4")
 q22 = new questionDB("Who appeared with Moses on the Mount of Transfiguration?","Aaron","John the Baptist","Elijah","Abraham",2,"Matthew 17:3")
 q23 = new questionDB("How old was Moses when Pharoah's daughter found him in the basket?","4 months","3 months","3 weeks","1 month",1,"Acts 7:20-21")  
 q24 = new questionDB("Stephan, the first recorded Christian martyr, was","hung","burned at the stake","stoned","beheaded",2,"Acts 7 59-60")
 q25 = new questionDB("God spoke to Job","out of a storm","out of a burning bush","out of a pillar of clouds","none of these",0,"Job38:1,40:6")
 q26 = new questionDB("Joseph, Mary and Jesus moved to this country because Herod wanted to kill Jesus","Canaan","Israel","Greece","Egypt",3,"Matthew 2:13")
 q27 = new questionDB("What was the Ethiopian eunuch reading when he met Philip?","the Book of Isaiah","the Book of Genesis","the Book of Daniel","his diary",0,"Acts 8:28")  
 q28 = new questionDB("Sodom and Gamorrah were destroyed by","an earthquake","a flood","a pillar of salt","fire",3,"Genesis 19:24")
 q29 = new questionDB("Which of the following plagues came first?","Frogs","the Nile turned into blood","Flies","boils",1,"Exodus 7-11")
 q30 = new questionDB("How often did it rain in the Garden of Eden?","once a day","once a week", "once a month","never",3,"Genesis 2:5-6")
 q31 = new questionDB("When Moses threw his staff on the ground it turned into this","a dove","a burning bush","a frog","a snake",3,"Exodus 4:4")
 q32 = new questionDB("After the Resurrection, Jesus was on earth for","1 day","3 days","7 days","40 days",3,"Acts 1:3")
 q33 = new questionDB("The disciples were first called Christians in","Jerusalem","Bethlehem","Antioch","Rome",2,"Acts 11:26")
 q34 = new questionDB("Who used the expression - the skin of my teeth?","Able","Cain","Moses","Job",3,"Job 19:20")
 q35 = new questionDB("John was on this island when he wrote Revelation","Crete","Patmos","Sicily","Gilligan's",1,"Revelation 1:9")
 q36 = new questionDB("Jonah was inside the big fish for","3 hours","3 days","7 hours","7 days",1,"Jonah 1:17")  
 q37 = new questionDB("Paul was blind for","3 hours","3 days","7 hours","7 days",1,"Acts 9:9")
 q38 = new questionDB("Manoah begat","Samson","Isaiah","Noah","Lot",1,"Judges 13:2")
 q39 = new questionDB("Abraham was an uncle to all of these except","Uz","Buz","Hazo","Ur",3,"Genesis 22:21-22")
 q40 = new questionDB("Peter paid taxes for Jesus and himself from money he","found in a fish's mouth","earned","was given","found in the street",0,"Matthew 17:27")
 q41 = new questionDB("Which prophet asked if a leopard could change its spots?","Elijah","Daniel","Jeremiah","Job",2,"Jeremiah 13:23")
 q42 = new questionDB("Which prophet lost his shade tree to a hungry worm?","Elijah","Daniel","Jeremiah","Jonah",3,"Jonah 4:6-8")
 q43 = new questionDB("Who said - Cretans are always liars, evil beasts, lazy gluttons?","Timothy","Titus","Silas","Zacchaeus",1,"Titus 1:12")
 q44 = new questionDB("Who said - Your father and I have been anxiously searching for you?","Ruth","Mary","Eve","Pharoah's daughter",1,"Luke 2:48")
 q45 = new questionDB("Paul slept on this street when he was blind","Main","Straight","Crooked","South",1,"Acts 9:11") 
 q46 = new questionDB("Sailors cast lots to find out who was resposible for a storm. Who was it?","Peter","Job","Jonah","Paul",2,"Jonah 1:7")
 q47 = new questionDB("Who was Jesus speaking to when he said - Are you still so dull?","Peter","Matthew","the Pharisees","the disciples",3,"Matthew 16:13")
 q48 = new questionDB("Who was Jesus speaking to when he said - Before the rooster crows today, you will disown me three times","Judas","Peter","Andrew","Mary",1,"Luke 22:61")
 q49 = new questionDB("Who was Jesus speaking to when he said - Come follow me and I will make you fishers of men.","Peter and Paul","John and James","Peter and James","Peter and Andrew",3,"Matthew 4:19")
 q50 = new questionDB("Who was Jesus speaking to when he said - Come down immediately. I must stay at your house today","Zaccheus","Peter","Lazerus","Nathanael",0,"Luke 9:5")
 q51 = new questionDB("The Israelites wore tassles on their clothes to remind them of","the plagues","the passover","God's commandments","the burning bush",2,"Numbers 15:38") 
 q52 = new questionDB("Who made Josephs coat?","his brothers","his father","an Egyptian","he made it himself",1,"Genesis 37:3") 
 q53 = new questionDB("Jesus called this many disciples","3","9","12","13",2,"Matthew 10:1") 
 q54 = new questionDB("Who said - How can a man be born when he is old?","Nicodemus","Peter","Pilate","Bartimaeus",0,"John 3:4")
 q55 = new questionDB("Who said - He must become greater; I must become less.","Peter","John the Baptist","Pilate","Paul",1,"John 3:30")
 q56 = new questionDB("Who said - Samson, the Philistines are upon you!","Bathsheba","Delilah","Ruth","Jezabel",1,"Genesis 24:44")
 q57 = new questionDB("Who said - You will not surely die","Nicodemus","Abaraham","Noah","the serpent",3,"Genesis 3:4") 
 q58 = new questionDB("Who said - I am innocent of this man's blood","Judas","Peter","Stephan","Pontius Pilate",3,"Matthew 27:24")
 q59 = new questionDB("How many stories did the ark have?","1","2","3","4",2,"Genesis 6:16")
 q60 = new questionDB("Moses saw all of the Promised Land from Mount","Moriah","Hor","Nebo","Sinai",2,"Exodus 19:3")
 q61 = new questionDB("Solomon built his temple on Mount","Moriah","Hor","Nebo","Sinai",0,"2 Chronicles 3:1")
 q62 = new questionDB("Aaron died on Mount","Moriah","Hor","Nebo","Sinai",1,"Numbers 20:29")
 q63 = new questionDB("God gave Moses the 10 Commandments on Mount","Moriah","Hor","Nebo","Sinai",3,"Exodus 19:3")
 q64 = new questionDB("Jesus called James and John","doctors of doom","sons of lightning","sons of thunder","clouds of rain",2,"Mark 3:17")
 q65 = new questionDB("Who's son is Solomon?","Bathsheba","Hannah","Hagar","Leah",0,"2 Samuel 12:24")
 q66 = new questionDB("Whos son is Samuel?","Bathsheba","Hannah","Hagar","Leah",1,"1 Samuel 1:20")
 q67 = new questionDB("Whos son is Ishmael?","Bathsheba","Hannah","Hagar","Leah",2,"Genesis 16:15")
 q68 = new questionDB("Whos son is Judah?","Bathsheba","Hannah","Hagar","Leah",3,"Genesis 29:35")
 q69 = new questionDB("One was a farmer and one was a shepherd","Moses and Aaron","Cain and Able","Peter and Andrew","Jacob and Esau",1,"Genesis 4:1-2")
 q70 = new questionDB("How old was Moses when he died?","132","120","100","95",1,"Deuteronomy 34:7")
 q71 = new questionDB("The fear of the Lord is the beginning of... ","everything.","knowledge.","understanding.","hope.",1,"Proverbs 1:7")
 q72 = new questionDB("Where was Abraham supposed to sacrifice Isaac?","Moriah","Sodom","Mamre","Sinai",0,"Genesis 22:2")
 q73 = new questionDB("Where did Jesus heal two demon-possesed men?","Galilee","Region of the Gadarenes","Smyrna","Jerusalem",1,"Matthew 8:28")
 q74 = new questionDB("What was Peter doing when he denied Jesus?","warming himself","resting","walking towards Nazareth","running",0,"John 18:25")
 q75 = new questionDB("Who were Simon the Cyrene's sons?","Alexander and Rufus","Joseph and Adelius","Peter and Jopseph","He had none",0,"Mark 15:21")
 q76 = new questionDB("Where did John the Baptist preach?","Desert of Ramah","Sahara Desert","Desert of Judea","Sinai Desert",2,"Matthew 3:1") 
 q77 = new questionDB("Blessed are the meek for they. . .","own the kingdom of heaven","are called Sons of God","will inherit the Earth","shall be first",2,"Matthew 5:5")
 q78 = new questionDB("Peter was...","married","never married","divorced","of unknown marital status",0,"Matthew 8:14")
 q79 = new questionDB("Dorcas was a","coin","town","man","woman",3,"Acts 9:36") 


q80 = new questionDB("Who said -  Am I a dog that you come at me with sticks?","Goliath","David","Job","Paul",0,"1 Samuel 17:43")
q81 = new questionDB("Who said -  Whom are you pursuing? A dead dog? A flea?","Goliath","David","Job","Paul",1,"1 Samuel 24:14")
q82 = new questionDB("Who said -  You are a child of the devil; and an enemy of everything that is right.","Goliath","David","Job","Paul",3,"Acts 13:10")
q83 = new questionDB("Who said -  Naked I came from my mother's womb, and naked I will depart.","Goliath","David","Job","Paul",2,"Job 1:21")
q84 = new questionDB("To whom was God speaking when He said - Get up and go into Damascus. There you will be told all that you have been assigned to do","Mathew","Mark","Peter","Paul",3,"Acts 22:10") 
q85 = new questionDB("To whom was God speaking when He said - I have seen this people, and they are a stiff-necked people indeed","Jeremiah","Daniel","Moses","Elijah",2,"Deuteronomy 9:13") 
q86 = new questionDB("Who had this dream - He saw a statue whose feet were smashed by a stone","Nebuchadnezzar","Daniel","Joseph","Pharoah",0,"Daniel 2:31-34") 
q87 = new questionDB("Who had this dream - He saw angels going up and down on a ladder","Jacob","Nebuchadnezzar","Daniel","Joseph",0,"Genesis 28:12")
q88 = new questionDB("What do diligent hands bring?","fruits","good works","blisters","wealth",3,"Proverbs 10:4")
q89 = new questionDB("Who killed Abel?","Samson","Seth","Moses","Cain",3,"Genesis 4:8")
q90 = new questionDB("Who killed an Egyptian buried in the sand?","Pharoah","Aaron","Moses","Joseph",2,"Exodus 2:12")
q91 = new questionDB("Paul once addressed a church by saying - You foolish","Romans","Corinthians","Ephesians","Galatians",3,"Galatians 3:1")
q92 = new questionDB("To what church did Paul give milk, not solid food","Romans","Corinthians","Ephesians","Galatians",1,"1 Corinthians 3:2")
q93 = new questionDB("Deborah held court in the shade of a ","pyramid","fig tree","palm tree","cedar",2,"Judges 4:5")
q94 = new questionDB("David was compared to ","the feet of a deer","a young stag","an eagle","a bear",0,"Psalm 18:23")                     
q95 = new questionDB("Joseph's brothers sold him for","a coat of many colors","a cow","a camel","20 shekels of silver",3,"Genesis 37:28")  
q96 = new questionDB("To whom was Jesus speaking when he said - Quiet! Be still!","the wind and the waves","the disciples","Satan","Peter",0,"Mark 4:39")
q97 = new questionDB("To whom was Jesus speaking when he said - Your brother will rise again","Mary","Martha","Lazarus","Timothy",1,"John 11:23")
q98 = new questionDB("After Jesus was resurrected, He ate this with his disciples.","eggs","soup","meat","fish",3,"Luke 24:42-43")



