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 = 20;
  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 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;
}