home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70olapsp3i.exe / MSOLAP / Install / data1.cab / Templ_NavBar / jscommon.js < prev    next >
Encoding:
Text File  |  2000-10-25  |  6.5 KB  |  233 lines

  1. function DoNothing()
  2. {
  3.     // Stub
  4. }
  5.  
  6. //***************
  7. //COLOR FUNCTIONS
  8. //***************
  9.  
  10. function LoadMenuColors()
  11. {
  12.     // Stub
  13.     // gszBgColorTabDisabled = 'cccccc';
  14. }
  15.  
  16.  
  17. function SynchColorsToSystem( iType )
  18. {
  19.     // TODO NOTE: Why are you doing this? Can't most of these be set directly
  20.     // from CSS style sheets? Investigate!
  21.     
  22.     // Use CSS system constants for other colors
  23.     divTitle.style.color = 'threeddarkshadow';
  24.     divTitle.style.borderColor = 'threeddarkshadow';
  25.  
  26.     anchorAbout.style.color = 'threedshadow';
  27.     divDescription.style.color = 'threeddarkshadow';
  28.             
  29.     tblTooltip.style.backgroundColor = 'infobackground';
  30.     tblTooltip.style.color = 'infotext';
  31.     divTooltipPointer.style.color = 'windowframe';
  32.     
  33.     // Show a one-pixel border around the divTooltip
  34.     divTooltip.style.borderWidth = 1;
  35.     
  36.     // Special case the taskpad type
  37.     switch( iType ) {
  38.         case CON_LISTVIEW:
  39.             divLVContainerTop.style.backgroundColor = 'window';
  40.             break;
  41.             
  42.         case CON_NOLISTVIEW:
  43.             // Stub
  44.             break;
  45.  
  46.         case CON_STATUS:
  47.             for( var i = 0; i <= giTotalFeedbackElements; i++ ) {
  48.                 document.all('divFeedbackCaptionContainer_' + i).style.borderColor = 'threeddarkshadow';
  49.                 document.all('divFeedbackCaptionLeft_' + i).style.color = 'threeddarkshadow';
  50.                 document.all('divFeedbackCaptionRight_' + i).style.color = 'threeddarkshadow';
  51.                 document.all('divFeedbackText_' + i).style.color = 'threeddarkshadow';
  52.             }
  53.             break;
  54.     }
  55. }
  56.  
  57. function SetBaseColors( iPageType )
  58. {
  59.     switch( iPageType ) {
  60.         case CON_MENUPAGE:        
  61.         case CON_LINKPAGE:        
  62.             break;
  63.  
  64.         case CON_HOMEPAGE:
  65.             tdWatermark.style.color = gszBaseColorLight;
  66.             tdBranding.style.color = gszBaseColorBranding;
  67.             break;
  68.             
  69.         case CON_TODOPAGE:
  70.         case CON_ABOUTPAGE:
  71.             tdTitle.style.color = gszBaseColorLight;
  72.             tdWatermark.style.color = gszBaseColorLight;
  73.             tdBranding.style.color = gszBaseColorBranding;
  74.             break;            
  75.     }
  76. }
  77.  
  78. //*****************
  79. //TOOLTIP FUNCTIONS
  80. //*****************
  81.  
  82. function SynchTooltipColorsToSystem()
  83. {
  84.     tblTooltip.style.backgroundColor = 'infobackground';
  85.     tblTooltip.style.color = 'infotext';
  86.     divTooltipPointer.style.color = 'buttonshadow';
  87.     
  88.     // Show a one-pixel border around the divTooltip
  89.     divTooltip.style.borderWidth = 1;
  90. }
  91.  
  92. function LoadTooltipPointer()
  93. {
  94.     divTooltipPointer.innerText = L_gszTooltipPointer_StaticText;
  95. }
  96.  
  97. //*******************************
  98. //CONTAINMENT + MENUBAR FUNCTIONS
  99. //*******************************
  100.  
  101. function DeterminePageContext( iMenuTab, iMenuTabState, iPageType )
  102. {
  103.     var iContainment = ResolveContainment();
  104.     switch( iContainment )
  105.     {
  106.         case CON_FRAMESET_1:
  107.             SynchronizeMenubar( iMenuTab, iMenuTabState );
  108.             break;
  109.             
  110.         case CON_STANDALONE:
  111.             // Ignore if page does not contain 'About' elements
  112.             switch( iPageType )
  113.             {
  114.                 case CON_HOMEPAGE:
  115.                 case CON_TODOPAGE:
  116.                 case CON_LINKPAGE:
  117.                     break;
  118.                     
  119.                 case CON_TASKPAGE:
  120.                 // Hide the About anchor, since it's not used when the page is shown
  121.                 // in stanalone mode
  122.                 divAbout.style.visibility = 'hidden';
  123.                 break;
  124.             }
  125.     }    
  126. }
  127.  
  128. function ResolveContainment()
  129. {
  130.     // Determine if running in a frameset
  131.     if( self != top ) {
  132.         // Determine if parent is top
  133.         if( self.parent == top ) {
  134.             return CON_FRAMESET_1;
  135.         }
  136.         else {
  137.             // Stub: page is more than 1 level away from Top
  138.             // TODO: For SBS/BO 5.0 design, this level will be used...
  139.         }
  140.     }
  141.     else {
  142.         // Page is running in stand-alone mode
  143.         return CON_STANDALONE;
  144.     }
  145. }
  146.  
  147. function SynchronizeMenubar( iMenuTab, iMenuTabState )
  148. {
  149.     // Brute-force resetting of all tabs to default state
  150.     for( var i = 0; i <= giTotalTabs; i++ ) {
  151.         window.parent.frames[0].document.all('mnu_' + i).parentElement.style.backgroundColor = gszBgColorTabDefault;
  152.         window.parent.frames[0].document.all('mnu_' + i).parentElement.style.color = gszColorTabDefault;
  153.         window.parent.frames[0].document.all('mnu_' + i).style.color = gszColorAnchorMenuDefault;
  154.         window.parent.frames[0].document.all('mnu_' + i).className = 'anchorMenuDefault';
  155.     }
  156.  
  157.     // Switch current tab to default or disabled state
  158.     // depending on the passed iMenuTabState state
  159.     switch( iMenuTabState )
  160.     {
  161.         case CON_TAB_ENABLED:
  162.             window.parent.frames[0].document.all('mnu_' + iMenuTab).parentElement.style.backgroundColor = gszBgColorTabSelected;
  163.             window.parent.frames[0].document.all('mnu_' + iMenuTab).parentElement.style.color = gszColorTabSelected;
  164.             window.parent.frames[0].document.all('mnu_' + iMenuTab).style.color = gszColorAnchorMenuSelected;
  165.             window.parent.frames[0].document.all('mnu_' + iMenuTab).className = 'anchorMenuSelected';    
  166.             break;
  167.  
  168.         case CON_TAB_DISABLED:
  169.             window.parent.frames[0].document.all('mnu_' + iMenuTab).parentElement.style.backgroundColor = gszBgColorTabDisabled;
  170.             window.parent.frames[0].document.all('mnu_' + iMenuTab).style.color = gszColorTabDisabled;
  171.             window.parent.frames[0].document.all('mnu_' + iMenuTab).className = 'anchorMenuSelected';
  172.             break;                        
  173.     }
  174. }
  175.  
  176. //*****************
  177. //UTILITY FUNCTIONS
  178. //*****************
  179.  
  180. function GetSmallerDimension()
  181. {
  182.     //Purpose: Returns the smaller of clientHeight or clientWidth
  183.     var cw = document.body.clientWidth;
  184.     var ch = document.body.clientHeight;
  185.     
  186.     //Get smaller of clientWidth or clientHeight
  187.     if( cw <= ch ) {
  188.         return cw;
  189.     }
  190.     else {
  191.         return ch;
  192.     }
  193. }
  194.  
  195. function GetElementIndex(ElementID)
  196. {
  197.     // Purpose: Given an Element ID formatted as follows:
  198.     //         "divCaption_12"
  199.     // returns the numeric portion after the underscore character;
  200.     // returns -1 if delimiter not found.
  201.     
  202.     var iDelimitLoc = ElementID.indexOf( '_' );
  203.  
  204.     if( iDelimitLoc == -1 ) {
  205.         // Return -1 if delimiter not found (which shouldn't happen)
  206.         return iDelimitLoc;
  207.     }
  208.     else {
  209.         var theIndex = ElementID.substring( iDelimitLoc + 1, ElementID.length );
  210.         // TODO: Confirm that theIndex is numeric and does not contain illegal characters
  211.         return theIndex;
  212.     }
  213. }
  214.  
  215. function GetPixelSize(szTheSize)
  216. {
  217.     // Purpose: Given an Element.style.fontSize formatted as follows:
  218.     //          "72px"
  219.     // returns the parsed numeric portion, discarding the "px" string at the end;
  220.     // Assumes that szTheSize is properly formatted, and that the Object Model identifier
  221.     // for pixel size always appears at the end of the string.
  222.     
  223.     // TODO: Absolutely no error checking here (or in calling function)
  224.     return parseInt(szTheSize);
  225. }
  226.  
  227. function Quoted(szTheString)
  228. {
  229.     // Adds quotation marks ("") around the passed string;
  230.     // (e.g. if szTheString = Hello, quoted returns "Hello")
  231.     return '\"' + szTheString + '\"';
  232. }
  233.