home *** CD-ROM | disk | FTP | other *** search
/ NetGuide 2004 April / NETGUID0404N.iso / pc / featured / Windows / PhotoImpact / UPIXL_T_E.exe / Disk1 / _Graphics / Utilities.js < prev   
Encoding:
JavaScript  |  2002-06-26  |  5.0 KB  |  123 lines

  1. /*----------------------------------------------------------------*/
  2. /*                                                                */
  3. /*   Utilities.js - javascript functions for the                  */
  4. /*                  One-Click Install trigger sample page         */
  5. /*                                                                */
  6. /*   Copyright © 2001-2002 InstallShield Software Corporation     */
  7. /*                                                                */
  8. /*----------------------------------------------------------------*/
  9.  
  10. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  11. /* The following are helper  functions to check browser and   */
  12. /* OS requirements, to display error messages, get the Setup  */
  13. /* URL, and check JAVA versions                               */
  14. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  15.  
  16. function getSetupURL() {
  17.     //  To support relative paths 
  18.     var strWebPageURL = new String(window.location.href);  
  19.     var nFwd = strWebPageURL.lastIndexOf("/");      
  20.     var nBck = strWebPageURL.lastIndexOf("\\");
  21.     var nLast  = (nFwd > nBck) ? nFwd:nBck; 
  22.     var strSetupURL = strWebPageURL.substring(0, nLast);
  23.     
  24.     return strSetupURL;
  25. }
  26.  
  27. function chkJava()
  28. {
  29.     for (i=0; i < navigator.plugins.length; i++)
  30.     {
  31.     var vPlugin = navigator.plugins[i];
  32.     var vMimeType;
  33.         for (j = 0; j < vPlugin.length; j++)
  34.         {
  35.             vMimeType = vPlugin[j];
  36.             if(vMimeType)
  37.             {
  38.                 //alert(vMimeType.type);
  39.                 if(vMimeType.type == "application/x-java-vm")
  40.                 {
  41.                     //alert("You are running Netscape with Java Plugin - OK");
  42.                     return;
  43.                 }
  44.             }   
  45.         }
  46.     }
  47.     alert("You must install and enable Java to run this installation.");
  48. }
  49.                     
  50. function chkBrowser() {
  51.     var agt=navigator.userAgent.toLowerCase(); 
  52.     var is_major = parseInt(navigator.appVersion); 
  53.     var is_minor = parseFloat(navigator.appVersion);
  54.     var is_win32 = (agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1) ||
  55.     (agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1) ||
  56.     (agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1) ||
  57.     ((is_major >= 4) && (navigator.platform == "Win32")) ||
  58.     (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1);
  59.     
  60.     result = 'needBrwsr';
  61.     
  62.     if (is_win32 == false) return 'needOS';
  63.     
  64.     if (agt.indexOf("msie") != -1) 
  65.         if (is_major < 4) return 'needBrwsr';
  66.         else if (is_major >= 4) return 'ie4up';
  67.     
  68.     // Note: Opera and WebTV spoof Navigator.  
  69.     var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
  70.                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
  71.                 && (agt.indexOf('webtv')==-1)); 
  72.                 
  73.     if (is_nav == true)
  74.         if  (is_minor >= 5.00)
  75.         {
  76.                 chkJava();
  77.                 return 'nav600up';
  78.         }
  79.         if  (is_minor >= 4.06)
  80.                 return 'nav406up';
  81.  
  82.     return result;
  83. }
  84.  
  85. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  86. /* Assists developers/end users with setup difficulties */
  87. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  88. function iHelp(strObject, strMethod, nErrNum) {
  89.     if (strObject == "document")
  90.         strErrMsg = 'The Setup Player cannot be referenced from this Web page.  Check the syntax of your ' + strMethod + ' tag.';
  91.     else { // Only player errors left at this point
  92.         if (strMethod == "init") {
  93.             if (nErrNum == ERR_CONTROL_LOAD) 
  94.                 strErrMsg = 'Setup cannot run from this Web page.  Verify you have the correct browser security settings, click Refresh, and select Yes when asked to install the InstallShield Wizard.';
  95.             else {
  96.                 if (nErrNum == ERR_APPLET_PERMISSIONS)
  97.                     strErrMsg = 'Setup cannot run from this Web page.  Click Reload and select Grant on the Java Security dialog.';
  98.                 else {
  99.                     if (nErrNum == ERR_HTTP_VER)
  100.                         strErrMsg = 'Setup cannot run from this Web page.  Either the web server you are connecting to or the proxy server you are connecting through is not HTTP 1.1 compliant.';
  101.                     else
  102.                         strErrMsg = 'Unable to initialize the setup.  Error code ' + nErrNum;
  103.                 }
  104.             }
  105.         }
  106.         else 
  107.             strErrMsg = 'Unable to open the setup.  Error code ' + nErrNum;
  108.     }
  109.     
  110.     // display error on the Web page
  111.     writeText("txtMsg", strErrMsg);
  112. }
  113.  
  114. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  115. /* Used to replace static text on page             */
  116. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  117. function writeText(id, str) {
  118.     if (document.getElementById)
  119.         document.getElementById(id).innerHTML = str;
  120.     
  121.     else if (document.all)
  122.         document.all[id].innerHTML = str;
  123. }