function border_drawRow()
{
  document.write("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><IMG SRC=\"" + this.cornerImage + "\" HEIGHT=" + this.height + "WIDTH=" + this.height + "></TD>");
  for(i=0;i<this.columns;i++)
  {
    document.write("<TD><IMG SRC=\"" + this.horiImage + "\" HEIGHT=" + this.height + "WIDTH=" + this.width + "></TD>");
  }
  document.write("<TD><IMG SRC=\"" + this.cornerImage + "\" HEIGHT=" + this.height + "WIDTH=" + this.height + "></TD></TR></TABLE>");
}

function border_drawColumn()
{
  document.write("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>");
  for(i=0;i<this.rows;i++)
  {
    document.write("<TR><TD><IMG SRC=\"" + this.vertImage + "\" HEIGHT=" + this.width + "WIDTH=" + this.height + "></TD></TR>");
  }
  document.write("</TABLE>");
}

function border_drawTop()
{
  document.write("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=\"" + this.align + "\"><TR><TD COLSPAN=3>");
  this.drawRow();
  document.write("</TD></TR><TR><TD>");
  this.drawColumn();
  document.write("</TD><TD WIDTH=" + this.columns * this.width + " ALIGN=\"" + this.centerAlign + "\" VALIGN=\"" + this.centerVAlign + "\">");
}

function border_drawBottom()
{
  document.write("</TD><TD>");
  this.drawColumn();
  document.write("</TD></TR><TR><TD COLSPAN=3>");
  this.drawRow();
  document.write("</TD></TR></TABLE>");
}

function border(columns,rows,cornerimage,horiimage,vertimage,align,centeralign,centervalign)
{
  this.height = 20;
  this.width = 30;
  this.rows = rows;
  this.columns = columns;
  this.cornerImage = cornerimage;
  this.horiImage = horiimage;
  this.vertImage = vertimage;
  this.align = align;
  this.centerAlign = centeralign;
  this.centerVAlign = centervalign; 

  this.drawTop = border_drawTop;
  this.drawBottom = border_drawBottom;
  this.drawRow = border_drawRow;
  this.drawColumn = border_drawColumn;
}

function info_open(rows,mapx,mapy,heading,text)
{
  this.height = 20;
  this.width = 30;
  this.rows = rows;
  this.mapX = mapx;
  this.mapY = mapy;
  this.text = text;
  this.heading = heading;

  pagewidth = (this.columns * this.width) + (this.height * 2) + 50;
  pageheight = (this.rows * this.width) + (this.height * 2) + 105;
  if (pagewidth > screen.availWidth) pagewidth = screen.availWidth;
  if (pageheight > (screen.availHeight - 50)) pageheight = screen.availHeight - 50;

  features = "width=" + pagewidth + ",height=" + pageheight + ",";

  if (navigator.appName == "Netscape") features += "screenX=0,screenY=0";
  else features += "left=0,top=0";

  window.open("info.htm","_blank",features);
}

function info(columns,rows,mapx,mapy,title,text)
{
  this.columns = columns;
  this.rows = rows;
  this.mapX = mapx;
  this.mapY = mapy;
  this.text = text;
  this.title = title;

  this.open = info_open;
}

function picture_open(columns,rows,heading,source)
{
  this.columns = columns;
  this.rows = rows;
  this.heading = heading;
  this.source = source;

  pagewidth = (this.columns * this.width) + (this.height * 2) + 50;
  pageheight = (this.rows * this.width) + (this.height * 2) + 50;
  if (pagewidth > screen.availWidth) pagewidth = screen.availWidth;
  if (pageheight > (screen.availHeight - 50)) pageheight = screen.availHeight - 50;

  features = "scrollbars,width=" + pagewidth + ",height=" + pageheight + ",";

  if (navigator.appName == "Netscape") features += "screenX=0,screenY=0";
  else features += "left=0,top=0";

  window.open("picture.htm","_blank",features);
}

function picture(columns,rows,heading,source)
{
  this.height = 20;
  this.width = 30;
  this.columns = columns;
  this.rows = rows;
  this.heading = heading;
  this.source = source;

  this.open = picture_open;
}

function localURL(level,path)
{
  for (i = document.URL.length; i >= 0; i--)
  {
    if ((document.URL.charAt(i) == "\\") || (document.URL.charAt(i) == "/"))
    {
      level--;
      if (level < 0) break;
    }
  }

  r = document.URL.substring(0,i + 1);

  for (j = 0; j <= path.length; j++)
  {
    if ((path.charAt(j) == "\\") || (path.charAt(j) == "/")) r += r.charAt(i);
    else r += path.charAt(j);
  }

  return r;
}