function getCodebase()
{
   return "/classes";
}

function createApplet(code, width, height)
{
   // parameter format is:
   //
   // code, width, height, [paramname, paramvalue], ...


   document.writeln("<applet codebase=" + getCodebase() + " code=" + code + " width=" + width + " height=" + height + ">");

   for (i = 3 ; i < createApplet.arguments.length ; i+=2)
   {
      name  = createApplet.arguments[i];
      value = createApplet.arguments[i+1];

      document.writeln("<param name=" + name + " value=" + value + ">");
   }

   document.writeln("</applet>");
}

function createAppletFromJar(appletClass, appletJar, width, height)
{
   // parameter format is:
   //
   // appletClass, appletJar, width, height, [paramname, paramvalue], ...


   document.writeln("<applet archive=/jars/" + appletJar + " code=" + appletClass + " width=" + width + " height=" + height + ">");

   for (i = 3 ; i < createAppletFromJar.arguments.length ; i+=2)
   {
      name  = createAppletFromJar.arguments[i];
      value = createAppletFromJar.arguments[i+1];

      document.writeln("<param name=" + name + " value=" + value + ">");
   }

   document.writeln("</applet>");
}

function createAnimateApplet(img, width, height)
{
   createApplet("Animate.class", width, height, "image", img, "delay", 100);
}

function createAnimateApplet2(img, width, height, fg)
{
   createApplet("Animate.class", width, height, "image", img, "delay", 100, "fg", fg);
}

function createAnimateApplet3(img, width, height, fg, bg)
{
   createApplet("Animate.class", width, height, "image", img, "delay", 100, "fg", fg, "bg", bg);
}

