// Javascript functions to install the extension cleanly.

function install (aEvent)
{
  if (jQuery.browser.mozilla) {
     var index = navigator.userAgent.indexOf("Firefox/")+8;
     var ffver = parseFloat(navigator.userAgent.substring(index));

     if (ffver >= 3) {
         // Firefox 3 wants a secure site to download from.
         var params = {
             "Strategy Tutor Extension":
             { URL: "https://xander.cast.org/cst/cstsidebar.xpi",
               toString: function () { return this.URL; }
             }
         };
         InstallTrigger.install(params);

     } else if (ffver >= 1.5) {
         // Firefox 2 wants to download from the current site.
         var params = {
             "Foo": { URL: aEvent.target.href,
                      toString: function () { return this.URL; }
             }
         };
         InstallTrigger.install(params);
         
     } else {
         alert ("You do not have a supported version of Firefox.\nThis application requires version 1.5 or later.");
     }
  } else {
      alert ("This application requires the Firefox browser.");
  }
  return false;
}
