home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70sp3i.exe / X86 / BINN / res / 1033 / sqlmmc.rll / HTML / JSREP01.JS < prev    next >
Encoding:
JavaScript  |  1999-04-12  |  2.6 KB  |  125 lines

  1. //***********************
  2. // GLOBAL COLOR VARIABLES
  3. //***********************
  4.  
  5. var gszBgColorMenu = 'buttonface';
  6. var gszBgColorBand = 'highlight';
  7.  
  8. var gszColorTabDefault = 'buttontext';
  9. var gszBgColorTabDefault = 'buttonface';
  10.  
  11. var gszColorTabSelected = 'highlighttext';
  12. var gszBgColorTabSelected = 'highlight';
  13.  
  14. var gszColorTabDisabled = 'inactivecaptiontext';
  15. var gszBgColorTabDisabled = 'inactivecaption';
  16.  
  17. var gszColorAnchorMenuDefault = 'buttontext';
  18. var gszColorAnchorMenuSelected = 'highlighttext';
  19.  
  20.  
  21. //**********************************
  22. // FIXED CONSTANTS (Not localizable)
  23. //**********************************
  24.  
  25. var giRepTotalTabs = 3;                // zero-based array
  26.  
  27.  
  28. //*****************
  29. //UTILITY FUNCTIONS
  30. //*****************
  31.  
  32. function GetElementIndex(ElementID)
  33. {
  34.     // Purpose: Given an Element ID formatted as follows:
  35.     //         "divCaption_12"
  36.     // returns the numeric portion after the underscore character;
  37.     // returns -1 if delimiter not found.
  38.     
  39.     var iDelimitLoc = ElementID.indexOf( '_' );
  40.  
  41.     if( iDelimitLoc == -1 ) {
  42.         // Return -1 if delimiter not found (which shouldn't happen)
  43.         return iDelimitLoc;
  44.     }
  45.     else {
  46.         var theIndex = ElementID.substring( iDelimitLoc + 1, ElementID.length );
  47.         // TODO: Confirm that theIndex is numeric and does not contain illegal characters
  48.         return theIndex;
  49.     }
  50. }
  51.  
  52.  
  53. function ClickMenu()    // top taskbar click
  54. {
  55.     var el;
  56.  
  57.     el = window.event.srcElement
  58.     OpenView(el)
  59.     SetView(GetElementIndex(el.id))
  60.  
  61. }
  62.  
  63.  
  64. function InitialView()    // main
  65. {
  66.   message.style.display = "";
  67.  
  68.     switch(GetView())
  69.     {
  70.         case '-1':
  71.             SetView(0)
  72.             OpenView(document.all.mnu_0)
  73.             break;
  74.         case '0':
  75.             OpenView(document.all.mnu_0)
  76.             break;
  77.         case '1':
  78.             OpenView(document.all.mnu_1)
  79.             break;
  80.         case '2':
  81.             OpenView(document.all.mnu_2)
  82.             break;
  83.     }
  84.  
  85. }
  86.  
  87.  
  88. function GetView()    // InitialView - main
  89. {
  90.     var cookie = "";
  91.     var point;    
  92.  
  93.     cookie = document.cookie;
  94.     if(cookie == "")
  95.         return '-1';
  96.     
  97.     point = cookie.indexOf("view=");
  98.     if(point == -1)
  99.         return '-1';
  100.     point += 5
  101.     cookie = cookie.slice(point);
  102.     point = cookie.indexOf(";");
  103.     if(point == -1)
  104.         return cookie;
  105.     //if (!objSQLServer.issysadmin)
  106.     //    return '0';    // if not the system admin show the first menu
  107.     return cookie.slice(0, point);
  108. }
  109.  
  110.  
  111. function SetView(view_num)    // top taskbar click and InitialView - main
  112. {
  113.     var path
  114.     var slash
  115.     var cookie
  116.     path = window.location.pathname
  117.     path = path.slice(1)
  118.     slash = path.lastIndexOf("\\")
  119.     path = path.slice(0, slash)    
  120.  
  121.     cookie = "view=" + view_num + ";" 
  122.     document.cookie = cookie
  123.     document.cookie = "expires=01 Jan 3000 00:00:00 GMT;"
  124. }
  125.