//
//
// Copyright 2000-2001 SolidWorks Corporation.  All rights reserved.
//
// No part of these files may be reproduced or used outside of the 3D Instant Website product
// for any purpose, without the express written permission of SolidWorks Corporation.
//
//
//

//------------ Code for diabling Shift+Click operation on tree items ---------------
var nav4 = (document.layers)? true: false;
if(nav4)
{ 
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown = modifiers;
}

function modifiers(e) {
  if (nav4) {    
     if(e.modifiers & Event.SHIFT_MASK)
       return false;
     else
     {
      if(e.which == 3)//RMB
      {
       showMenu(e);
       return false;
      }
      else
       routeEvent(e);
     }   
  }
}

function checkKey(e,func)
{
 if(document.all)
 {
  if(e.shiftKey)
   return false;
 } 
 return true;
}
//-----------------------------------------------------------------------------------

// Set the initial state if no current state or length changed
if (TreeStatues == "" || TreeStatues.length != (parent.arTree.length-1)) 
  InitTree();
  
var prevIndentDisplayed = 0
var showMyDaughter = 0

// cycle through each entry in the theTree array
for (var i = 1; i < parent.arTree.length; i++) {
  var currIndent = parent.arTree[i].indent;           // get the indent level
  var expanded = TreeStatues.substring(i-1,i) // current state

  // display entry only if it meets one of three criteria
  if ((currIndent == 0 || currIndent <= prevIndentDisplayed || (showMyDaughter == 1 && (currIndent - prevIndentDisplayed == 1)))) {
  theTree += pad(currIndent)

  // Insert the appropriate GIF and HREF

  if (!(parent.arTree[i].isAssembly)) 
  {
    if(document.all)
     theTree += "&nbsp;&nbsp;&nbsp;<span id=\"i" + i + "\"><A HREF=\"javaScript:" + parent.arTree[i].URL + "\" onclick=\"return checkKey(event)\"><IMG Name=\"img_" + i + "\" SRC=\"" + parent.arTree[i].Icon + "\" WIDTH=16 HEIGHT=16 BORDER=0>"
    else
     theTree += "&nbsp;&nbsp;&nbsp;<span id=\"i" + i + "\"><A HREF=\"javaScript:" + parent.arTree[i].URL + "\"><IMG Name=\"img_" + i + "\" SRC=\"" + parent.arTree[i].Icon + "\" WIDTH=16 HEIGHT=16 BORDER=0>"
  } 
  else 
  { 
      if (TreeStatues.substring(i-1,i) == 1) 
      {
        theTree += "<A HREF=\"javaScript:history.go(0)\" onMouseOver=\"window.parent.status=\'Click to collapse\';return true;\" onClick=\"toggle(" + i + ")\">"
        if(document.all)
         theTree += "<IMG SRC=\"" + arImageList[0].src + "\" WIDTH=16 HEIGHT=16 BORDER=0></A><span id=\"i" + i + "\"><A HREF=\"JavaScript:" + parent.arTree[i].URL + "\" onclick=\"return checkKey(event)\"><IMG Name=\"img_" + i + "\" SRC=\"" + parent.arTree[i].Icon + "\" WIDTH=16 HEIGHT=16 BORDER=0>"
        else
         theTree += "<IMG SRC=\"" + arImageList[0].src + "\" WIDTH=16 HEIGHT=16 BORDER=0></A><span id=\"i" + i + "\"><A HREF=\"JavaScript:" + parent.arTree[i].URL + "\"><IMG Name=\"img_" + i + "\" SRC=\"" + parent.arTree[i].Icon + "\" WIDTH=16 HEIGHT=16 BORDER=0>"
      }
      else 
      {
	       theTree += "<A HREF=\"javaScript:history.go(0)\" onMouseOver=\"window.parent.status=\'Click to expand\';return true;\" onClick=\"toggle(" + i + ")\">"
		      theTree += "<IMG SRC=\"" + arImageList[1].src + "\" WIDTH=16 HEIGHT=16 BORDER=0></A><span id=\"i" + i + "\"><A HREF=\"JavaScript:" + parent.arTree[i].URL + "\" onclick=\"return checkKey(event)\"><IMG Name=\"img_" + i + "\" SRC=\"" + parent.arTree[i].Icon + "\" WIDTH=16 HEIGHT=16 BORDER=0>"
      }
    }
    theTree += "&nbsp;";
    theTree += parent.arTree[i].display + "</A></span>";
    // Bold if at level 0
    if (currIndent == 0) 
		    theTree = "<B>" + theTree + "</B>";
    theTree += "<BR>"
    prevIndentDisplayed = currIndent
    showMyDaughter = expanded
   
    if (parent.arTree.length > 25) 
    {
      document.write(theTree)
      theTree = ""
    }
  }
}

if(typeof theTree == "undefined" || theTree == "undefined" )
  document.write("<BR/><font color='red' face='arial' size='3'>Please refresh this frame to view tree </font><form><INPUT type='button' value='Refresh' onclick='window.history.go(0)'/></form>");
else
 document.write(theTree);
 
if (parent.currenthighlightItem != "")
	highlightIcons(searchForSubset(parent.currenthighlightItem));
