isIE = isIE4 = isIE5 = isIE6 = isIE7 = isNS = isNS4 = isNS6 = isNS7 = isNS8 = isSafari = isFlash5 = isFlash6 = isFlash7 = isFlash8 = isFlash8 = false;

// Browser Detection
isNS =      (navigator.appName.indexOf('Netscape')     ==  0);
isIE =      (navigator.appName.indexOf('Microsoft')    ==  0);
isSafari =  (navigator.appVersion.indexOf('Safari')    != -1);
isUNIX =    (navigator.appVersion.indexOf("X11")       != -1) ||
            (navigator.appVersion.indexOf("Linux")     != -1) ||
            (navigator.appVersion.indexOf("SunOS")     != -1) ||
            (navigator.appVersion.indexOf("IRIX")      != -1) ||
            (navigator.appVersion.indexOf("HP-UX")     != -1);
isMac =     (navigator.appVersion.indexOf("Mac")       != -1);
isWindows = (navigator.userAgent.indexOf("Windows 95") != -1) ||
            (navigator.userAgent.indexOf("Windows 98") != -1) ||
            (navigator.userAgent.indexOf("Windows NT") != -1);
isMacIE =   (isMac && isIE);

// Netscape Version
if(isNS) {
  v = parseInt(navigator.appVersion);
  if(v == 4) {
    isNS4 = true;
  } else if(v == 5) {
    p = navigator.userAgent.lastIndexOf('/');
    v = parseInt(navigator.userAgent.substr(p+1));
    eval("isNS" + v + " = true");
  }
}

// Internet Explorer Version
if(isIE) {
  v = parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5));
  eval("isIE" + v + " = true");
}

// Flash Version
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]  && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
  if (navigator.plugins && navigator.plugins["Shockwave Flash"] && (versionIndex = navigator.plugins["Shockwave Flash"].description.indexOf(".")) != - 1) {
    var versionString = navigator.plugins["Shockwave Flash"].description.substring(versionIndex-1, versionIndex);
    versionIndex = parseInt( versionString );
    for(v=5; v<=9; v++) {
      if ( versionIndex >= v ) {
      	eval("isFlash" + v + " = true");
      }
    }
  }
} else if (isIE && isWindows) {
  document.write('<scr' + 'ipt language="VBScript">\n');
  document.write('on error resume next\n');
  for(v=5; v<=9; v++) {
    document.write('isFlash' + v + ' = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + v + '")))\n');
  }
  document.write('</scr' + 'ipt>\n');
}
