const APP_NAME = "cleanhide";
const APP_PACKAGE = "cleanhide.mozdev.org";
const APP_DISPLAY_NAME = "CleanHide";
const APP_JAR_FILE = "cleanhide.jar";

const APP_VERSION = "1.0.9";
const APP_LOCALES = ["ca-AD","da-DK","de-DE","en-US","es-AR","es-ES","fr-FR","hr-HR","it-IT","ja-JP","ms-MY","nl-NL","pl-PL","pt-BR","ru-RU","zh-CN","zh-TW"];

initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);

var err =  addFile(APP_PACKAGE, APP_VERSION, "chrome/" + APP_JAR_FILE, getFolder("chrome"), null);

if (err == SUCCESS) 
{
	 const chromeFlag = DELAYED_CHROME;	//must be this for zh-CN working right!
 	var jar = getFolder(getFolder("chrome"), APP_JAR_FILE);

   	registerChrome(CONTENT | chromeFlag, jar, "content/");
   	registerChrome(SKIN | chromeFlag, jar, "skin/");

   	for (var i=0 ; i<APP_LOCALES.length ; i++) 
	{
      		registerChrome(LOCALE | chromeFlag, jar, "locale/" + APP_LOCALES[i] + "/");
   	}
	err = performInstall();

   	if (err == SUCCESS || err == 999)
 	{
	}
	 else 
	{
      		alert("Install failed! Error code: " + err);
      		cancelInstall(err);
   	}
}
 else
{
   alert("Failed to install " + APP_DISPLAY_NAME + " " + APP_VERSION + "\n"
       + "You probably don't have appropriate permissions \n"
       + "(write access to Profile/chrome directory).\n");
	   cancelInstall(err);
}
