
function showInstall(ax, jvok) {
	var ua = navigator.userAgent.toLowerCase(); 
	var da = (document.all) ? 1 : 0;
	var mac = (ua.indexOf("mac") != -1); 
	var unix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1 || ua.indexOf('linux') != -1);
	//var subdir = pidir();
	var cabver = cbver();
	var licenseText = "By clicking Install you agree to the " + 
	                   "<a href='http://www.fileopen.com/FileOpenClientLicense.pdf'>" + 
	                   "FileOpen Systems Client End User License Agreement. </a>"
   var tgval  = tg();
   var ckval  = ck();
 	//alert("showInstall...");
    if (!unix && (jvok > 0)) {
      var newTxt = "<p align='justify'>" + getText(1) + "</p>" +
                   "<div align='center'>" +
                      "<applet code='downloadJApplet.class' archive='http://plugin.fileopen.com/current/FileOpenInstaller.jar' MAYSCRIPT='MAYSCRIPT' WIDTH=320 HEIGHT=260>" +
					   "<PARAM NAME='IMAGE' VALUE='images/fologosmall.gif'>" +
					   "<PARAM NAME='INSTALLER_BASE' VALUE='http://plugin.fileopen.com/current'>" +
					   "<PARAM NAME='INSTALLER_FILE' VALUE='FileOpenInstaller.exe'>" +
					   "<PARAM NAME='BUILD' VALUE='879'>" +
					   "<PARAM NAME='LINUX_BUILD' VALUE='802'>" +
					   "<PARAM NAME='MAC_OS_BUILD' VALUE='876'>" +
					   "<PARAM NAME='TARGET' VALUE='http://plugin.fileopen.com/installcomplete/installcomplete.pdf'>" +
					   "<PARAM NAME='INSTALL_FAIL_TARGET' VALUE='http://plugin.fileopen.com/plugininstallpage.html'>" +
					   "<PARAM NAME='LIMITED_ACCESS_TARGET' VALUE='http://plugin.fileopen.com/plugininstallpage.html'>" +
					   "<PARAM NAME='CKURL' VALUE='" + ckval + "'>" +
					   "<PARAM NAME='LANG' VALUE='en_us'>" +
					   "<PARAM NAME='MSI' VALUE='true'>" +
					   "<PARAM NAME='TEST_PDF' VALUE='false'>" +
					   "<PARAM NAME='OS' VALUE='Microsoft Windows'>" +
                           "<em>Automated installation cannot proceed as Sun Java plugin is disabled or not installed.<br>" +
						   "Proceed to manual installation of plugin here: <a href='http://plugin.fileopen.com/all.html'>http://plugin.fileopen.com/all.html</a></em>" +
                      "</applet>" +
                   "</div>" +
    	             "<p align='justify'>" + licenseText + "</p" +
    	             "<p align='justify'>" + getText(8) + "</p>" +
    	             "<p align='center'>" + installers() + "</p>";
            
   } else if (da && !mac && ax) {
      var newTxt = "<p align='justify'>" + getText(1) + "</p>" +
                   "<div align='center'>" +
                       "<OBJECT id='FoInstaller' title='FileOpen Installer' tabIndex='1' border='1'" +
                          "height='150' width='300'" +
                          "standby='Loading FileOpen Installer ActiveX...'"+
                          "codeBase='/current/FileOpen.CAB#Version=" + cabver + "'" +
                          "classid='CLSID:CE8267C2-D41A-4A50-A69D-F32B5C289F14' standby='Loading ...' VIEWASTEXT>" +
                          "<param name='TargetURL' value='" + tgval + "'>" +
                          "<param name='CookieURL' value='" + ckval + "'>" +
                          "<PARAM NAME='_cx' VALUE='7382'>" +
                          "<PARAM NAME='_cy' VALUE='3500'>" +
			  					  "<PARAM NAME='ActiveXVersion' value='" + cabver + "'>" +
			  					  "<PARAM NAME='PluginVersion' value='879'>" +
                    "<PARAM NAME='MSIInstallation' value='true'>" +
//                    "Loading of activeX objects is not suported by your browser or is turned off by your system administrator.<br>" +
//                    "Please click <a href='plugininstallpage.html'>here</a> to download the appropriate installer." +
                       "</OBJECT>" +
                   "</div>" +
    	             "<p align='justify'>" + licenseText + "</p" +
    	             "<p align='justify'>" + getText(2) + 
    	             javaLink(jvok) + getText(3) + "</a>.</p>";

   } else if (mac) {
      var newTxt = "<p align='justify'>" + getText(4) + "</p>" +
                   "<p align='center'>OSX: <a href='/current/FileOpenInstaller.dmg'><img alt='FileOpen Installer' src='images/plugin.jpg'><br>" + getText(5) + "</a></p>" + 
                   "<p align='center'>OS9.2: <a href='/current/FileOpenInstaller.sit'><img alt='FileOpen Installer' src='images/plugin.jpg'><br>" + getText(5) + "</a></p>" + 
                   "<p align='justify'>" + getText(6) + "</p>" +
                   "<p align='center'><a href='" + tgval + "' target='_blank'>" + getText(7) + "</a></p>";
      
   } else if (unix) {
      var newTxt = "<p align='justify'>" + getText(4) + "</p>" +
                   "<p align='center'><a href='/test/current/FileOpenInstaller.tar.gz'> <img alt='FileOpen' src='images/plugin.jpg'><br>" + getText(5) + "</a></p>" + 
                   "<p align='justify'>" + getText(6) + "</p>" +
                   "<p align='center'><a href='" + tgval + "' target='_blank'>" + getText(7) + "</a></p>";
      
   } else {
      var newTxt = "<p align='justify'>" + getText(4) + "</p>" +
                   "<p align='center'><a href='/current/nonsilent/FileOpenInstaller.exe'><img alt='FileOpen Installer' src='images/plugin.jpg'><br>" + getText(5) + "</a></p>" + 
                   "<p align='justify'>" + getText(6) + "</p>" +
                   "<p align='center'><a href='" + tgval + "' target='_blank'>" + getText(7) + "</a></p>";
   }
   var elem = document.getElementById("installer");
   elem.innerHTML = newTxt;
   
   var lang = (document.all) ? navigator.browserLanguage : navigator.language;
   //alert(lang);
   var ulang = (document.all) ? navigator.userLanguage : navigator.language;
   var slang = (document.all) ? navigator.systemLanguage : navigator.language;
   
   var isocode = iso639code();
   //alert( isocode );
   /*
   */
   var elem = document.getElementById("p_info");
   //elem.innerHTML = "lang: " + lang + "; iso639: " + isocode;
   elem.innerHTML = "cabver: " + cabver + "; " + 
                    "<br>tgval: " + tgval + 
                    "<br>ckval: " + ckval +  
                    "<br>jvok: " + jvok +  
                    "<br>bl: " + lang + "; ul: " + ulang + "; sl: " + slang + "; iso639: " + isocode;
   
}

function win() { return ck() + pidir() + 'FileOpenInstaller.exe'; }
function mac9() { return ck() + pidir() + 'FileOpenInstaller.879'; }
function mac10() { return ck() + pidir() + 'FileOpenInstaller.dmg'; }

function installers(){
 //return '<a href=' + win() +'>Windows</a> | <a href='+ mac9() + '>Mac OS 9</a> | <a href='+ mac10() + '> Mac OS X </a>';
 return "<a href='http://plugin.fileopen.com/plugininstallpage.html'> Click here for more installation options </a>";

}

function javaLink(jvok){
if(jvok==0)
  return "<a href='javascript:showInstall(0, 0)'>";
else 
  return "<a href='http://plugin.fileopen.com/plugininstallpage.html'>";
}
function iso639code() {
   var lang = (document.all) ? navigator.browserLanguage : navigator.language;
   var code = lang.substring(0,2)
   return code;
}
function getText(sid) {
   //var lang = (document.all) ? navigator.browserLanguage : navigator.language;
   //switch (lang.substring(0,2)) {
   switch (iso639code()) {
      case 'en':
         switch (sid) {
            case 1:
               return "Please use the FileOpen installer below to ensure that the FileOpen plug-in is installed correctly. The installer may need to alter your Acrobat settings to allow non-Adobe plug-ins to be installed and to close Acrobat if it is running. You must agree to allow these changes for the install process to complete successfully.";
               break;
            case 2:
               return "If you choose not to allow the signed ActiveX control to install and run or if the download dialog did not appear and the installer is not visible above, ";
               break;
            case 3:
               return "please click here";
               break;
            case 4:
               return "Please use the FileOpen link below to access the plug-in installation program. We recommend that you select 'open' in the file download dialog to run the installer immediately. If you opt to save the program on your computer you will need to run it manually.";
               break;
            case 5:
               return "Click here to download the installer.";
               break;
            case 6:
               return "The installer may need to alter your Acrobat settings to allow non-Adobe plug-ins to be installed and to close Acrobat if it is running. You must agree to allow these changes for the install process to complete successfully.";
               break;
            case 7:
               return "Click here to test the installation.";
               break;
            case 8:
               return "If you choose not to allow the signed Java applet to install and run or if the download dialog did not appear and the installer is not visible above, please click the link below:";
               break;
            default:
               return "";
         }
         break;
      case 'fr':
         switch (sid) {
            case 1:
               return "Veuillez utiliser le lien ci-dessous pour &#0234;tre sur d'installer correctement le plugin de FileOpen. Ce programme peut avoir besoin de modifier votre configuration d'Acrobat pour permettre l'installation de plugin autre que ceux d'Acrobat et de fermer Acrobat si il est en service. Vous devez accepter ces modifications pour que l'installation puisse se faire avec succ&#0232;s.";
               break;
            case 2:
               return "Si vous choisissez de ne pas autoriser l'installation et l'ex&#0233;cution des contrôles ActiveX sign&#0233;s ou si le dialogue de t&#0233;l&#0233;chargement ne s'affiche pas ou si l'image du programme d'installation n'est pas visible ci-dessus, ";
               break;
            case 3:
               return "veuillez cliquer ici";
               break;
            case 4:
               return "Veuillez utiliser le lien ci-dessous pour avoir acc&#0232;s au programme d'installation. Afin d'ex&#0233;cuter imm&#0233;diatement le programme nous vous recommandons de choisir 'ouvrir' dans le dialogue de t&#0233;l&#0233;chargement. Si vous choisissez 'sauvegarder' vous devrez l'ex&#0233;cuter manuellement.";
               break;
            case 5:
               return "Cliquer ici pour t&#0233;l&#0233;charger le programme d'installation.";
               break;
            case 6:
               return "Ce programme peut avoir besoin de modifier votre configuration d'Acrobat pour permettre l'installation de plugin autre que ceux d'Acrobat et de fermer Acrobat si il est en service. Vous devez accepter ces modifications pour que l'installation puisse se faire avec succ&#0232;s.";
               break;
            case 7:
               return "Cliquer ici pour tester que l'installation a r&#0233;ussi.";
               break;
            case 8:
               return "Si vous choisissez de ne pas autoriser l'installation et l'ex&#0233;cution des contrôles Java sign&#0233;s ou si le dialogue de t&#0233;l&#0233;chargement ne s'affiche pas ou si l'image du programme d'installation n'est pas visible ci-dessus, ";
               break;
            default:
               return "";
         }
         break;
      case 'de':
         switch (sid) {
            case 1:
               return "Sie verfügen nicht über die notwendigen Rechte, um das Acrobat bzw. Reader Plug-in zu installieren. Bitte setzen Sie sich mit Ihrem Systemadministrator in Verbindung.";
               break;
            case 2:
               return "Wenn Sie nicht mit Hilfe des ActiveX Control installieren möchten, der Dialog zum Download oder der Installer nicht erscheint, ";
               break;
            case 3:
               return "dann bitte hier klicken";
               break;
            case 4:
               return "Bitte verwenden Sie den Link auf FileOpen f&#0252;r den Zugriff auf das Installationsprogramm. Wir empfehlen, dass Sie den Installer direkt durch Auswahl von &#0034;Öffnen&#0034; im Dialog Download starten. Wenn Sie das Programm downloaden und auf Ihrem Computer speichern, dann können Sie den Installer auch manuell starten.";
               break;
            case 5:
               return "Zum Download des Installers bitte hier klicken.";
               break;
            case 6:
               return "Der Installer muss eventuell Acrobat oder Reader schliessen und die Grundeinstellungen ändern, damit auch Nicht-Adobe Plug-ins installiert werden können. Sie m&#0252;ssen diese Änderungen gestatten, um die Installation erfolgreich abzuschliessen.";
               break;
            case 7:
               return "Zum Test der Installation bitte hier klicken.";
               break;
            default:
               return "";
         }
         break;
      case 'it':
         switch (sid) {
            case 1:
               return "Prego utilizzare il programma di installazione di FileOpen sottostante per permettere al plug-in di installarsi correttamente. L’installazione potrebbe richiedere una modifica alle impostazioni del vostro Acrobat per permettere ai plug-in non-Adobe di essere installati e potrebbe chiudere Acrobat se esso &#0232; in esecuzione. Dovete accettare queste modifiche per far si che il processo di installazione sia completato con successo.";
               break;
            case 2:
               return "Se decidete di non permettere l’installazione e l’esecuzione del controllo ActiveX firmato oppure se la finestra di download non appare e il programma di installazione non &#0232; visibile nel box sottostante, ";
               break;
            case 3:
               return "prego ciccate qui";
               break;
            case 4:
               return "Prego utilizzare il link FileOpen sottostante per accedere al programma di installazione del plug-in. Vi raccomandiamo di selezionare ‘apri’ nella finestra di download per avviare subito l’installazione. Nel caso decidiate di salvare il programma sul vostro computer, dovrete avviarla manualmente.";
               break;
            case 5:
               return "Cliccate qui per scaricare il programma di installazione.";
               break;
            case 6:
               return "L’installazione potrebbe richiedere una modifica alle impostazioni del vostro Acrobat per permettere ai plug-in non-Adobe di essere installati e potrebbe chiudere Acrobat se esso &#0232; in esecuzione. Dovete accettare queste modifiche per far si che il processo di installazione sia completato con successo.";
               break;
            case 7:
               return "Cliccate qui per verificare l’installazione.";
               break;
            default:
               return "";
         }
         break;
      default:
         switch (sid) {
            case 1:
               return "Please use the FileOpen installer below to ensure that the FileOpen plug-in is installed correctly. The installer may need to alter your Acrobat settings to allow non-Adobe plug-ins to be installed and to close Acrobat if it is running. You must agree to allow these changes for the install process to complete successfully.";
               break;
            case 2:
               return "If you choose not to allow the signed ActiveX control to install and run or if the download dialog did not appear and the installer is not visible above, ";
               break;
            case 3:
               return "please click here";
               break;
            case 4:
               return "Please use the FileOpen link below to access the plug-in installation program. We recommend that you select 'open' in the file download dialog to run the installer immediately. If you opt to save the program on your computer you will need to run it manually.";
               break;
            case 5:
               return "Click here to download the installer.";
               break;
            case 6:
               return "The installer may need to alter your Acrobat settings to allow non-Adobe plug-ins to be installed and to close Acrobat if it is running. You must agree to allow these changes for the install process to complete successfully.";
               break;
            case 7:
               return "Click here to test the installation.";
               break;
            default:
               return "";
         }
         break;
   }
   
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}


function setCookie(name, value) {
try {
	  var argv = setCookie.arguments;
	  var argc = setCookie.arguments.length;
	  var expires = (argc > 2) ? argv[2] : null;
	  var path = (argc > 3) ? argv[3] : null;
	  var domain = (argc > 4) ? argv[4] : null;
	  var secure = (argc > 5) ? argv[5] : false;
	  var cookie_str = name + "=" + escape (value) +
		 ((expires == null) ? "" : ("; expires=" + expires)) +
		 ((path == null) ? "" : ("; path=" + escape(path))) +
		 ((domain == null) ? "" : ("; domain=" + escape(domain))) +
		 ((secure == true) ? "; secure" : "");
	  document.cookie = cookie_str;
	  //alert(GetCookie(name));
	  //return ;
  }catch(e){
  	alert("An exception occurred in the script. Error name: " + e.name
  + ". Error message: " + e.message);
  }
}

