function preload() {
  if (!checkMoz()) {
    if (navigator.userAgent.indexOf("MSIE") >= 0) {
      //document.writeln('<embed type="application/x-java-applet;version=1.3.1" code="DetectPluginApplet" name="myApplet" width="1" height="1" mayscript="true">');
      document.writeln('<object id="detector" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="1" height="1">');
      document.writeln('<param name="CODE" value="DetectPluginApplet">');
      document.writeln('<param name="scriptable" value="true">');
      document.writeln('</object>');
    }
  }
}

function checkMoz() {
  for (i=0; i < navigator.plugins.length; i++) {
    plugin = navigator.plugins[i];
    for (j=0; j < plugin.length; j++) {
      if(plugin[j].type == "application/x-java-applet;version=1.4") {
        return true;
      }
    }
  }
  return false;
}

function checkJava() {
  if (checkMoz()) {
    return true;
  }
  var detect = document.detector;
  if(detect != null) {
    var version = detect.getJavaVersion();
    re = /1.[4-9]/;
    if (version.search(re) == 0) {
      return true;
    }
  }
  return false;
}
