function populate_options_pad(){
	var html=''
	+'<form name="moptions" onsubmit="return false;">'
	+'<span style="font-weight:normal; font-size:3.25mm;">'
	+'<span style="display:block;margin:15px 0 5px 0;font-weight:bold;border-bottom:1px #aaa solid;padding-bottom:5px;">Options:</span>'
	+'<button accesskey="n" class="option_buttons" onclick="return new_game_button()"><u>N</u>ew Game</button>'
	+'<button accesskey="X" class="option_buttons" onclick="return exit_game_button()">E<u>x</u>it Game</button>'
	+'<button accesskey="m" class="option_buttons" onclick="return more_games_button()"><u>M</u>ore Games</button>'
	+'<button accesskey="m" class="option_buttons" onclick="return more_games_button()">Report Issue</button>'
	+'<span style="display:block;margin:15px 0 5px 0;font-weight:bold;border-bottom:1px #aaa solid;padding-bottom:5px;">Pictures:</span>'

	for(var uberI=1; uberI<total_categories; uberI++){
    try{ 
  	  var tcat=eval("cat"+uberI);
  	  if(tcat.name && tcat.name.length>0){
  	    html+='<input type="checkbox" name=cat'+uberI+' '+tcat.mchecked+'>'+tcat.name+'<br>';
  	  }
    } catch(e){ 
      fatal_error(
        'Failed to build categories', /* the error */
        'Possibly a misconfigured data file', /* possibleCause */
        'Notify the author' /* possibleSolution */
      ); return false;
    }
	}

  html+=''
	+'<span style="display:block;margin:15px 0 5px 0;font-weight:bold;border-bottom:1px #aaa solid;padding-bottom:5px;">Difficulty:</span>'
	+'<input type="radio" name="dlevel" value="easy">Easy<br>'
	+'<input type="radio" name="dlevel" value="norm" checked>Normal<br>'
	+'<input type="radio" name="dlevel" value="hard">Hard<br>'

  var test=document.getElementById('msound'); 
  if(test && test.src != undefined){
  /* IE supports BGSOUND tag */
  html +=''
	+'<p>Sounds:<br>'
	+'<hr style="height:1px;">'
	+'<input type="radio" name="dsound" value="on">On<br>'
	+'<input type="radio" name="dsound" value="off" checked>Off<br>'
  }

  html+=''
	+'<br></span>'
	+'</form>'

  //<button class="option_buttons" onclick="return window.constructSpacksHintRequest();">Hint</button>\
	document.getElementById('options_pad').innerHTML = html;
	return;
}


function mkBtn(lt,vowel){
  return '<input type="button" name="'+lt.toUpperCase()+'" value="'+lt.toUpperCase()+'" onfocus="blur();" onclick="return process_key(this);" class="'+(vowel?'vowel':'consonent')+'">'
}

function populate_control_pad(){
  var lt='QWERTYUIOP@ASDFGHJKL@ZXCVBNM'
  var vowels='AEIOU'
  var html='<form name="HANGMANFORM" onsubmit="return false;">'
  for(var i=0; i<lt.length; i++){
    if(lt.charAt(i)=='@') html+='<br>'
    else html+=mkBtn(lt.charAt(i),vowels.match(lt.charAt(i)))
  }
  html+='</form><br><br>'
  document.getElementById('control_pad').innerHTML=html;
  return;
}



function populate_score_pad(){
  var score_str=''
  +'<table width="100%"><tr>'
  +'<td width="50%" align="right" nowrap>Correct Guesses:</td>'
  +'<td width="50%" id="correct_chars" style="letter-spacing:3px;">&nbsp;</td>'
  +'</tr><tr>'
  +'<td width="50%" align="right" nowrap>Incorrect Guesses:</td>'
  +'<td width="50%" id="incorrect_chars" style="letter-spacing:3px;">&nbsp;</td>'
  +'</tr><tr>'
  +'<td width="50%" align="right" nowrap>Words Guessed:</td>'
  +'<td width="50%" id="gamelevel" style="letter-spacing:3px;">0</td>'
  +'</tr><tr>'
  +'<td width="50%" align="right" nowrap>Your Score:</td>'
  +'<td width="50%" id="yourscore" style="letter-spacing:3px;">0</td>'
  +'</tr></table><br>';
  document.getElementById('score_pad').innerHTML=score_str;
  return;
}



// This section builds the HTML for the page. By including it within a SCRIPT section it can be encoded.
window.buildBoard = function(){
  var ovr_styl = 'visibility:hidden; display:block; position:absolute; width:400px; left:50%; margin-left:-200px; top:300px; z-index:999; background:#000; padding:4px;'
  var html=''
  +'<table border="0" style="height:100%;" cellpadding="0" cellspacing="0" width="100%"><tr align="top"><td width="100%" align="center" class="main" id="main_pad">'
  /* gallows */
  +'<table border="0" cellpadding="0" cellspacing="0">'
  +'<tr valign="top">'
  +'<td rowspan="2"><img name="gallow_left_img" src="loading1.gif" width="125" height="300"></td>'
  +'<td>'
  +'<img name="gallow_right_img" src="pixel.gif" width="125" height="34"><br>'
  +'<table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%">'
  +'<tr valign="top"><td><img name="noose_img" src="pixel.gif" width="125" height="265"></td></tr>'
  +'</table>'
  +'</td></tr></table>'

  +'<table border="0" cellpadding="0" cellspacing="0">'
  +'<tr><td align="center" colspan="2" id="score_pad"></td></tr>'
  +'<tr valign="top"><td align="center" colspan="2" id="control_pad"></td></tr>'
  +'</table>'

  +'</td><td valign="bottom" width="100" nowrap class="options" style="padding:5px;" id="options_pad">'
  +'</td></tr></table>'
  +'<span id="mwidget" style="opacity:0.75;width:234px;border:2px #ccc dotted;display:block;position:absolute;top:2px;right:2px;margin:0;padding:2px;background:#eee;">'
  +'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" id="Player_59734fb5-48c8-4f4c-b446-f41c34784a74"  WIDTH="234px" HEIGHT="60px"> <PARAM NAME="movie" VALUE="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fesqsoftcom-20%2F8014%2F59734fb5-48c8-4f4c-b446-f41c34784a74&Operation=GetDisplayTemplate"><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><PARAM NAME="allowscriptaccess" VALUE="always"><embed src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fesqsoftcom-20%2F8014%2F59734fb5-48c8-4f4c-b446-f41c34784a74&Operation=GetDisplayTemplate" id="Player_59734fb5-48c8-4f4c-b446-f41c34784a74" quality="high" bgcolor="#ffffff" name="Player_59734fb5-48c8-4f4c-b446-f41c34784a74" allowscriptaccess="always"  type="application/x-shockwave-flash" align="middle" height="60px" width="234px"></embed></OBJECT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V20070822%2FUS%2Fesqsoftcom-20%2F8014%2F59734fb5-48c8-4f4c-b446-f41c34784a74&Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT>'
  +'<center style="font-size:2.75mm;">Sample favorites while you play? <a style="color:#000;text-decoration:none;" href="#" onclick="document.getElementById(\'mwidget\').style.display=\'none\';return false;">[hide]</a></center>'
  +'</span>'
  +'<br><br><center><iframe id="a649ee0b" name="a649ee0b" src="http://hostagnostic.com/openads/adframe.php?n=a649ee0b&amp;clientid=6&amp;target=_blank&amp;refresh=240" framespacing="0" frameborder="no" scrolling="no" width="728" height="90" allowtransparency="true"><a href="http://hostagnostic.com/openads/adclick.php?n=a649ee0b" target="_blank"><img src="http://hostagnostic.com/openads/adview.php?clientid=6&amp;n=a649ee0b" border="0" alt=""></a></iframe></center>'

  /* start: new_game_button container */
  html += ''
  +'<span style="'+ovr_styl+'" id="tnewgame">'
  +'<table class="new_game" cellpadding="5" cellspacing="5">'
  +'<tr><td width="100%" align="center" class="new_game_heading">Start New Game?</td></tr>'
  +'<tr valign="top"><td id="tnewgametext" class="new_game_text">'
  +'Starting a new game will cause your '
  +'current game to be lost. Are you '
  +'sure you want to start a new game?<br><br>'
  +'</td></tr>'
  +'<tr><td align="center">'
  +'<form onsubmit="return false;">'
  +'<button accesskey="y" style="width:50px;" onclick="'
  +'    if(document.getElementById(\'tnewgame\').style.visibility==\'visible\'){'
  +'      document.getElementById(\'tnewgame\').style.visibility=\'hidden\';'
  +'      new_game(); ok_to_run=true;}"><U>Y</U>es</BUTTON'
  +'  ><BUTTON ACCESSKEY=N STYLE="width:50px;" ONCLICK="'
  +'    if(document.getElementById(\'tnewgame\').style.visibility==\'visible\'){'
  +'      document.getElementById(\'tnewgame\').style.visibility=\'hidden\';'
  +'      ok_to_run=true; '
  +'}"><U>N</U>o</button></form>'
  +'</td></tr></table>'
  +'</span>'
  /* end: new_game_button container */


  /* start: win_rountine container */
  html += ''
  +'<span style="'+ovr_styl+'" id="twingame">'
  +'<table width="100%" class="win_game" cellpadding="5" cellspacing="5">'
  +'<tr>'
  +'  <td width="100%" align="center" class="win_game_heading">Congratulations!</td>'
  +'</tr>'
  +'<tr valign="top">'
  +'  <td id="twingametext" class="win_game_text">&nbsp;</td>'
  +'</tr><tr>'
  +'  <td align="center">'
  +'  <form style="display:inline;clear;" onsubmit="return false;">'
  +'  <button accesskey="k" style="width:50px;" onclick="'
  +'    if(document.getElementById(\'twingame\').style.visibility==\'visible\'){'
  +'    document.getElementById(\'twingame\').style.visibility=\'hidden\';'
  +'    new_game(\'win\');'
  +'    ok_to_run=true;'
  +'  }">O<u>k</u></button></form>'
  +'  </td>'
  +'</tr>'
  +'</table>'
  +'</span>'
  /* end: win_routine container */


  /* start: game over container */
  html += ''
  +'<span style="'+ovr_styl+'" id="tgameover">'
  +'<table width="100%" class="game_over" cellpadding="5" cellspacing="5">'
  +'<tr>'
  +'  <td width="100%" align="center" class="game_over_heading">Game Over</td>'
  +'</tr>'
  +'<tr valign="top">'
  +'  <td id="tgameovertext" class="game_over_text">&nbsp;</td>'
  +'</tr><tr>'
  +'  <td align="center">'
  +'<form style="display:inline;clear;" onsubmit="return false;">'
  +'<button accesskey="r" style="width:100px;" onclick="'
  +'  document.getElementById(\'tgameover\').style.visibility=\'hidden\';'
  +'  new_game();'
  +'  ok_to_run=true;'
  +'"><U>R</U>estart</button>'
  +'<button accesskey="e" style="width:100px;" onclick="'
  +'  window.close()'
  +'"><u>E</u>xit Game</button></form>'
  +'  </td>'
  +'</tr>'
  +'</table>'
  +'</span>'
  /* end: game over container */


  /* start: exit game container */
  html += ''
  +'<span style="'+ovr_styl+'" id="texitgame">'
  +'<table class="exit_game" width="100%" cellpadding="5" cellspacing="5">'
  +'<tr>'
  +'  <td width="100%" align="center" class="exit_game_heading">Exit Game?</td>'
  +'</tr><tr valign="top">'
  +'  <td id="texitgametext" class="exit_game_text">'
  +'  <center>Quit game and close this window?</center>'
  +'  </td>'
  +'</tr><tr>'
  +'  <td align="center">'
  +'<form style="display:inline;clear;" onsubmit="return false;">'
  +'<button accesskey="y" style="width:50px;" onclick="'
  +'  if(document.getElementById(\'texitgame\').style.visibility==\'visible\'){'
  +'    window.close();'
  +'  }"><u>Y</u>es</button>'
  +'<button accesskey="N" style="width:50px;" onclick="'
  +'  if(document.getElementById(\'texitgame\').style.visibility==\'visible\'){'
  +'    document.getElementById(\'texitgame\').style.visibility=\'hidden\';'
  +'    ok_to_run=true;'
  +'  }"><u>N</u>o</button></form>';

  var rnd=parseInt(Math.random()*5);
  if(rnd==1){
    /* test, does asking help? */
    html += ''
    +'<p><span style="display:block;text-align:left;padding:10px; border-top:1px #fff solid;background:#ddf;border-bottom:1px #666 solid;">'
    +'<b>Before you go, please consider helping us out by visiting a sponsor. &nbsp;&nbsp;Thank you!</b>'
    +'</span>'
  }

  html += ''
  +'  </td>'
  +'</tr>'
  +'</table>'
  +'</span>'
  /* end: game exit container */


  <!-- start: feature container -->\
  html += '\
  <span style="'+ovr_styl+'" id=tfeaturegame>\
  <TABLE CLASS=feature_window CELLPADDING=5 CELLSPACING=5 BORDER=0>\
    <TR>\
      <TD WIDTH=100% ALIGN=center CLASS=feature_window_heading ID=tfeaturegameheading>?</TD>\
    </TR>\
    <TR VALIGN=top>\
      <TD CLASS=feature_window_text>\
      <IFRAME ID=tfeaturegametext SRC="loading.html" FRAMEBORDER=0 ALLOWTRANSPARENCY=TRUE STYLE="width:375px;height:450px;"></IFRAME>\
      </TD>\
    </TR>\
    <TR>\
      <TD ALIGN=center>\
  <FORM STYLE="display:inline;clear;" onsubmit="return false;">\
  <BUTTON ACCESSKEY=O \
    STYLE="width:50px;"\
    ONCLICK="\
    if(document.getElementById(\'tfeaturegame\').style.visibility==\'visible\'){\
      document.getElementById(\'tfeaturegame\').style.visibility=\'hidden\';\
      document.getElementById(\'tfeaturegametext\').src=\'loading.html\';\
      ok_to_run=true;\
    }\
  "><U>O</U>k</BUTTON></FORM>\
      </TD>\
    </TR>\
  </TABLE>\
  </span>\
  <!-- end: feature container -->\
  ';
  document.getElementById('mbody').innerHTML = html
}
window.buildBoard()