home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / vbasic / Data / Utils / WME71SDK.exe / RCDATA / CABINET / scriptlib.js < prev    next >
Text File  |  2001-03-15  |  3KB  |  130 lines

  1.     var DHTML_ARROW_MIN = 37;
  2.     var DHTML_ARROW_MAX = 40;
  3.     var DHTML_LEFT_ARROW = 37;     // left-arrow
  4.     var DHTML_UP_ARROW = 38;     // up-arrow
  5.     var DHTML_RIGHT_ARROW = 39;  // right-arrow
  6.     var DHTML_DOWN_ARROW = 40;   // down-arrow
  7.  
  8.  
  9.  
  10. function tabClick( nTab )
  11. {
  12.     event.cancelBubble = true;
  13.     el = event.srcElement;
  14.  
  15.     for (i = 0; i < tabs.length; i++)
  16.     {
  17.         tabs[i].className = "clsTab";
  18.         newsContent[i].style.display = "none";
  19.     }
  20.     newsContent[nTab].style.display = "block";
  21.     tabs[nTab].className = "clsTabSelected";
  22. }
  23.  
  24.  
  25. function ToggleDisplay(oButton, oItems)
  26. {
  27.  
  28.     if ((oItems.style.display == "") || (oItems.style.display == "none"))    {
  29.         oItems.style.display = "block";
  30.         oButton.src = "minus.gif";
  31.     }    else {
  32.         oItems.style.display = "none";
  33.         oButton.src = "plus.gif";
  34.     }
  35.     return false;
  36. }
  37.  
  38. function leftnav_keyup()
  39. {
  40.     var iKey = window.event.keyCode;
  41.     
  42.     // BUGBUG: IE4 returns BODY instead of element with the focus. Use event object instead
  43.     //var oActive = document.activeElement;
  44.     var oActive = window.event.srcElement;
  45.     
  46.     if( DHTML_LEFT_ARROW == iKey || DHTML_RIGHT_ARROW == iKey )
  47.     {
  48.         if ('clsTocHead' == oActive.className)
  49.         {
  50.             // handle headings that expand/collapse
  51.             HandleKeyForHeading(oActive, iKey);
  52.         } 
  53.         else if( "A" == oActive.tagName )
  54.         {
  55.             MoveFocus( oActive, iKey );
  56.         }
  57.     }
  58.     
  59.     return;
  60. }
  61.  
  62.  
  63. function MoveFocus( oActive, iKey )
  64. {
  65.     iSrcIndex = oActive.sourceIndex;
  66.     
  67.     if( iKey == DHTML_RIGHT_ARROW)
  68.     {
  69.         while( oItem = document.all[ ++iSrcIndex ] )
  70.         {
  71.             if( !leftNavTable.contains( oItem ) ) return;
  72.             if( "A" == oItem.tagName )
  73.             {
  74.                 oItem.focus();
  75.                 break;
  76.             }
  77.  
  78.         }
  79.     }
  80.     else
  81.     {
  82.         while( oItem = document.all[ --iSrcIndex ] )
  83.         {
  84.             if( ( "clsTocHead" == oItem.className || "clsTocHead" == oItem.parentElement.className ) && "A" == oItem.tagName )
  85.             {
  86.                 oItem.focus();
  87.                 break;
  88.             }
  89.  
  90.         }
  91.     }
  92. }
  93.  
  94.  
  95. // Handle keyboard action on a section
  96. function HandleKeyForHeading(oActive, iKey)
  97. {
  98.     
  99.     sActiveId = oActive.id;
  100.     oItem = document.all[ sActiveId + "Items" ];
  101.     oBtn = document.all[ sActiveId + "Btn" ];
  102.  
  103.     if( ( "block" != oItem.style.display ) ^ ( DHTML_LEFT_ARROW == iKey ) )
  104.     {
  105.         ToggleDisplay( oBtn ,oItem );
  106.     }
  107.     else
  108.     {
  109.         MoveFocus( oActive, iKey );        
  110.     }
  111. }
  112.  
  113.  
  114. function handleMouseover() {
  115.     eSrc = window.event.srcElement;
  116.     eSrcTag=eSrc.tagName.toUpperCase();
  117.     if (eSrcTag=="DIV" && eSrc.className.toUpperCase()=="CLSTOCHEAD")    eSrc.style.textDecoration = "underline";
  118.     if (eSrcTag=="LABEL") eSrc.style.color="#003399";
  119. }
  120.  
  121. function handleMouseout() {
  122.     eSrc = window.event.srcElement;
  123.     eSrcTag=eSrc.tagName.toUpperCase();
  124.     if (eSrcTag=="DIV" && eSrc.className.toUpperCase()=="CLSTOCHEAD")    eSrc.style.textDecoration = "";
  125.     if (eSrcTag=="LABEL") eSrc.style.color="";
  126. }
  127.  
  128.  
  129. document.onmouseover=handleMouseover;
  130. document.onmouseout=handleMouseout;