// scrshots.js - Screen Shot Display Functions

//*******************************************//
//************ SCREEN SHOT FUNCTIONS *********//
//*******************************************//


// Create Screen Shots 
function ScreenShotTableCreate()
{
  var tagwrite = "";

  // Screen List
  var sarray = new Array();
 
  // [name, title]
  sarray[0] = ["sc1", "Introduction: The Princess<br />and the Blue Bunny"];
  sarray[1] = ["sc2", "Riddle Guessing Screen<br />"];
  sarray[2] = ["sc3", "Dragon Word Problems<br />"];
  sarray[3] = ["sc4", "Entry Question<br />"];
  sarray[4] = ["sc5", "Telling Time with</br>the Clock Monster"];
  sarray[5] = ["sc6", "Genie Memory Game<br />"];
  sarray[6] = ["sc7", "Alien Multiple Choice<br />"];
  sarray[7] = ["scmt1", "Math Tutor - Addition<br/>"];
  sarray[8] = ["scmt2", "Math Tutor - Long Division<br />"];

  // Get columns and rows
  var total = sarray.length;
  var ncols = 3;
  var rowplus = total%ncols;
  var nrows = Math.floor(total/ncols + rowplus);
  var row, col, inum = 0;
  var imgpc;
  
  // SCREEN SHOT TABLE
  tagwrite = tagwrite + "<table cellpadding='15' cellspacing = '0' style='font-weight:bold'>";

  // Screen shots
  for (row = 0; row < nrows; row++)
  {
    // Start a row
    tagwrite = tagwrite + "<tr valign='top'>";

    // Columns in row
    for (col = 0; (inum < total) && (col < ncols); col++)
    {
      // Start column
      tagwrite = tagwrite + "<td>";

      // Screen Shot Title
      title = sarray[inum][1];

      // Screen shot Postcard
      imgpc = "img/screens/" + sarray[inum][0] + "_sm.jpg";

      // Screen shot Expanded Version
      imgexp = "img/screens/" + sarray[inum][0] + ".gif";

      // Screen Shot title link
      tagwrite = tagwrite + "<a href = '" + imgexp + "'>";
      tagwrite = tagwrite + title;
      tagwrite = tagwrite + "</a>";

      // Space
      tagwrite = tagwrite + "<br />";
      tagwrite = tagwrite + "<br />";

      // Screen Shot postcard link
      tagwrite = tagwrite + "<a href = '" + imgexp + "'>";
      tagwrite = tagwrite + "<img src='" + imgpc + "'>";
      tagwrite = tagwrite + "</a>";

      // Calculate item number
      inum++;
  
      // End column
      tagwrite = tagwrite + "</td>";
    }

    // End a row
    tagwrite = tagwrite + "</tr>";
  }

  // END SCREEN SHOT TABLE
  tagwrite = tagwrite + "</table>";

  // Write image tag
  document.write(tagwrite);
}
