function squares() {
  var id=0;
  var s1="<div class='square' id='";
  var s2="' onClick='square_clicked(this);'></div>";
  for (var row=0;row<40;row++) {
    document.write("<div class='row'>");
    for (var col=0;col<40;col++) {
      document.write(s1+id+s2);
      id++;
    }
    document.write("</div>");
  }
}
