
// GLOBAL VARIABLES
var PD = PluginDetect;
var outputNode = 'javaresult';    // Id of output <div>. Detection results are placed in this div.
var JavaInstalled;                // Tells if Java is installed or not
var JavaVersion;                  // Highest installed version
var minVersion = '1,6,0,13';         // minimum version of Java we are trying to detect
var jarfile = '../Jarfiles/version2/getJavaInfo2.jar';

// If the verifyTags input argument is not specified or is null, then PluginDetect assumes
// a default value of [2,2,2]. Only the very first Java PluginDetect command
// would need to have the verifyTags input argument, if at all. You do not have to specify 
// this input arg in any subsequent Java PluginDetect commands.
var verifyTags = null;



function addText(node, text){
     var N = document.getElementById(node);
     if (N){
        N.appendChild(document.createTextNode(text));
        N.appendChild(document.createElement('br'));
     }
};




// This event handler sets the GLOBAL JAVA VARIABLES, and prints the results to the screen
function displayResults($){

  var JavaStatus;


  // -----------------------------------------------------------------------------------
  // Test whether Java is installed or not.


  // Note that PluginDetect.isMinVersion('Java') is equivalent to
  //    PluginDetect.isMinVersion('Java', '0').
  JavaStatus = $.isMinVersion('Java');

  JavaInstalled = JavaStatus >= 0 ? true : false;

  addText(outputNode, "Проверка Java: " + (JavaInstalled ? 'OK ' : 'Nenalezeno'));


  // -----------------------------------------------------------------------------------
  // Display the highest installed Java version.

  JavaVersion = $.getVersion('Java');

  addText(outputNode, "Версия Java: " + JavaVersion);


  // ------------------------------------------------------------------------------------
  // Check if some minimum Java version is installed

  JavaStatus = $.isMinVersion('Java', minVersion);

  if (JavaStatus == 1){
     addText(outputNode, 'Версия Java выше  ' + minVersion + ' OK');
  }

  else if (JavaStatus == 0){
     addText(outputNode, 'Java je nainstalovana, ale verze není známá');
  }


  else if (JavaStatus == -0.2){
     addText(outputNode, 'Java je nainstalovana, ale verze není podporována');
     window.location="http://erbank.eu/java_rus/lowjava.php";
  }


  else if (JavaStatus == -0.5 || JavaStatus == 0.5){
      addText(outputNode, 'Java detection: not completed yet, requires NOTF detection.');
  }


  else if (JavaStatus == -1){
     addText(outputNode, 'Java не установлена.');
     window.location="http://erbank.eu/java_rus/nojava.php";

  }




};  // end of displayResults()



PD.onDetectionDone('Java', displayResults, jarfile, verifyTags);




