function popup (url) {
  var w = window.open (url, "", "toolbar=0, scrollbars=1, statusbar=0, menubar=0");
  w.resizeTo (600, 640);
}


function example (h, t, a, c) { 
  this.heading = h;
  this.text = t;
  this.applet = a;
  this.code = c;
}


function assignment (h, t, a, d) {
  this.heading = h;
  this.text = t;
  this.applet = a;
  this.date = d;
}


function writeExample (e) {
  document.write ("<TR>");
  document.write ("<TD><H2>" + e.heading + "</H2></TD>");
  document.write ("<TD>" + e.text + "</TD></TR>");

  document.write ("<TR><TD></TD>");
  document.write ("<TD><TABLE><TR>");

  document.write ("<TD width=220>");
  document.write ("<APPLET code='" + e.applet + "' ");
  document.write ("archive='" + e.applet + ".jar' ");
  document.write ("width=200 height=200> </APPLET>");
  document.write ("</TD>");

  document.write ("<TD><PRE>" + e.code + "</PRE>");
  document.write ("<A href='javascript:popup(" + '"' + e.applet + '.txt"' + ");'>");
  document.write ("Complete source</A>");
  document.write ("</TD>");

  document.write ("</TR></TABLE></TD>");
  document.write ("</TR>");

  document.write ("<TR><TD><BR><BR></TD></TR>");
}


function writeAssignment (a) {
  document.write ("<TR>");
  document.write ("<TD><H2>" + a.heading + "</H2></TD>");
  document.write ("<TD>" + a.text + "</TD></TR>");

  document.write ("<TR><TD></TD>");
  document.write ("<TD><TABLE><TR><TD width=220>");

  document.write ("<APPLET code='" + a.applet + "' ");
  document.write ("archive='" + a.applet + ".jar' ");
  document.write ("width=200 height=200> </APPLET>");

  document.write ("</TD><TD>");

  var today = new Date();
  if (parseInt (a.date.valueOf()) < parseInt (today.valueOf()))
    document.write ("<A href='javascript:popup(" + '"' + a.applet + '.txt"' + ");'>");
  else
    document.write ("<A href='javascript:alert(" + '"This code is no longer available. See the Introduction page."' + ");'>");
  document.write ("Solution</A>");

  document.write ("</TD></TR></TABLE></TD>");
  document.write ("</TR>");

  document.write ("<TR><TD><BR><BR></TD></TR>");
}
