home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / testsoft / pcanywhere / DATA1.CAB / MMC / immc.exe / mmc.exe / HTML / JSCOMMON.JS < prev    next >
Encoding:
Text File  |  1998-11-04  |  4.4 KB  |  168 lines

  1. function DoNothing()
  2. {
  3.     // Stub
  4. }
  5.  
  6. //****************************        
  7. // CLICK EVENT HELPER FUNCTION
  8. //****************************
  9.  
  10. function SymbolClickHandler(theIndex)
  11. {
  12.     // Determine what type of action to take
  13.     // based on value in gaiBtnActionType array
  14.     
  15.     switch (gaiBtnActionType[theIndex])
  16.     {
  17.         case 0:     // MMC_TASK_ACTION_ID:
  18.             ExecuteCommandID (gaszBtnActionClsid[theIndex], gaiBtnActionID[theIndex], 0);
  19.             break;
  20.  
  21.         case 1:     // MMC_TASK_ACTION_LINK:
  22.             // document.location(gaszBtnActionURL[theIndex]);
  23. //            window.navigate (gaszBtnActionURL[theIndex]);
  24.             window.event.returnValue = true;
  25.             break;
  26.  
  27.         case 2:     // MMC_TASK_ACTION_SCRIPT:
  28.             // Determine whether the language is (JSCRIPT | JAVASCRIPT) or (VBSCRIPT | VBS)
  29.             // Convert toUpperCase
  30.             var szLanguage = gaszBtnActionScriptLanguage[theIndex].toUpperCase();
  31.                         
  32.             switch (szLanguage)
  33.             {
  34.                 case "JSCRIPT":
  35.                 case "JAVASCRIPT":
  36.                     // Pass a script string to the JSObject to be evaluated and executed
  37.                     // through the eval method (this can be a semi-colon delimited complex expression)
  38.                     eval (gaszBtnActionScript[theIndex]);
  39.                     break;
  40.  
  41.                 case "VBSCRIPT":
  42.                 case "VBS":
  43.                     // Use the window.execScript method to execute a simple or complex VBScript expression
  44.                     window.execScript (gaszBtnActionScript[theIndex], szLanguage);
  45.                     break;
  46.  
  47.                 default:
  48.                     alert ("Unrecognized scripting language.");
  49.                     break;
  50.             }
  51.             break;
  52.  
  53.         default:
  54.             alert ("Unrecognized task.");
  55.             break;
  56.     }
  57. }
  58.  
  59. //***************************************************
  60. // CIC TASK NOTIFY HELPER FUNCTION (ExecuteCommandID)
  61. //***************************************************
  62.  
  63. function ExecuteCommandID(szClsid, arg, param)
  64. {
  65.    MMCCtrl.TaskNotify (szClsid, arg, param);
  66. }
  67.  
  68. //***********************************
  69. // EOT & FONT-FAMILY HELPER FUNCTIONS
  70. //***********************************
  71.  
  72. function IsUniqueEOT(szURLtoEOT)
  73. {
  74.     // Get the length of the test array
  75.     var iLength = gaszURLtoEOTUnique.length;
  76.  
  77.     // If the length is empty, return true
  78.     // since the EOT *must* be unique
  79.     if (iLength == 0) {
  80.         return true;
  81.     }
  82.     
  83.     // Compare with each existing entry in the array
  84.     for (var i = 0; i < iLength; i++) {
  85.         if (gaszURLtoEOTUnique[i] == szURLtoEOT) {
  86.             // Found a duplicate
  87.             return false;
  88.         }
  89.     }
  90.     
  91.     // If we made it this far, the EOT is unique
  92.     return true;
  93. }
  94.  
  95. function AddUniqueEOT(szEOT, szFontFamilyName)
  96. {
  97.     // Use the length of the EOT array to get the
  98.     // index for the next element to be added
  99.     var iNextIndex = gaszURLtoEOTUnique.length;
  100.     gaszURLtoEOTUnique[iNextIndex] = szEOT;
  101.     gaszFontFamilyNameUnique[iNextIndex] = szFontFamilyName;
  102. }
  103.  
  104. //***************
  105. //COLOR FUNCTIONS
  106. //***************
  107.  
  108. function SynchTooltipColorsToSystem()
  109. {
  110.     tblTooltip.style.backgroundColor = "infobackground";
  111.     tblTooltip.style.color = "infotext";
  112.     divTooltipPointer.style.color = "buttonshadow";
  113.     
  114.     // Show a one-pixel border around the divTooltip
  115.     divTooltip.style.borderWidth = 1;
  116. }
  117.  
  118. //*****************
  119. //UTILITY FUNCTIONS
  120. //*****************
  121.  
  122. function GetSmallerDimension()
  123. {
  124.     //Purpose: Returns the smaller of clientHeight or clientWidth
  125.     var cw = document.body.clientWidth;
  126.     var ch = document.body.clientHeight;
  127.     
  128.     // Get smaller of clientWidth or clientHeight
  129.     if (cw <= ch) {
  130.         return cw;
  131.     }
  132.     else {
  133.         return ch;
  134.     }
  135. }
  136.  
  137. function GetElementIndex(ElementID)
  138. {
  139.     // Purpose: Given an Element ID formatted as follows:
  140.     //         "divCaption_12"
  141.     // returns the numeric portion after the underscore character;
  142.     // returns -1 if delimiter not found.
  143.     
  144.     var iDelimitLoc = ElementID.indexOf("_");
  145.  
  146.     if (iDelimitLoc == -1) {
  147.         // Return -1 if delimiter not found (which shouldn't happen)
  148.         return iDelimitLoc;
  149.     }
  150.     else {
  151.         var theIndex = ElementID.substring(iDelimitLoc + 1, ElementID.length);
  152.         // TODO: Confirm that theIndex is numeric and does not contain illegal characters
  153.         return theIndex;
  154.     }
  155. }
  156.  
  157. function GetPixelSize(szTheSize)
  158. {
  159.     // Purpose: Given an Element.style.fontSize formatted as follows:
  160.     //          "72px"
  161.     // returns the parsed numeric portion, discarding the "px" string at the end;
  162.     // Assumes that szTheSize is properly formatted, and that the Object Model identifier
  163.     // for pixel size always appears at the end of the string.
  164.     
  165.     // TODO: Absolutely no error checking here (or in calling function)
  166.     return parseInt(szTheSize);
  167. }
  168.