// popup(page,bar,dx,dy)
// popupimage(page,bar,dx,dy)

// includes(letter, string)

// sstop()
// sshot(filename, width, height)
// sssplit()
// ssbot()
// show_img_header()
// show_img()
// show_img_footer()

// tableheader()
// row(first, second)
// tablefoot()

// wnheader(words, width)
// wnfooter()

// setsssize(newwidth, newheight)

// newsheader()
// newsfooter()

// galleryheader(type, title, desc)

// asheader(title, desc)
// asfooter()

// igheader(title, desc)
// igfooter()

// variable declarations

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) {

  sscomment(filename, width, height, '')

}

function sscomment(filename, width, height, comment) {

  if (includes('/', filename)) sspath = '';
  if (filename.charAt(filename.length - 1) == '*') {
    if (filename.substring(filename.length - 3, filename.length - 1) == 'tn') {
      dispname = filename.substring(0, filename.length - 3) + '.gif';
    } else {
      dispname = filename.substring(0, filename.length - 1) + '.gif';
    }
    picname = sspath + dispname;
    tnname = sspath + filename.substring(0, filename.length -1) + '.gif';
//    alert('yo');
  } else {
    dispname = filename + '.jpg';
    picname = sspath + filename + '.jpg';
    tnname = sspath + filename + '.gif';
  }

  document.write('<td width=' + boxwidth + ' valign="top">');
  document.write('<a href="javascript:popupimage');
  document.write("('" + picname + "', 'no'");
  document.write(', ' + width + ', ' + height + ')"><center>');
  document.write('<img src="' + tnname + '" width=' + sswidth + ' height=' + ssheight);
  document.write(' border=0></center></a>');
  document.write('<span id=\'tiny\'>');
  if (comment != '')
    comment = comment + '<br><center><a href=' + picname + '>' + dispname + '</a><br><br>';
  document.write(comment);
  document.write('</center></span>');
  document.write('</td>');

}

function sstop() {

  sscounter = 0;

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

}

function sshot(filename, width, height) {

  sscounter = sscounter + 1;

  if (sscounter == 5) {
    sssplit();
    sscounter = 1;
  }
  ss(filename, width, height);

}

function sssplit() {

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

}

function ssbot() {

  document.write('</tr>');
  tablefoot();
  sscounter = 0;

}

function show_img_header() {

  picname = '';
  dispname = '';
  ssbg = '';
  boxwidth = 0;
  padding = '2';
  sstop();

}

function show_img(filename, width, height, tnwidth, tnheight, desc) {

  setsssize(tnwidth, tnheight)
  ss(filename, width, height)

  document.writeln('</td><td width=400>');
  document.writeln(desc);
  document.writeln(':<br><a href=' + picname + '>' + dispname + '</a></td>');
  sssplit();

}

function show_img2(filename, width, height, tnwidth, tnheight, desc) {

  sscounter = sscounter + 1;

  if (sscounter == 4) {
    sssplit();
    sscounter = 1;
  }
  setsssize(tnwidth, tnheight)
  sscomment(filename, width, height, desc)

}

function show_img_footer() {

  ssbot();

}

function tableheader() {

  document.write('<center><table bgcolor="' + ssbg + '" cellspacing=0 cellpadding=' + padding + ' 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) {

  blue='#AABBFF';
  white='#FFFFFF';
  path='http://adamrulz.com/images/';
  blank1 = '<img src="' + path + 'blank.gif" width=16 height=16><br>';
  blank2 = '<img src="' + path + 'blank.gif" width=16 height=32><br>';

  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="' + blue + '" width=' + width + '>');
  document.write('<tr>');
  document.write('<td width=16 height=32><img src="' + path + 'tl.gif" width=16 height=32><br></td>');
  document.write('<td bgcolor="' + white + '" height=32 width=16 id=\'headert\'>' + words + '<br></td>');
  document.write('<td width=16 height=32><img src="' + path + 'tm.gif" width=16 height=32><br></td>');
  document.write('<td background="' + path + 'ts.gif" width=' + width + ' height=16>' + blank1 + '</td>');
  document.write('<td background="' + path + 'ts.gif" width=' + width + ' height=16>' + blank1 + '</td>');
  document.write('<td background="' + path + 'ts.gif" width=' + width + ' height=16>' + blank2 + '</td>');
  document.write('<td width=16 height=32><img src="' + path + 'tr.gif" width=16 height=32><br></td>');
  document.write('</tr>');
  document.write('<tr>');
  document.write('<td bgcolor="' + blue + '" width=16>' + blank1 + '</td>');
  document.write('<td background="" colspan=5>');

}

function wnfooter() {

  blue='#AABBFF';
  path='http://adamrulz.com/images/';
  blank1 = '<img src="' + path + 'blank.gif" width=16 height=16><br>';
  blank2 = '<img src="' + path + 'blank.gif" width=16 height=32><br>';

  document.write('</td>');
  document.write('<td bgcolor="' + blue + '" width=16>' + blank1 + '</td>');
  document.write('</tr>');

  document.write('<tr>');
  document.write('<td width=16 height=16><img src="' + path + 'bl.gif" width=16 height=16><br></td>');
  document.write('<td bgcolor="' + blue + '" height=16 colspan=5>' + blank1 + '</td>');
  document.write('<td width=16 height=16><img src="' + path + 'br.gif" width=16 height=16><br></td>');
  document.write('</tr>');

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

  document.write('</center><br><br>');

}

function setsssize(newwidth, newheight) {

  sswidth = newwidth;
  ssheight = newheight;

}

function newsheader() {

}

function newsfooter() {

  wnheader('Archive:', 480);
  document.writeln('<a href="news.html">New news</a><br>');
  document.writeln('<a href="news2007.html">2007</a><br>');
  document.writeln('<a href="news2006.html">2006</a><br>');
  document.writeln('<a href="news2005.html">2005</a><br>');
  document.writeln('<a href="news2004.html">2004</a><br>');
  document.writeln('<a href="news2003.html">2003</a><br>');
  document.writeln('<a href="news2002.html">2002</a><br>');
  document.writeln('<a href="news2001.html">2001</a><br>');
  document.writeln('<a href="news2000.html">2000</a><br>');
  wnfooter();

}

function galleryheader(type, title, desc) {

  document.writeln('<br><center><span id=\'out_title\'>' + type +'<br>');
  document.writeln(title + '</span></center><br>');
  ssbg = '';
  tableheader();
  document.writeln('<tr><td width=400 id="out">' + desc + '</td></tr>');
  tablefoot();  
  document.writeln('<br>');

}

function asheader(title, desc) {

  galleryheader('Action Shots!', title, desc);

}

function asfooter() {

  document.writeln('<center><span id=\'out_title\'><a href=http://adamrulz.com/as/>More Action Shots!</a><br>');
  document.writeln('<form>');
  document.writeln('<select name="box" size=0 ');
  document.writeln('onchange="location = form.box.options[form.box.selectedIndex].value;" ');
  document.writeln('style="font-weight: bold" style="color: #FFFFFF" style="background:#FF84C8">');
  document.writeln('<option selected value=http://adamrulz.com/as/>Choose a gallery');
  document.writeln('<option value=http://adamrulz.com/as/adam/>aDam');
  document.writeln('<option value=http://adamrulz.com/as/costumes/>Costumes');
  document.writeln('<option value=http://adamrulz.com/as/pets/>Pets');
  document.writeln('<option value=http://adamrulz.com/as/sports/>Basketball');
  document.writeln('<option value=http://adamrulz.com/as/grad/>Graduation');
  document.writeln('<option value=http://adamrulz.com/as/stuff/>Random stuff');
  document.writeln('</select></form></center>');

}

function igheader(title, desc) {

  galleryheader('Image Gallery', title, desc);

}

function igfooter() {

  document.writeln('<center><span id=\'out_title\'><a href=http://adamrulz.com/gallery/>More Image Galleries</a><br>');
  document.writeln('<form>');
  document.writeln('<select name="box" size=0 ');
  document.writeln('onchange="location = form.box.options[form.box.selectedIndex].value;" ');
  document.writeln('style="font-weight: bold" style="color: #FFFFFF" style="background:#FF84C8">');
  document.writeln('<option selected value=http://adamrulz.com/gallery/>Choose a gallery');
  document.writeln('<option value=http://adamrulz.com/gallery/compstuff/>Computer Stuff');
  document.writeln('<option value=http://adamrulz.com/gallery/3d/>3D');
  document.writeln('<option value=http://adamrulz.com/gallery/sailormoon/>Sailor Moon');
  document.writeln('<option value=http://adamrulz.com/gallery/cartoons/>Cartoons');
  document.writeln('<option value=http://adamrulz.com/gallery/padoffunk/>Adam\'s Pad of FUNK!');
  document.writeln('<option value=http://adamrulz.com/gallery/pokemon/>Pokémon');
  document.writeln('<option value=http://adamrulz.com/gallery/stuff/>Random Stuff');
  document.writeln('</select></form></center>');

}

function dcheader(title, desc) {

  galleryheader('Photos', title, desc);

}

function dcfooter() {

  document.writeln('<center><span id=\'out_title\'><a href=http://adamrulz.com/digicam/>More Digital Camera Photos</a><br>');
  document.writeln('<form>');
  document.writeln('<select name="box" size=0 ');
  document.writeln('onchange="location = form.box.options[form.box.selectedIndex].value;" ');
  document.writeln('style="font-weight: bold" style="color: #FFFFFF" style="background:#FF84C8">');
  document.writeln('<option selected value=http://adamrulz.com/digicam/>Choose a gallery');
  document.writeln('<option value=http://adamrulz.com/digicam/ac3/>AC^3 2007');
  document.writeln('<option value=http://adamrulz.com/digicam/otakon/>Otakon 2007');
  document.writeln('<option value=http://adamrulz.com/digicam/otakon/>Otakon 2006');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/birthdays2006.html>Janine and aDam\'s Birthdays in Ptown');
  document.writeln('<option value=http://adamrulz.com/digicam/alibirthday/>Ali\'s Birthday');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/jan2006.html>Ptown in January');
  document.writeln('<option value=http://adamrulz.com/digicam/newyear/2006.html>New Years 2006');
  document.writeln('<option value=http://adamrulz.com/digicam/christmas/family2005.html>Christmas With the Family');
  document.writeln('<option value=http://adamrulz.com/digicam/christmas/gang2005.html>Christmas Party');
  document.writeln('<option value=http://adamrulz.com/digicam/christmas/fake_christmas.html>Fake Christmas');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/dec2005.html>Ptown in December');
  document.writeln('<option value=http://adamrulz.com/digicam/ac3/>AC^3');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/nov2005.html>A Weekend in Ptown');
  document.writeln('<option value=http://adamrulz.com/digicam/halloween/2005.html>Halloween 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/oct2005.html>A Day in Ptown');
  document.writeln('<option value=http://adamrulz.com/digicam/thanksgiving/2005.html>Thanksgiving 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/santaclara/>Santa Clara');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/sep2005.html>Ptown Strikes Back');
  document.writeln('<option value=http://adamrulz.com/digicam/otakon/>Otakon 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/janineandadam/jul2005_2.html>More Fun in Ottawa');
  document.writeln('<option value=http://adamrulz.com/digicam/taniacot/2005.html>Tania\'s Cottage 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/janineandadam/jul2005_1.html>Post Canada Day Weekend');
  document.writeln('<option value=http://adamrulz.com/digicam/toronto/>Toronto');
  document.writeln('<option value=http://adamrulz.com/digicam/animenorth/>Anime North 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/janineandadam/>Janine and aDam in Ottawa');
  document.writeln('<option value=http://adamrulz.com/digicam/ptown/>Ptown');
  document.writeln('<option value=http://adamrulz.com/digicam/newyear/2005.html>New Years 2005');
  document.writeln('<option value=http://adamrulz.com/digicam/christmas/2004.html>Christmas 2004');
  document.writeln('<option value=http://adamrulz.com/digicam/otsukimi/>Otsukimi');
  document.writeln('<option value=http://adamrulz.com/digicam/weddingalifrance/>France and Ali\'s Wedding');
  document.writeln('<option value=http://adamrulz.com/digicam/alibachelor/>Ali\'s Bachelor Party');
  document.writeln('<option value=http://adamrulz.com/digicam/thanksgiving/2004.html>Thanksgiving 2004');
  document.writeln('<option value=http://adamrulz.com/digicam/applebaseball/>Apple Baseball');
  document.writeln('<option value=http://adamrulz.com/digicam/otfuck/>Otf*ck 2004');
  document.writeln('<option value=http://adamrulz.com/digicam/car/>Car');
  document.writeln('<option value=http://adamrulz.com/digicam/newyear/2004.html>New Years 2004');
  document.writeln('<option value=http://adamrulz.com/digicam/pets/page3.html>Cookie & Stuff');
  document.writeln('<option value=http://adamrulz.com/digicam/thanksgiving/2003.html>Thanksgiving 2003');
  document.writeln('<option value=http://adamrulz.com/digicam/taniacot/2003_fri.html>Tania\'s Cottage 2003');
  document.writeln('<option value=http://adamrulz.com/digicam/otfuck/2003.html>Otfuck 2003');
  document.writeln('<option value=http://adamrulz.com/digicam/primo/>Il Primo');
  document.writeln('<option value=http://adamrulz.com/digicam/sthubbies/>Sthubbies');
  document.writeln('<option value=http://adamrulz.com/digicam/karaoke/>Karaoke');
  document.writeln('<option value=http://adamrulz.com/digicam/fun/>Fun Stuff');
  document.writeln('<option value=http://adamrulz.com/digicam/pets/page2.html>More Pets');
  document.writeln('<option value=http://adamrulz.com/digicam/pets/page1.html>Pets');
  document.writeln('<option value=http://adamrulz.com/digicam/test/>Test Pictures');
  document.writeln('</select></form></center>');

}

width = '400';
sswidth = '160';
ssheight = '160';
boxwidth = '160';
padding = '0';
ssbg = "#000000";
sspath = 'images/';

