function CorrectResponse()
 {
 var OptionString;

 document.all["Qaudio"].volume = -10000;
 OptionString="resizable=no, scrollbars=no, titlebar=no, status=no, width=300, height=200, top="+(screen.availHeight-200)/2+", left="+(screen.availWidth-300)/2;
 w = window.open("Correct.htm","Correct",OptionString);
 w.focus();
 }

function IncorrectResponse()
 {
 var OptionString;

 document.all["Qaudio"].volume = -10000;
 OptionString="resizable=no, scrollbars=no, titlebar=no, status=no, width=300, height=200, top="+(screen.availHeight-200)/2+", left="+(screen.availWidth-300)/2;
 w = window.open("Incorrect.htm","Incorrect",OptionString);
 w.focus();
 }

function CheckDistractors(index,section)
 {
 var answerFlag = true;
 
 if(document.Form.R1[index-1].checked != true) {
  document.Form.Cmnd.value="_REVIEW";
  IncorrectResponse();
  }
 else {
  CorrectResponse();
  }
 }

function CheckKey(numOptions,index,section)
 {
 var bKey;
 
 bKey = window.event.keyCode;
 switch (bKey)
  {
  case 97:
  case 65:
   if(numOptions >= 1) document.Form.R1[0].checked = true;
   if(numOptions >= 2) document.Form.R1[1].checked = false;
   if(numOptions >= 3) document.Form.R1[2].checked = false;
   if(numOptions >= 4) document.Form.R1[3].checked = false;
   if(numOptions >= 5) document.Form.R1[4].checked = false;
   if(numOptions >= 6) document.Form.R1[5].checked = false;
   if(numOptions >= 7) document.Form.R1[6].checked = false;
   if(numOptions >= 8) document.Form.R1[7].checked = false;
   if(numOptions >= 9) document.Form.R1[8].checked = false;
   CheckDistractors(index,section)
   break;
   
  case 98:
  case 66:
   if(numOptions >= 1) document.Form.R1[0].checked = false;
   if(numOptions >= 2) document.Form.R1[1].checked = true;
   if(numOptions >= 3) document.Form.R1[2].checked = false;
   if(numOptions >= 4) document.Form.R1[3].checked = false;
   if(numOptions >= 5) document.Form.R1[4].checked = false;
   if(numOptions >= 6) document.Form.R1[5].checked = false;
   if(numOptions >= 7) document.Form.R1[6].checked = false;
   if(numOptions >= 8) document.Form.R1[7].checked = false;
   if(numOptions >= 9) document.Form.R1[8].checked = false;
   CheckDistractors(index,section)
   break;

  case 99:
  case 67:
   if(numOptions > 2) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = true;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;
   
  case 100:
  case 68:
   if(numOptions > 3) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = true;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;
   
  case 101:
  case 69:
   if(numOptions > 4) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = true;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;
   
  case 102:
  case 70:
   if(numOptions > 5) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = true;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;
   
  case 103:
  case 71:
   if(numOptions > 6) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = true;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;
   
  case 104:
  case 72:
   if(numOptions > 7) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = true;
    if(numOptions >= 9) document.Form.R1[8].checked = false;
    CheckDistractors(index,section)
    }
   break;

  case 105:
  case 73:
   if(numOptions > 8) {
    if(numOptions >= 1) document.Form.R1[0].checked = false;
    if(numOptions >= 2) document.Form.R1[1].checked = false;
    if(numOptions >= 3) document.Form.R1[2].checked = false;
    if(numOptions >= 4) document.Form.R1[3].checked = false;
    if(numOptions >= 5) document.Form.R1[4].checked = false;
    if(numOptions >= 6) document.Form.R1[5].checked = false;
    if(numOptions >= 7) document.Form.R1[6].checked = false;
    if(numOptions >= 8) document.Form.R1[7].checked = false;
    if(numOptions >= 9) document.Form.R1[8].checked = true;
    CheckDistractors(index,section)
    }
   break;
  }
 }

function RunVideo(vidFilename,vidBandwidth,vidWidth,vidHeight,vidVolume)
 {
 document.write('<OBJECT ID="mediaPlayer" width="'+vidWidth+'" height="'+vidHeight+'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" standby="Loading Video..." type="application/x-oleobject">');
 document.write('<param name="URL" value="Videos/'+vidBandwidth+'/'+vidFilename+'.wmx">');
 document.write('<param name="rate" value="1">');
 document.write('<param name="balance" value="0">');
 document.write('<param name="currentPosition" value="-1">');
 document.write('<param name="defaultFrame" value>');
 document.write('<param name="playCount" value="1">');
 document.write('<param name="autoStart" value="-1">');
 document.write('<param name="currentMarker" value="0">');
 document.write('<param name="invokeURLs" value="-1">');
 document.write('<param name="baseURL" value>');
 document.write('<param name="volume" value="'+vidVolume+'">');
 document.write('<param name="mute" value="0">');
 document.write('<param name="uiMode" value="none">');
 document.write('<param name="stretchToFit" value="0">');
 document.write('<param name="windowlessVideo" value="0">');
 document.write('<param name="enabled" value="-1">');
 document.write('<param name="enableContextMenu" value="-1">');
 document.write('<param name="fullScreen" value="0">');
 document.write('<param name="SAMIStyle" value="0">');
 document.write('<param name="SAMILang" value="0">');
 document.write('<param name="SAMIFilename" value="0">');
 document.write('<param name="captioningID" value="0">');
 document.write('<param name="enableErrorDialogs" value="0">');
 document.write('<param name="ShowCaptioning" value="0">');
 document.write('<param name="_cx" value="7567">');
 document.write('<param name="_cy" value="6006">');
 document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="Videos/'+vidBandwidth+'/'+vidFilename+'.wmv" name="mediaPlayer" width="'+vidWidth+'" height="'+vidHeight+'" AutoStart="true" showControls="true">');
 document.write('</OBJECT>');
 }

function RunAudio(audFilename,audBandwidth,audVolume,audMute)
 {
 audVolume = Math.round(audVolume) + 10;
 document.write('<OBJECT ID="mediaPlayer" width="0" height="0" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">');
 document.write('<param name="URL" value="Audio/'+audBandwidth+'/'+audFilename+'">');
 document.write('<param name="rate" value="1">');
 document.write('<param name="balance" value="0">');
 document.write('<param name="currentPosition" value="-1">');
 document.write('<param name="defaultFrame" value>');
 document.write('<param name="playCount" value="1">');
 document.write('<param name="autoStart" value="');
 if(audMute == "ON")
   document.write('0');
 else
   document.write('-1');
 document.write('">');
 document.write('<param name="currentMarker" value="0">');
 document.write('<param name="invokeURLs" value="-1">');
 document.write('<param name="baseURL" value>');
 document.write('<param name="volume" value="'+audVolume+'">');
 document.write('<param name="mute" value="');
 if(audMute == "ON")
   document.write('true');
 else
   document.write('false');
 document.write('">');
 document.write('<param name="uiMode" value="none">');
 document.write('<param name="stretchToFit" value="0">');
 document.write('<param name="windowlessVideo" value="0">');
 document.write('<param name="enabled" value="-1">');
 document.write('<param name="enableContextMenu" value="-1">');
 document.write('<param name="fullScreen" value="0">');
 document.write('<param name="SAMIStyle" value="0">');
 document.write('<param name="SAMILang" value="0">');
 document.write('<param name="SAMIFilename" value="0">');
 document.write('<param name="captioningID" value="0">');
 document.write('<param name="enableErrorDialogs" value="0">');
 document.write('<param name="ShowCaptioning" value="0">');
 document.write('<param name="_cx" value="7567">');
 document.write('<param name="_cy" value="6006">');
 document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="Audio/'+audBandwidth+'/'+audFilename+'" name="mediaPlayer" width="0" height="0" AutoStart="true" showControls="true">');
 document.write('</OBJECT>');
 }