var err = initInstall("Mozilla XForms", "XForms", "$Version$");
logComment("initInstall: " + err);

var fProgram = getFolder("Program");
var srChrome = $SpaceRequired$:chrome;
var srComponents = $SpaceRequired$:components;

if (verifyDiskSpace(fProgram, srChrome + srComponents))
{
  err = addDirectory("", "$Version$", "components", fProgram, "components", true);
  logComment("addDirectory components: " + err);
  err = addDirectory("", "$Version$", "chrome", fProgram, "chrome", true);
  logComment("addDirectory chrome: " + err);

  registerChrome(PACKAGE | DELAYED_CHROME, getFolder("Chrome", "xforms.jar"),
                 "content/xforms/");
  registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome", "xforms.jar"),
                 "locale/en-US/xforms/");

  if (err == SUCCESS)
  {
    err = performInstall();
    logComment("performInstall() returned: " + err);
  }
  else
  {
    cancelInstall();
    logComment("cancelInstall() due to error: "+err);
  }
}
else
  cancelInstall(INSUFFICIENT_DISK_SPACE);
