// For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/ (credit to @jdalton for minif)
/*@cc_on'abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video'.replace(/\w+/g,function(n){document.createElement(n)})@*/

function areweIE() {
   // this is hackish - but user agent string or asking the browser
   //  what it is isn't very reliable, so we look at attach method
   var foo = document.createElement('button');
   if (foo.addEventListener) {
      return false;
      } else {
      return true;
      }
   }
// mathml
function installMathPlayer() {
   var p = document.createElement('p');
   var t = document.createTextNode('This page uses MathML. To properly view it, please install the ');
   p.appendChild(t);
   var a = document.createElement('a');
   a.setAttribute('href','http://www.dessci.com/getmp');
   var u = document.createTextNode('MathPlayer');
   a.appendChild(u);
   p.appendChild(a);
   var v = document.createTextNode(' browser plugin.');
   p.appendChild(v);
   messageDiv(p);
   }
   
function updateMathPlayer() {
   var p = document.createElement('p');
   var t = document.createTextNode('Your version of MathPlayer is outdated, please update your ');
   p.appendChild(t);
   var a = document.createElement('a');
   a.setAttribute('href','http://www.dessci.com/getmp');
   var u = document.createTextNode('MathPlayer');
   a.appendChild(u);
   p.appendChild(a);
   var v = document.createTextNode(' browser plugin.');
   p.appendChild(v);
   messageDiv(p);
   }
   
function ieMathMLCheck() {
   if (isMPInstalled()) {
      // check version
      var start = navigator.appVersion.indexOf("MathPlayer");
      if (start != -1) {
         var bar = 'bar';
         } else {
         updateMathPlayer();
         }
      } else {
      installMathPlayer();
      }
   }

// returns True if MathPlayer is installed
function isMPInstalled() {
   try {
      var oMP = new ActiveXObject("MathPlayer.Factory.1");
      return true;
      }
   catch(e) {
      return false;
      }
   }
   
function mathmlIE() {
   var i = document.getElementsByTagName('math').length;
   if (i > 0) {
      ieMathMLCheck();
      }
   }
   
function checkForIE() {
   if (areweIE()) {
      mathmlIE();
      }
   }
   
womAdd('checkForIE()');
womOn();