home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1998 #7 & #8 / Datatid-1998-07&08.iso / internet / thing / ThingViewer_Install_Microsoft.exe / ThingViewer10.ocx / RCDATA / 608 < prev    next >
Encoding:
Text File  |  1998-04-07  |  4.6 KB  |  205 lines

  1.  
  2. <!-- BEGIN JAVASCRIPT BROWSER DETECT PROCEDURES -->
  3. <!-- Place this section once into HTML file in the start of the BODY section -->
  4.  
  5. <script language="JavaScript">
  6. <!-- begin hiding
  7.  
  8. //** determines whether browser is netscape
  9. function IsNetscape()
  10. {
  11.     return (navigator.appName.indexOf("Netscape") >= 0) ? true : false;
  12. }
  13.  
  14. //** determines whether browser is msie
  15. //** msie 3.02 under NT has blank navigator.appName
  16. function IsMSIE()
  17. {
  18.     if (!navigator.appName)
  19.         return true;
  20.     return (navigator.appName.indexOf("Microsoft") >= 0) ? true : false;
  21. }
  22.  
  23. //** determines whether this is a TM friendly browser
  24. function IsCompatBrowser()
  25. {
  26.     return (IsNetscape() || IsMSIE()) ? true : false;
  27. }
  28.  
  29. //** determines whether this is a compatible version of the browser
  30. //** msie 3.02 under NT has blank navigator.appVersion
  31. function IsCompatVersion()
  32. {
  33.     var bRet;
  34.  
  35.     if (IsNetscape())
  36.     {
  37.         major_ver = navigator.appVersion.substring(0,1)
  38.         bRet = (major_ver >= 3) ? true : false;
  39.     }
  40.     else if (IsMSIE())
  41.     {
  42.         if (!navigator.appVersion)
  43.             return true;
  44.         major_ver = navigator.appVersion.substring(0,1)
  45.         bRet = (major_ver >= 2) ? true : false;
  46.     }
  47.     else
  48.     {
  49.         bRet = false;
  50.     }
  51.  
  52.     return bRet;
  53. }
  54.  
  55. //** determines whether this is a compatible OS
  56. //** msie 3.02 under NT has blank navigator.appVersion
  57. function IsCompatOS()
  58. {
  59.     var bRet;
  60.  
  61.     if (IsNetscape())
  62.     {
  63.         bRet = (navigator.appVersion.indexOf("WinNT") >= 0 || navigator.appVersion.indexOf("Win95") >= 0) ? true : false;
  64.     }
  65.     else if (IsMSIE())
  66.     {
  67.         if (!navigator.appVersion)
  68.             return true;
  69.         bRet = (navigator.appVersion.indexOf("Windows NT") >= 0 || navigator.appVersion.indexOf("Windows 95") >= 0 || navigator.appVersion.indexOf("Windows 98") >=0) ? true : false;
  70.  
  71.     }
  72.     else
  73.     {
  74.         bRet = false;
  75.     }
  76.     return bRet;
  77. }
  78.  
  79. //**  determines whether the current run-time environment is TM friendly
  80. function IsTMAble()
  81. {
  82.     // check for write browser, version, platform
  83.     return (IsCompatBrowser() && IsCompatVersion() && IsCompatOS()) ? true : false;
  84. }
  85.  
  86. //** determines whether the browser prefers plug-ins
  87. function UsePI()
  88. {
  89.     var ret;
  90.  
  91.     if (IsNetscape())
  92.     {
  93.         // is this a plug-in capable version?
  94.         major_ver = navigator.appVersion.substring(0,1)
  95.         if (major_ver >= 3)
  96.         {
  97.             ret = true
  98.         }
  99.         else
  100.         {
  101.             ret = false
  102.         }
  103.     }
  104.     else
  105.     {
  106.         ret = false;
  107.     }
  108.     return ret;
  109. }
  110.  
  111. //** determines whether the TM plug-in is installed
  112. function FindPI()
  113. {
  114.     var ret;
  115.  
  116.     if (IsNetscape())
  117.     {
  118.         major_ver = navigator.appVersion.substring(0,1)
  119.         if (major_ver > 2)
  120.         {
  121.             ret = (navigator.plugins["Parable ThingViewer"]) ? true : false;
  122.         }
  123.         else
  124.         {
  125.             ret = -1
  126.         }
  127.     }
  128.     else
  129.     {
  130.         ret = false;
  131.     }
  132.     return ret;
  133. }
  134.  
  135. //** determines whether the browser prefers ActiveX
  136. function UseX()
  137. {
  138.     var ret;
  139.  
  140.     if (IsMSIE())
  141.     {
  142.         ret = true;
  143.     }
  144.     else
  145.     {
  146.         ret = false;
  147.     }
  148.     return ret;
  149. }
  150.  
  151. //** use this function to output a Thing into a document
  152. function WriteTM(vURL,vImgSrc,vThingName,vSceneFile,vWidth,vHeight,vBgColor)
  153. {
  154.     // verify that this is a ThingMaker able platform
  155.     if (!IsTMAble())
  156.     {
  157.         // this platform is not supported by TM
  158.         if (vURL.length > 0)
  159.         {
  160.             document.writeln('<A HREF="' + vURL + '">')
  161.             document.writeln('<img src="' + vImgSrc + '" Alt="This is a still image of a Parable Thing">')
  162.             document.writeln('</A>')
  163.         }
  164.         else
  165.         {
  166.             document.writeln('<img src="' + vImgSrc + '" Alt="This is a still image of a Parable Thing">')
  167.         }
  168.     }
  169.     else
  170.     {
  171.         // this platform is supported by TM
  172.         if (UsePI())
  173.         {
  174.             // this is a plug-in preferred platform
  175.             document.writeln('<EMBED type= application/x-Parable-Thing');
  176.             document.writeln('SceneFile="' + vSceneFile + '"');
  177.             document.writeln('width=' + vWidth + ' height=' + vHeight + ' bgcolor=' + vBgColor);
  178.             document.writeln('pluginspage="##PLUGINSPACE##"');
  179.             document.writeln('name="' + vThingName + '">');
  180.  
  181.             if (FindPI() == false)
  182.             {
  183.                 // if we are here, the TM PI is not installed
  184. %%PAR_JS_NO_PI%%
  185.             }
  186.         }
  187.         else if (UseX())
  188.         {
  189.             // this is an activex preferred platform
  190.             document.writeln('<object id="' + vThingName + '"');
  191.             document.writeln('name="' + vThingName + '"');
  192.             document.writeln('classid="##CLASSID##"');
  193.             document.writeln('codebase="##CODEBASE##"');
  194.             document.writeln('width=' + vWidth + ' height=' + vHeight + '>');
  195.             document.writeln('<param name="SceneFile" value="' + vSceneFile + '">');
  196.             document.writeln('<param name="bgcolor" value="' + vBgColor + '">');
  197.             document.writeln('</object>');
  198.         }
  199.     }
  200. }
  201. // end hiding -->
  202. </script>
  203. <!-- END JAVASCRIPT BROWSER DETECT PROCEDURES -->
  204.  
  205.