//
// Index(iinfo) ;
//
// Generates an image index that is as wide as possible for the current page.
//
// img[]      The file names of the images to be displayed.
// width[]    The widths of the individual images
// height[]   The heights of the individual
// url[]      URL for the full image
//
// The largest dimension of each image is assumed to be exactly 100 pixels.
//

function Index(iinfo)
{
  var winSize      = WindowSize(80, 140) ;
  var windowWidth  = winSize.width ;
  var imagesPerRow = Math.max(3, Math.floor(windowWidth / 115)) ;

  document.write("<TABLE BORDER=3 CELLPADDING=5 CELLSPACING=5>") ;
  
  var col = 0 ;
  for (var i = 0 ; i < iinfo.img.length ; ++i)
  {
  	if (col == 0)
  	{
  	  document.write("<TR ALIGN=CENTER VALIGN=MIDDLE><TD WIDTH=110>") ;
  	}
	else
	{
	  document.write("<TD>") ;
	}

	document.write("<A HREF='" + iinfo.url[i] + "'>"
				 + "<IMG SRC='" + iinfo.img[i] + "' WIDTH=" + iinfo.width[i]
				 + " HEIGHT=" + iinfo.height[i] + " ALT='Thumbnail'"
				 + " ALIGN=MIDDLE></A></TD>\n") ;

	++col ;
	if (col == imagesPerRow)
	{
	  document.write("</TR>\n") ;				 
	  col = 0 ;
	}
  }

  if (col != 0)
  {
	document.write("</TR>\n") ;
  }
  
  document.write("</TABLE>\n") ;
}

