// popup(page,bar,dx,dy)
// popupimage(page,bar,dx,dy)
// includes(letter, string)
// sstop()
// ssbot()
// tableheader()
// row(first, second)
// tablefoot()
// wnheader(words, width)
// wnfooter()
// haha(writethis)


function popup(page,bar,dx,dy) {
		window.open(page, "Image","location=no,scrollbar=" + bar + ",status=1,width=" + dx + ",height=" + dy)
}

function popupimage(page,bar,dx,dy) {
		window.open(page, "Image","location=no,scrollbar=" + bar + ",status=1,width=" + eval(dx + 20) + ",height=" + eval(dy + 30))
}

function includes(letter, string)
{
returnthis = 0
for (i=1; i<=string.length; i++)
  if (letter == string.charAt(i))
    returnthis = returnthis + 1;
return returnthis
}

function ss(filename, width, height) {
  sspath = 'images/'
  if (includes('/', filename)) sspath = '';

  picname = sspath + filename + '.jpg';
  tnname = sspath + filename + '.gif';

  document.write('<td width=' + cellwidth + ' valign="middle">');
  document.write('<a href="javascript:popupimage');
  document.write("('" + picname + "', 'no'");
  document.write(', ' + width + ', ' + height + ')">');
  document.write('<img src="' + tnname + '" width=' + sswidth + ' height=' + ssheight);
  document.write(' border=0><br></a>');
  document.write('</td>');
}

function sstop()
{
sscounter = 0;

tableheader();
document.write('<tr valign="top">');
}

function sshot(filename, width, height)
{
  sscounter = sscounter + 1;
  if (sscounter == (sscol + 1))
    {
      sssplit();
      sscounter = 1;
    }

  ss(filename, width, height);
}

function pic(filename, width, height, tnwidth, tnheight) {
  sswidth = tnwidth;
  ssheight = tnheight;
  sshot(filename, width, height);
}

function sssplit() {
  document.write('</tr><tr>');
  sscounter = 0;
}

function ssbot()
{
  document.write('</tr>');
  tablefoot();
}

function tableheader()
{
  document.write('<center><table bgcolor="#000000" cellspacing=' + cellspace +' cellpadding=0 border=0>');
}

function row(first, second)
{
document.write('<tr><td>' + first + ': ');
document.write('<font color="#000000">##</font></td>');
document.write('<td><b>' + second + '</b></td></tr>');
}

function tablefoot()
{
document.write('</table></center>');
}

function wnheader(words, width) {

  borderbg='#000000'

  for (i=0; i<=words.length; i++)  // Replaces spaces with invisible underscores
    {
      if (words.substring(i, i+1) == ' ')
        {
          words = words.substring(0, i) + '<span id=\'headeri\'>_</span>' + words.substring(i + 1, words.length);
          i = i + 26;
        }
    }

  document.write('<center>');
  document.write('<table border=0 cellpadding=0 cellspacing=0 bgcolor="' + borderbg + '" width=' + eval(width + 32) + '>');
  document.write('<tr>');
  document.write('<td id=\'headert\'>');
  document.write(words);
  document.write('</font></b>');

  document.write('</tr>');

  document.write('<tr>');
  document.write('<td>');

}

function wnfooter() {

  document.write('</td>');
  document.write('</tr>');
  document.write('</table>');
  document.write('</center><br><br>');
}

function wnline() {
wordbg='0000FF'

document.write('</td></tr><tr>');
document.write('<td bgcolor="' + wordbg + '"><b>');
document.write('<font color="ffffff">');
document.write('</font></b></td>');

document.write('</tr>');

document.write('<tr>');
document.write('<td>');

}

function haha(writethis)
{
  alert(writethis)

}


function setsssize(newwidth, newheight) {

  sswidth = newwidth;
  ssheight = newheight;

}

cellspace = '0';
cellwidth = '160';
width = '400';
sswidth = '160';
ssheight = '160';
sscol = 4;

