function checkBrowser() {
  // convert all characters to lowercase to simplify testing
  var agt=navigator.userAgent.toLowerCase();

  // *** BROWSER VERSION ***
  // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
  var is_major = parseInt(navigator.appVersion);
  var is_minor = parseFloat(navigator.appVersion);

  // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
  // If you want to allow spoofing, take out the tests for opera and webtv.
  var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
              && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
              && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
  var is_nav4 = (is_nav && (is_major == 4));
  var is_ie   = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

  // *** PLATFORM ***
  var is_win  = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
  var is_mac  = (agt.indexOf("mac")!=-1);

  is_macie = 0;
  is_winie = 0;
  is_justie = 0;
  is_macnav = 0;
  is_macnn4 = 0;
  if (is_win && is_ie) {
    is_winie = 1;
  }
  else if (is_ie) {
    is_justie = 1;
  }
  if (is_nav4) {
    is_nn4 = 1;
  }
  if (is_mac && is_ie) {
    is_macie = 1;
  }
  if (is_mac && is_nav) {
    is_macnav = 1;
    if (is_nav4) {
      is_macnn4 = 1;
    }
  }
}