	
  var objXmlHTTP,objXmlDOM;
  var aQuest; //to store question ids
  var aAnswer = new Array(); // to track the result
  var aSelected = new Array(); // to store user's response
  var count = 0; //to store the current question no
  var ansSel = 0; //to store user's selection
  var ExamDuration = 10 * 60 ; // 15 minutes
  var timerID; //to store the setInterval fun's id
  var radIndex = -1; //to store the selected radio's index


  function init(){
    objXmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    objXmlDOM = new ActiveXObject("Microsoft.XMLDOM");
    objXmlHTTP.open("POST","quiz.asp?Action=Start",false);
    objXmlHTTP.send("");
    temp =objXmlHTTP.ResponseText;
    aQuest = temp.split(",");

   
    for(i=0;i<aQuest.length; i++){
      aAnswer[i] = 0; // 0 for wrong; 1 for right answer
      aSelected[i] = -1; // to store the radio's index
    }

    if(count < aQuest.length) {
      url = "quiz.asp?Action=NextQ&QNo=" + aQuest[count];
      objXmlHTTP.open("POST", url ,false);
      objXmlHTTP.send("");
      objXmlDOM.loadXML(objXmlHTTP.ResponseText);
      
    
      parseQ();
    }
    
  
    document.frm.btnFinish.value = "Finish...";
    document.frm.btnFinish.onclick = showResult; //function
    

    timerID = setInterval("timer()",1000);
  }

  function getPreQ() {

    checkAnswer();
    

    count--;
    

    clearInterval(timerID);
    

    url = "quiz.asp?Action=NextQ&QNo=" + aQuest[count];
    objXmlHTTP.open("POST",url ,false);
    objXmlHTTP.send("");
    objXmlDOM.loadXML(objXmlHTTP.ResponseText);



    parseQ();
    
    timerID = setInterval("timer()",1000);
  }

  function getNextQ() {

    checkAnswer();


    count++;


    clearInterval(timerID);

    url = "quiz.asp?Action=NextQ&QNo=" + aQuest[count];
    objXmlHTTP.open("POST", url ,false);
    objXmlHTTP.send("");
    objXmlDOM.loadXML(objXmlHTTP.ResponseText);



    parseQ();


    timerID = setInterval("timer()",1000);
  }

  function parseQ(){


    strOut  = "";
    strOut += "";
    strOut += " <b>Question No: " + (count+1) + " of ";
    strOut += aQuest.length + "</b><br /><br />";
    strOut += "&nbsp;";

    temp = objXmlDOM.selectSingleNode("data/qtext").text;

    strOut += "<b>"+temp+"</b><br /><br />";
    strOut += "&nbsp;<br />";

    Nodes = objXmlDOM.selectNodes("data/choice");

    for(i=0;i<Nodes.length;i++){
      strOut += "";
      strOut += "<input type=radio class=radio name=ansUsr ";
      strOut += " onClick='ansSel=" + (i+1);
      strOut += ";radIndex=" + i + "' ";
      strOut += "value=" + (i+1) + ">";
      strOut +=  Nodes.item(i).text + "<br /><br />";		
    }


    temp = objXmlDOM.selectSingleNode("data/answer").text;
    document.frm.ansNo.value = temp;

    strOut += "&nbsp;<br />";
    strOut += "";

    if(count != 0 ){
      strOut += "<input type=button class=cc5 value=Previous ";
      strOut += " onClick='getPreQ()'> ";
    }

    if(count < aQuest.length-1){
      strOut += " <input type=button class=cc5 value=Next";
      strOut += " onClick='getNextQ()'>";			
    }

    strOut += "<br /><br />";


    QArea.innerHTML = strOut;


    ansSel = 0;
    radIndex = -1;


    if (aSelected[count] != -1) {
      radIndex = aSelected[count];
      ansSel = radIndex + 1;
      document.frm.ansUsr[radIndex].checked = true;
    }
  }

  function checkAnswer(){

    aSelected[count] = radIndex;


    if (ansSel == document.frm.ansNo.value)
      aAnswer[count] = 1;
    else
      aAnswer[count] = 0;
  }

  function showResult() {
    rights = 0;


    clearInterval(timerID);


    checkAnswer();


    for(i=0;i<aAnswer.length;i++){
      if(aAnswer[i] == 1)
      rights++;
    }
    strRes = "<html><head><title>The British Columbia Denturist Association : Quiz</title>												<script language='javascript' src='jsm.js' type='text/javascript'></script>																						<link href='cssm.css' rel='stylesheet' type='text/css' />																								<link href='css.css' rel='stylesheet' type='text/css' />																					</head><body><table>  <tr>    <th colspan='3'><script language='javascript' src='js.js' type='text/javascript'></script></th>  </tr>  <tr>    <td><img src='images/02.jpg' />	<h3></h3>	<p class='p1'><strong>The Denturist Association of British Columbia</strong> <br />        <br />      Suite 312C-9801 King George Hwy, Surrey BC V3T-5H5<br />      <br />      <img src='images/21.gif' /> <b>604-582-6823<br />     </b> <a href='http://www.denturist.bc.ca'>www.denturist.bc.ca</a><br />      <a href='mailto:info@denturist.bc.ca'>info@denturist.bc.ca</a><br /></p>      </td>    <td>";
	
	


    if(rights == aAnswer.length)
      strRes += "Congratulations...!";
	  
	  
	   strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  
	  strRes += "";
	  
	

    strRes += "<h1>&nbsp;&nbsp;&nbsp;your score is " + rights;
    strRes += " out of " + aAnswer.length + " </h1>";


	  strRes += "<a href=quiz.html class='dam'> BACK TO QUIZ</a>";
	  strRes += "";
	  strRes += "<p><br />NOTE:  Compare your answers here. There is random order to answer a question, which not represent order you answered questions...  </p> ";
	  strRes += "   <p><ul style='text:10px' id='1'> <li>The word Denturist means?</li>    <ul>      <li>A person licensed to fabricate and fit dentures to the public.'</li>      <li>Same as Dentist </li>      <li>Something french</li>      <li>Nothing</li>    </ul>    <li>Answer: question no. 1</li>  </ul>  <ul id='2'>    <li>How often should your dentures be examined?</li>    <ul>      <li>every year</li>      <li>every 2 years</li>      <li>every 4 years</li>      </ul>    <li>Answer: question no. 2</li>  </ul>  <ul id='3'>    <li>How often should your dentures be replaced?</li>    <ul>      <li>every 2 years</li>      <li>every 5 years</li>      <li>every 10 years</li>      </ul>    <li>Answer: question no. 2</li>  </ul>  <ul id='4'>    <li>What is an immediate denture?</li>    <ul>      <li>it is a denture that is made in one day</li>      <li>when all of your remaining teeth need to be extracted the denture is made BEFORE the teeth are pulled  and inserted on the same day as the extraction's.</li>      <li>it means there is no waiting time to have your dentures made.</li>      </ul>    <li>Answer: question no. 2</li>  </ul>  <ul id='5'>    <li>What is a reline?</li>    <ul>      <li>a reline is done when your denture is fitting tight.</li>      <li>a reline is done when you have had your dentures for more than 15 years.</li>	  <li>a reline is the resurfacing of the tissue side of your denture and should be done every 2 years in order to keep a proper fit.</li>     </ul>    <li>Answer: question no. 3</li>  </ul>  <ul id='6'>    <li>What is a partial denture?</li>    <ul>      <li>a denture that is partially cracked</li>      <li>not a full denture</li>      <li>a removable prosthesis that replaces one or more missing teeth</li>    </ul>    <li>Answer: question no. 3</li>  </ul>  <ul id='7'>    <li>What does the RD behind Denturist stand for?</li>    <ul>      <li>Registered Doctor</li>      <li>Registered Nurse</li>      <li>Registered Denturist</li>	  <li>Registered Dentist</li>	     </ul>    <li>Answer: question no. 3</li>  </ul>  <ul id='8'>    <li>What does a Denturist do?</li>    <ul>      <li>They only fabricate dentures</li>      <li>they do dental implant surgery</li>      <li>they fabricate removable dentures, partial dentures and Dentures over implants</li>    </ul>    <li>Answer: question no. 3</li>  </ul>	 <ul id='9'>    <li>True or False you need a referral from your dentist to see a Denturist?</li>    <ul>      <li>False</li>	  <li>True</li>      </ul>    <li>Answer: question no. 1</li>  </ul> <ul id='10'>    <li>What is a softliner?</li>    <ul>      <li>a removable substance applied to your denture to make it soft</li>      <li>a medical grade soft polymer material that is permanently applied to the tissue-fitting surface of your dentures.</li>    </ul>    <li>Answer: question no. 2</li>  </ul> <ul id='11'>    <li>What does a sofliner do?</li>    <ul>      <li>makes your dentures soft</li> 	  <li>it behaves as a shock-absorbing cushion when chewing</li>      <li>it helps dentures over 10 years old fit better</li>       </ul>    <li>Answer: question no. 2</li>  </ul></p>";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "";
	  strRes += "</td><td><form method='get' action='search.asp' style='background:#cccccc;margin:0;padding:2px;border:1px solid #aaaaaa;'>		<input type='hidden' name='m' value='query' />		<input type='text' style='width:100px;'  name='query' value='Find a Denturist' />		<input type='submit'  value='Search' class='cc4' /> 		</form>        <a href='index.html' class='da1'>Home</a><a href='denturists_denture_specialists.html' class='da'>Denturists are Denture Specialists</a><a href='exams_care_maintenance.html' class='da'>Exam, Care and Maintenance</a><a href='full_dentures.html' class='da'>Full Dentures</a><a href='immediate_dentures.html' class='da'>Immediate Dentures</a><a href='implant_retained_dentures.html' class='da'>Implant Retained Dentures</a><a href='personalized_standard_dentures.html' class='da'>Personalized Standard Dentures</a><a href='personalized_precision_dentures.html' class='da'>Personalized Precision Dentures</a><a href='reline_rebase_repairs.html' class='da'>Reline, Rebase, and Repairs</a><a href='removable_partial_dentures.html' class='da'>Removable Partial Dentures</a><a href='benefits_soft_liners.html' class='da'>Benefits of Soft Liners</a><a href='when_denture_replacing.html' class='da'>When Does a Denture Need Replacing</a><a href='president_message.html' class='da1'>President&rsquo;s Message</a><a href='faq.html' class='da'>Frequency Asked Questions</a><a href='quiz.html' class='da'>Denture Quiz</a><a href='bc_government.html' class='da'><b>News:</b> BC Government passes new partial denture legislation.</a><a href='site_map.html' class='da1'>Site Map</a><a href='contact_us.html' class='da'>Contact us</a></td></tr><tr><td class='footer' colspan='3'>";
	  strRes += "<a href='privacy.html'>Privacy</a> | Copyright (c) 2005 - 2006, All rights reserved. | The Denturist Association of British Columbia  		<br />";
	  strRes += "";
	  strRes += "</td></tr></table>";
	  strRes += "</body></html>";
	  

    document.write(strRes);
  }

  var timeCount = 0;
  function timer(){
    timeCount++;  

   

    temp =  " Time:   " + parseInt(timeCount/60);
    temp += "  min : " + (timeCount%60) + " sec ";
    TBlock.innerText = temp;


    if (timeCount == ExamDuration) {
      alert("Sorry, time is up");
      showResult();
    }
  }
