function exec_appli(appli)
{
	var file = Cc["@mozilla.org/file/local;1"]
             .createInstance(Ci.nsILocalFile);
	file.initWithPath(appli);
	
	file.launch();
}

function Exit()
{//ferme l'application
	
//Fonction présente dans le fichier globalOverlay.js
	goQuitApplication();
	
	
/*	var appStartup = Ci.nsIAppStartup;
	Cc["@mozilla.org/toolkit/app-startup;1"].getService(appStartup).quit(appStartup.eAttemptQuit);
*/
}

function Restart()
{//Redémarre l'application
	var appStartup = Ci.nsIAppStartup;
	Cc["@mozilla.org/toolkit/app-startup;1"].getService(appStartup).quit(appStartup.eRestart | appStartup.eAttemptQuit);
}

function openWeb(link)
{
	var ioservice = Cc["@mozilla.org/network/io-service;1"]
									.getService(Ci.nsIIOService);
	
	var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
              .getService(Ci.nsIExternalProtocolService);
									
	var uriToOpen = ioservice.newURI(link, null, null);
	
	extps.loadURI(uriToOpen, null);
}

function lirePref(type, pref)
{//type= char,bool,int
	var PrefServices = Cc["@mozilla.org/preferences-service;1"]
			.getService (Ci.nsIPrefService);
	
	PrefServices = PrefServices.getBranch ("preference.");
	
	type=type.charAt(0).toUpperCase() + type.substring(1).toLowerCase();
	
	return eval('PrefServices.get'+type+'Pref(pref)');
}

function ecrirePref(type, pref, val)
{//type= char,bool,int
	var PrefServices = Cc["@mozilla.org/preferences-service;1"]
			.getService (Ci.nsIPrefService);
	
	PrefServices = PrefServices.getBranch ("preference.");
	
	type=type.charAt(0).toUpperCase() + type.substring(1).toLowerCase();

	eval('PrefServices.set'+type+'Pref(pref, val)');
}

function fileCopy(srcFile, dirDest, newFile)
{
  var aFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
  var aDir = 	Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);

  aFile.initWithPath(srcFile);
  aDir.initWithPath(dirDest);
	
	try
	{
		aFile.copyTo(aDir, newFile);
	}
	catch(e)
	{
		Alert("Erreur de copie!!!", e.name+"\n\n"+e);
		
		return false;
	}
	finally
	{
		
	}
	
	return true;
}

function fileDelete(file)
{
	var aFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
	
	aFile.initWithPath(file);
	
	if (aFile.exists() && aFile.isFile())
	{	
		try
		{
			aFile.remove(false);
		}
		catch(e)
		{
			Alert("Erreur de suppression!!!", e.name+"\n\n"+e);
			
			return false;
		}
		finally
		{
			
		}
	}
	else
	{
		return false;
	}
	
	return true;
}