var cxURL = 'http://www.celtx.com/beta/celtx.xpi';
var cxVER = '0.4.0.0';
var cxAPP = '/greyfirst.ca/celtx';


function download () {
  if (! isFirefox()) {
    alert("The celtx beta requires Mozilla Firefox.");
    return false;
  }
  
//  if (! isVersionOK()) {
//    alert("The version you are attempting to install is older than allowed.");
//    return false;
//  }
  
  if (!InstallTrigger.updateEnabled()) return false; 

  InstallTrigger.startSoftwareUpdate(cxURL); 
}


function isFirefox () {
  return window.navigator &&
         window.navigator.userAgent &&
         window.navigator.userAgent.search(/Firefox/) != -1;
}


function isVersionOK () {
  var it = InstallTrigger;
  var rv = it.compareVersion(cxAPP, cxVER);
  return rv == it.NOT_FOUND || rv <= it.REL_DIFF;
}
