home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Library / helpUtilities.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  1.8 KB  |  95 lines

  1. !!Script
  2.  
  3. var gRight = false; // Show help window on right side of the screen
  4.  
  5. // Note: Since this code is shared by many other scripts
  6. // we must use setGlobal and getGlobal for most global 
  7. // variables.
  8.  
  9. function DoCommand()
  10. {    
  11.     if (!Application.IEInstalled())
  12.     {
  13.         alert("This script requires IE be installed before it can run.");
  14.         return;
  15.     }
  16.     
  17.     try 
  18.     {
  19.         if (gTitle == undefined)
  20.         {
  21.             return;
  22.         }
  23.         if (gPath == undefined)
  24.         {
  25.             return;
  26.         }
  27.     }
  28.     catch(e)
  29.     {
  30.         alert("This script must be included in another script that defines gTitle and gPath");
  31.         return;
  32.     }
  33.     
  34.     var size = Application.getScreenSize();
  35.     var windowRect = Application.getWindowRect();
  36.     var count = getGlobal("gHTMLPopupCount", 0);
  37.     if (count == 0)
  38.     {
  39.         var windowRectRestored = Application.getWindowRect();
  40.         Host.setGlobal("gHTMLPopupOldRect",windowRectRestored);
  41.     }
  42.     setGlobal("gHTMLPopupCount", count + 1);
  43.     
  44.     var rect = newRect();
  45.     
  46.     if (gRight)  // Show help window on right
  47.     {
  48.         rect.top = 0;
  49.         rect.bottom = size.y;
  50.         rect.left = size.x - size.x/3;
  51.         rect.right = size.x;
  52.         
  53.         windowRect.left = 0;
  54.         windowRect.right = rect.left;
  55.         windowRect.top = 0;
  56.         windowRect.bottom = size.y;
  57.     }
  58.     else // Show help window on left
  59.     {
  60.         rect.top = 0;
  61.         rect.bottom = size.y;
  62.         rect.left = 0;
  63.         rect.right = size.x/3;
  64.         
  65.         windowRect.left = rect.right;
  66.         windowRect.right = size.x;
  67.         windowRect.top = 0;
  68.         windowRect.bottom = size.y;
  69.     }
  70.     
  71.     Application.setWindowRect(windowRect);
  72.     
  73.     showHtmlPopup(gPath, gTitle, rect, getScriptPath());
  74. }
  75.  
  76. function OnNotify(documentDOM)
  77. {
  78.     var count = getGlobal("gHTMLPopupCount", 0);
  79.     if (count == 1)
  80.     {
  81.         var oldRect = getGlobal("gHTMLPopupOldRect");
  82.         Application.setWindowRect(oldRect);
  83.         count = 0
  84.     }
  85.     else if (count > 1)
  86.     {
  87.         count -= 1;
  88.     }
  89.     
  90.     setGlobal("gHTMLPopupCount", count);
  91. }
  92.  
  93. !!/Script
  94.  
  95.