const kPrefPrefix = "videodownloader.";
const kPrefTBItemInstalled = kPrefPrefix + "toolbariteminstalled";
 
window.addEventListener("load", SavePageInit, false);
 
function SavePageInit()
{
  //var tbItemInstalled = nsPreferences.getBoolPref(kPrefTBItemInstalled, false);
  //if (!tbItemInstalled)
    setTimeout("SavePageAddToolbarItem();", 0);
}
 
function SavePageAddToolbarItem()
{
  const kToolBarID = "nav-bar";
  const kTBItemID = "FreemakeConverter-toolbar-button";
  var tbElem = document.getElementById(kToolBarID);
  var tbItemElem = document.getElementById(kTBItemID);
  if (tbElem && !tbItemElem)
  {
    var newSet = tbElem.currentSet + "," + kTBItemID;
    tbElem.setAttribute("currentset", newSet);
    tbElem.currentSet = newSet;
    document.persist(kToolBarID, "currentset");
    //nsPreferences.setBoolPref(kPrefTBItemInstalled, true);
 
  try {
      BrowserToolboxCustomizeDone(true);
    } catch (e) {}
  }
}