// Number Place Javascript Solution Rendering 1.9
// (c) 2005 www.numberpuzzles.com Inc. All rights reserved.  
//
// Version History
//  2005-06-04 1.0 - Initial Release
//

// Global variables
var NP_soln;			// string representing solution is box-row-col order
var NP_mask;			// string representing starting state (1=revealed)
var NP_dim = 9;			// width of puzzle

// Global variables "NP_customerID" and "NP_puzzleID" will be provided by the customer web site.
// Based on these variables, a script will set up NP_soln and NP_mask

if (window.NP_soln == null) {
	NP_soln = "000000000000000000000000000000000000000000000000000000000000000000000000000000000";
}
if (window.NP_mask == null) {
	NP_mask = "010110100100010011110100100111100000100101010000010111001011001110001001001001011";
}

// Javascript-encoded HTML for number puzzle form

var NP_form = '';
NP_form = NP_form + '<form>\n<table border=1 cellpadding=0 cellspacing=0>';
var idx = 0;

var i;
for (i=0;i<3;i++) {

  NP_form = NP_form + '  <tr>\n'
  var j;
  for (j=0;j<3;j++) {
    NP_form = NP_form + '    <td>\n<table border=1 cellpadding=0 cellspacing=0>\n';
    var x;
    for (x=0;x<3;x++) {
      NP_form = NP_form + '      <tr>\n';
      var y;
      for (y=0; y<3; y++) {
	var newclass = "NPsol"+NP_mask.charAt(idx);
	NP_form = NP_form + '        <td><input class="' + newclass + '" type="text" id="c'+idx+'" value="' + NP_soln.charAt(idx) + '" size="1" readonly></td>\n';
	idx = idx + 1;
      }
      NP_form = NP_form + '      </tr>\n';
    }
    NP_form = NP_form + '    </table>\n</td>\n';
  }
  NP_form = NP_form + '  </tr>\n'
}
NP_form = NP_form 
+ '  <tr>\n    '
+ '<td colspan=3 border=1 cellpadding=0 cellspacing=0 class="NPcopy">'
+ NP_puzzleID + ' &copy 2005 www.numberpuzzles.com Inc.</td>\n'
+ '  </tr>\n</table>\n</form>\n</center>\n'
+ '<p><center>\n<p></p>\n</center>\n';


// Display number puzzle form
document.write(NP_form);

