// popup window
function pop_win( name, url, w, h ) {
  var win = null;
  win = window.open( url, name, 'resizable=yes,scrollbars=yes,width=' + w + ',height=' + h);
  if (win != null) {
    if (win.opener == null) {
      win.opener = self;
    }
    win.name = name;
    win.focus();
  }
}

// popup window
function pop_win2( name, caption, common, imgurl, w, h ) {
  var win = null;
  win = window.open( "", name, 'resizable=yes,scrollbars=yes,width=' + w + ',height=' + h);
  if (win != null) {
    if (win.opener == null) {
      win.opener = self;
    }
    popwin_style_normal(win.document, caption, common, imgurl );
    win.name = name;
    win.focus();
  }
}


function popwin_style_normal( doc, caption, common, imgurl ) {
  with (doc) {
    write('<html><head><title>Plant Anatomy 2001 ' + caption + '</title></head>');
    write('<body bgcolor="#ffffff">');
    write('<table width="100%" border="0" align="center" cellspacing="0" cellpadding="0">');
    write('  <tr>');
    write('    <td>');
    write('      <div align="center"><img src="../../pa_images/logo_sm.gif"></div>');
    write('    </td>');
    write('  </tr>');
    write('  <tr bgcolor="#CCCC99" valign="middle" align="center">');
    write('    <td height="25">');
    write('      <p align="center"><font size="2" color="#006600" face="Arial, Helvetica, sans-serif"><i>' + caption + '&nbsp;&nbsp;</i>|&nbsp;&nbsp;' + common + '</font></p>');
    write('    </td>');
    write('  </tr>');
    write('  <tr>');
    write('    <td>');
    write('      <div align="center"><img src="' + imgurl + '"></div>');
    write('    </td>');
    write('  </tr>');
    write('  <tr bgcolor="#CCCC99">');
    write('    <td height="25">');
    write('      <div align="center"><a href="javascript:window.close()"><img src="../../pa_images/close.gif" width="40" height="20" border="0"></a></div>');
    write('    </td>');
    write('  </tr>');
    write('  <tr>');
    write('    <td height="25">');
    write('      <div align="center">&nbsp;</div>');
    write('    </td>');
    write('  </tr>');
    write('  <tr>');
    write('    <td>');
    write('      <div align="center">&nbsp;</div>');
    write('    </td>');
    write('  </tr>');
    write('</table>');
    write('</body>');
    write('</html>');
    close();
  }
}



// -------------------------------
//
// new nav bar

function _header() {
  var node = getCurrentNode();
  var path = getPath( node.url );
  with (document) {
    write('<table width="780" border="0" cellspacing="0" cellpadding="0">');
    write('<tr><td><a href="' + path + 'index.html" target=_top>');
    write('<img src="' + path + 'pa_images/logo_tan_smaller.gif" width="200" height="30" align="baseline" border="0"></a></td>');
    write('<td><img src="' + path + 'pa_images/tan360_6px.gif" width="360" height="30"></td>');
    write('<td><a href="' + path + 'contents.html" target=_top>');
    write('<img src="' + path + 'pa_images/contents_6px.gif" width="100" height="30" align="baseline" border="0"></a></td>');
    write('<td><a href="' + path + 'gloss_top.html" target=_top>');
    write('<img src="' + path + 'pa_images/glossary_6px.gif" width="120" height="30" align="baseline" border="0"></a></td>');
    write('');
    write('</tr></table>');
  }
}

function header() {
  var node = getCurrentNode();
  var path = getPath( node.url );

  _header();

  with (document) {
    if ( node ) {
      write('<table width="780" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCC99">');
      write('<tr>');
      write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
      write('<td width="200">'); getTopicName( path, node ); write('</td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
      write('<td width="220">'); getPageName( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="225">'); getFeatureName( path, node );  write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="40">&nbsp;</td>');
      write('</tr>');

      if ( node.type == 'main' ) {
        write('<tr>');
        write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
        write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
        write('<td width="220" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="225" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="40">'); navBack( path, node ); navNext( path, node ); write('</td>');
        write('</tr>');
      }
      else {
        write('<tr>');
        write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
        write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">unit&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
        write('<td width="220" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">subunit&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="225" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">page&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="40">'); navBack( path, node ); navNext( path, node ); write('</td>');
        write('</tr>');
      }

      write('</table>');

      // Subunit leaf
      if ( node.type == 'page' ) {
        //write('<br>&nbsp;&nbsp;<img class="leaf" src="' + path + 'pa_images/leaf32.gif">');
        //write( '<font face="Arial, Helvetica, sans-serif" size="3" color="#000000">Subunit ~ ' + node.parent.title + ' ~ page ~ ' + node.title + '</font>' );
      }
      else if ( node.type == 'topic' ) {
        write('<br>&nbsp;&nbsp;<img class="leaf" src="' + path + 'pa_images/leaf32.gif">');
        write( '<font face="Arial, Helvetica, sans-serif" size="3" color="#000000">Subunit ~ ' + node.title + '</font>' );
      }
      else if ( node.type == 'video' ) {
        write('<br>&nbsp;&nbsp;<img class="leaf" src="' + path + 'pa_images/video32.gif">');
        write( '<font face="Arial, Helvetica, sans-serif" size="3" color="#000000">&nbsp;' + node.title + '</font>' );
      }
      else if ( node.type == 'xtra' ) {
        write('<br>&nbsp;&nbsp;<img class="leaf" src="' + path + 'pa_images/xtra32.gif">');
        write( '<font face="Arial, Helvetica, sans-serif" size="3" color="#000000">&nbsp;' + node.title + '</font>' );
      }
      else {
      }

    }
  }
}

function footer() {
  var node = getCurrentNode();
  var path = getPath( node.url );
  with (document) {

    if ( node ) {
      write('<br>');
      write('<br>');
      write('<table width="780" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCC99">');
      write('<tr>');
      write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
      write('<td width="200">'); getTopicName( path, node ); write('</td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
      write('<td width="220">'); getPageName( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="225">'); getFeatureName( path, node );  write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="40">&nbsp;</td>');
      write('</tr>');

      if ( node.type == 'main' ) {
        write('<tr>');
        write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
        write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
        write('<td width="220" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="225" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="40">'); navBack( path, node ); navNext( path, node ); write('</td>');
        write('</tr>');
      }
      else {
        write('<tr>');
        write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
        write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">unit&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
        write('<td width="220" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">subunit&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="225" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">page&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
        write('<td width="40">'); navBack( path, node ); navNext( path, node ); write('</td>');
        write('</tr>');
      }

      write('</table>');
    }
  }
}

// TODO: replace following header/footer function calls
function wood_header() {
  var node = getCurrentNode();
  var path = "../../" + getPath( node.url );
	var wk_path = getWoodKeyPath();

  with (document) {

    write('<table width="780" border="0" cellspacing="0" cellpadding="0">');
    write('<tr><td><a href="' + path + 'index.html" target=_top>');
    write('<img src="' + path + 'pa_images/logo_tan_smaller.gif" width="200" height="30" align="baseline" border="0"></a></td>');
    write('<td><img src="' + path + 'pa_images/tan360_6px.gif" width="360" height="30"></td>');
    write('<td><a href="' + path + 'contents.html" target=_top>');
    write('<img src="' + path + 'pa_images/contents_6px.gif" width="100" height="30" align="baseline" border="0"></a></td>');
    write('<td><a href="' + path + 'gloss_top.html" target=_top>');
    write('<img src="' + path + 'pa_images/glossary_6px.gif" width="120" height="30" align="baseline" border="0"></a></td>');
    write('');
    write('</tr></table>');

		write('<table width="780" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCC99">');
		write('<tr>');
		write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
		write('<td width="200"><a href="../../woods/index.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Wood: Taxonomic Variation</font></b></a></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
		write('<td width="100"><a href="../../woodkey/w.html"><img src="' + path + 'pa_images/wood16.gif" width="16" height="16" border="0" align="absmiddle" alt="home"></a>&nbsp;<a href="../../woodkey/w.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Woodkey</font></b></a></td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
		write('<td width="325"><a href="w0.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Start Example Set</font></b></a></td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
		write('<td width="40" align="right"><a href="javascript:history.go(-1)"><img src="' + path + 'pa_images/arrow.gif" width="20" height="16" border="0" align="absmiddle" alt="back"></a>&nbsp;</td>');
		write('</tr>');
		write('<tr>');
		write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
		write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
		write('<td width="100" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
		write('<td width="325" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
		write('<td width="40">&nbsp;</td>');
		write('</tr>');
		write('</table>');
  }
}

function wood_footer() {
  var node = getCurrentNode();
  var path = "../../" + getPath( node.url );
  with (document) {

    if ( node ) {
      write('<table width="780" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCC99">');
      write('<tr>');
      write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
      write('<td width="200"><a href="../../woods/index.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Wood: Taxonomic Variation</font></b></a></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
      write('<td width="100"><a href="../../woodkey/w.html"><img src="' + path + 'pa_images/wood16.gif" width="16" height="16" border="0" align="absmiddle" alt="home"></a>&nbsp;<a href="../../woodkey/w.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Woodkey</font></b></a></td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="325"><a href="w0.html"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">Start Example Set</font></b></a></td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
      write('<td width="40" align="right"><a href="javascript:history.go(-1)"><img src="' + path + 'pa_images/arrow.gif" width="20" height="16" border="0" align="absmiddle" alt="back"></a>&nbsp;</td>');
      write('</tr>');
			write('<tr>');
			write('<td width="40"><img src="' + path + 'pa_images/clear.gif" width=40 height=1></td>');
			write('<td width="200" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font></td><td width="15"><img src="' + path + 'pa_images/clear.gif" width=15 height=1></td>');
			write('<td width="100" valign="bottom" align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navTopics( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
			write('<td width="325" align="left" valign="bottom"><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">&nbsp;</font>'); navPages( path, node ); write('</td><td width="20"><img src="' + path + 'pa_images/clear.gif" width=20 height=1></td>');
			write('<td width="40">&nbsp;</td>');
			write('</tr>');
      write('</table>');
    }
  }
}


function navBack( path, node ) {
  var node_ = getPrevNode( node );
  if ( node_ == null ) {
    document.write( '<IMG SRC="' + path + 'pa_images/back_off.gif" WIDTH=15 HEIGHT=20 BORDER=0 ALIGN=ABSMIDDLE ALT="Back">&nbsp;' );
  }
  else {
    document.write( '<A HREF="' + path + node_.url + '"><IMG SRC="' + path + 'pa_images/back.gif" WIDTH=15 HEIGHT=20 BORDER=0 ALIGN=ABSMIDDLE ALT="Back"></A>&nbsp;' );
  }
}

function navNext( path, node ) {
  var node_ = getNextNode( node );
  if ( node_ == null ) {
    document.write( '<IMG SRC="' + path + 'pa_images/forward_off.gif" WIDTH=15 HEIGHT=20 BORDER=0 ALIGN=ABSMIDDLE ALT="Forward">' );
  }
  else {
    document.write( '<A HREF="' + path + node_.url + '"><IMG SRC="' + path + 'pa_images/forward.gif" WIDTH=15 HEIGHT=20 BORDER=0 ALIGN=ABSMIDDLE ALT="Forward"></A>' );
  }
}


function navTopics( path, node ) {
  with ( document ) {
    if ( node.type == 'unit' && node.children.size > 0 ) {
      navbar( node, node, 'topic' );
    }
    else if ( node.type == 'topic' && node.parent.children.size > 0 ) {
      navbar( node, node.parent, 'topic' );
    }
    else if ( node.type == 'page' && node.parent.parent.children.size > 0 ) {
      navbar( node.parent, node.parent.parent, 'topic' );
    }
    else if ( ( node.type == 'video' || node.type == 'xtra' ) && node.parent.children.size > 0 ) {
      navbar( node, node.parent, 'topic' );
    }
  }
}

function navPages( path, node ) {
  with ( document ) {
    if ( node.type == 'unit' ) {
      write('&nbsp;');
    }
    else if ( node.type == 'topic' && node.children.size > 0 ) {
      navbar( node, node, 'page' );
    }
    else if ( node.type == 'page' && node.parent.children.size > 0 ) {
      navbar( node, node.parent, 'page' );
    }
    else if ( ( node.type == 'video' || node.type == 'xtra' ) && node.parent.children.size > 0 ) {
      navbar( node, node, 'page' );
    }
  }
}

function getTopicName( path, node ) {
  with ( document ) {
    if ( node.type == 'page' ) {
      write( '<a href="' + path + node.parent.parent.url + '"><b><font face="arial, helvetica, sans-serif" size="2" color="#990000">' + node.parent.parent.title + '</font></b></a>' );
    }
    else if ( node.type == 'topic' ) {
      write( '<a href="' + path + node.parent.url + '"><b><font face="arial, helvetica, sans-serif" size="2" color="#990000">' + node.parent.title + '</font></b></a>' );
    }
    else if ( node.type == 'unit' ) {
      write( '<a href="' + path + node.url + '"><b><font face="arial, helvetica, sans-serif" size="2" color="#990000">' + node.title + '</font></b></a>' );
    }
    else if ( node.type == 'video' || node.type == 'xtra' ) {
      write( '<a href="' + path + node.parent.url + '"><b><font face="arial, helvetica, sans-serif" size="2" color="#990000">' + node.parent.title + '</font></b></a>' );
    }
    else {
      write('&nbsp;');
    }
  }
}

function getPageName( path, node ) {
  with ( document ) {
    if ( node.type == 'page' ) {
      write( '<b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">' + node.parent.title + '</font></b>' );
    }
    else if ( node.type == 'topic' ) {
      write( '<b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">' + node.title + '</font></b>' );
    }
    else if ( node.type == 'video' || node.type == 'xtra' ) {
      write( '<b><font face="Arial, Helvetica, sans-serif" size="2" color="#990000">' + node.title + '</font></b>' );
    }
    else {
      write('&nbsp;');
    }
  }
}

function getFeatureName( path, node ) {
  with ( document ) {
    write('&nbsp;');
  }
}

function navPath( path, node ) {
  with ( document ) {
    write( '<TABLE BORDER=0 BGCOLOR="#ffffff"><TR>' );
    if ( node.type == 'page' ) {
      write( '<TD CLASS="nav">' );
      write( '<A HREF="' + path + node.parent.parent.parent.url + '">' + node.parent.parent.parent.title + '</A> ' );
      write( '| <A HREF="' + path + node.parent.parent.url + '">' + node.parent.parent.title + '</A> ' );
      write( '| <A HREF="' + path + node.parent.url + '">' + node.parent.title + '</A> ' );
      write( '</TD>' );
    }
    else if ( node.type == 'topic' ) {
      write( '<TD CLASS="nav">' );
      write( '<A HREF="' + path + node.parent.parent.url + '">' + node.parent.parent.title + '</A> ' );
      write( '| <A HREF="' + path + node.parent.url + '">' + node.parent.title + '</A> ' );
      write( '| <A HREF="' + path + node.url + '">' + node.title + '</A><BR>' );
      write( '</TD>' );
    }
    else if ( node.type == 'unit' ) {
      write( '<TD CLASS="nav">' );
      write( '<A HREF="' + path + node.parent.url + '">' + node.parent.title + '</A> ' );
      write( '| <A HREF="' + path + node.url + '">' + node.title + '</A><BR>' );
      write( '</TD>' );
    }
    else if ( node.type == 'main' ) {
      write( '<TD CLASS="nav">' );
      write( '<A HREF="' + path + node.url + '">' + node.title + '</A><BR>' );
      write( '</TD>' );
    }
    write( '</TR></TABLE>' );
  }
}

function getNextNode( node ) {
  for ( i = 0; i < order.size; i++ ) {
    if ( order[i] == node && i + 1 < order.size ) {
      return order[i+1];
    }
  }
  return order[1];
}

function getPrevNode( node ) {
  for ( i = 0; i < order.size; i++ ) {
    if ( order[i] == node && i > 0 ) {
      return order[i-1];
    }
  }
  return order[0];
}

function navbar( thisnode, pnode, doc_type ) {
  var node = getCurrentNode();
  var path = getPath( node.url );
  var img = 'next.gif';
  var type_start;

  if (doc_type == "unit")
    type_start = 0;
  if (doc_type == "topic")
    type_start = 1;
  if (doc_type == "page")
    type_start = 2;

  for ( i = 0; i < pnode.children.length; i++ ) {
    var n = pnode.children[i];
    if ( n == thisnode ) {
      img = 'back.gif';
    }
  }

  with (document) {
    for ( i = 0; i < pnode.children.length; i++ ) {
      var n = pnode.children[i];

      // modified by sid on 3/27
      if ( n == thisnode ) {
        if (doc_type == "topic") {
          navnode_subunit( n.title, path + 'this.gif', path + n.url, i + type_start );
        }
        else if (doc_type == "page") {
          write(''); // adjustments to highlighted page here
          navnode_page( n.title, path + n.url, i + type_start, "yes" );
          write('');
        }
      }
      else
      {
        if (doc_type == "topic") {
          navnode_subunit( n.title, path + 'next.gif', path + n.url, i + type_start );
        }
        else if (doc_type == "page") {
          navnode_page( n.title, path + n.url, i + type_start, null );
        }
      }
    }
  }
}

function navnode_subunit( ttl, img, url, page_number ) {
  with (document) {
    if ( url == null ) {
      write( '<IMG SRC="' + img + '" xWIDTH=16 xHEIGHT=12 BORDER=0 ALT="' + ttl + '">' );
    }
    else {
      write( '<A HREF="' + url + '"><IMG SRC="' + img + '" xWIDTH=16 xHEIGHT=12 BORDER=0 ALT="' + ttl + '"></A>' );
    }
  }
}

function navnode_page( ttl, url, page_number, highlight ) {
  with (document) {
    if (highlight == null) {
      write( '<a href="' + url + '"><b><font face="arial,helvetica" color="#990000" size="2">&nbsp;' + page_number + '</font></b></a>' );
    }
    else {
      write( '<b><font face="arial,helvetica" color="#FFFFCC" size="2">&nbsp;' + page_number + '</font></b>' );
    }
  }
}


var order;
var nodes = new Array();
var tree_nodes;

function init() {
  nodes = new Array();

  var main;
  var unit;
  var topic;

  tree_nodes = new Array (

new Node( "main", "contents.html", "Contents" ),

new Node( "unit", "preface/index.html", "Preface" ),


new Node( "unit", "vtphloem/index.html", "Vascular Tissues: Phloem" ),
new Node( "topic", "vtphloem/sieve1/1030-07n.html", "Sieve Elements &amp; Companion Cells" ),
new Node( "page", "vtphloem/sieve1/1030-25n.html", "2" ),
new Node( "page", "vtphloem/sieve1/0929n.html", "3" ),
new Node( "page", "vtphloem/sieve1/0938n.html", "4" ),
new Node( "page", "vtphloem/sieve1/0805n.html", "5" ),
new Node( "page", "vtphloem/sieve1/43n.html", "6" ),
new Node( "page", "vtphloem/sieve1/42n.html", "7" ),
new Node( "page", "vtphloem/sieve1/0904n.html", "8" ),
new Node( "page", "vtphloem/sieve1/0903n.html", "9" ),
new Node( "page", "vtphloem/sieve1/mg0700.html", "10" ),
new Node( "topic", "vtphloem/primary2/0912n.html", "Primary &amp; Secondary Phloem of Angiosperms" ),
new Node( "page", "vtphloem/primary2/0913n.html", "2" ),
new Node( "page", "vtphloem/primary2/0914n.html", "3" ),
new Node( "page", "vtphloem/primary2/05n.html", "4" ),
new Node( "page", "vtphloem/primary2/08n.html", "5" ),
new Node( "page", "vtphloem/primary2/10n.html", "6" ),
new Node( "page", "vtphloem/primary2/11n.html", "7" ),
new Node( "topic", "vtphloem/conifer3/01n.html", "Conifer Secondary Phloem" ),
new Node( "page", "vtphloem/conifer3/02n.html", "2" ),
new Node( "page", "vtphloem/conifer3/03n.html", "3" ),
new Node( "page", "vtphloem/conifer3/strascell.html", "4" ),
new Node( "cont", "contents2.html", "Contents" ),

new Node( "unit", "periderm/index.html", "Periderm" ),
new Node( "topic", "periderm/origin1/mg0478.html", "Origin of Phellogen" ),
new Node( "page", "periderm/origin1/1006n.html", "2" ),
new Node( "page", "periderm/origin1/16n.html", "3" ),
new Node( "page", "periderm/origin1/1017n.html", "4" ),
new Node( "page", "periderm/origin1/1005n.html", "5" ),
new Node( "page", "periderm/origin1/23n.html", "6" ),
new Node( "page", "periderm/origin1/24n.html", "7" ),
new Node( "topic", "periderm/phellogen2/21n.html", "Phellogen Activity &amp; Periderm Development" ),
new Node( "page", "periderm/phellogen2/1030n.html", "2" ),
new Node( "page", "periderm/phellogen2/1013n.html", "3" ),
new Node( "page", "periderm/phellogen2/1015n.html", "4" ),
new Node( "page", "periderm/phellogen2/0628n.html", "5" ),
new Node( "topic", "periderm/lenti3/sambn.html", "Lenticels" ),
new Node( "page", "periderm/lenti3/29n.html", "2" ),
new Node( "page", "periderm/lenti3/1024n.html", "3" ),
new Node( "page", "periderm/lenti3/mg0639.html", "4" ),
new Node( "topic", "periderm/rhyti4/1030-13n.html", "Rhytidome" ),
new Node( "page", "periderm/rhyti4/1016n.html", "2" ),
new Node( "page", "periderm/rhyti4/1004n.html", "3" ),
new Node( "page", "periderm/rhyti4/0620n.html", "4" ),
new Node( "page", "periderm/rhyti4/0621n.html", "5" ),
new Node( "page", "periderm/rhyti4/1008n.html", "6" ),
new Node( "page", "periderm/rhyti4/1002n.html", "7" ),
new Node( "page", "periderm/rhyti4/1019n.html", "8" ),
new Node( "cont", "contents2.html", "Contents" ),
new Node( "X", "X.html", "X" )
  );


  for ( var i = 0; i < tree_nodes.length; i++ ) {
    var node = tree_nodes[i];
    if ( node.type == 'main' ) {
      main = node;
    }
    else if ( node.type == 'unit' ) {
      unit = node;
      main.addChild( unit );
    }
    else if ( node.type == 'cont' ) {
      unit = node;
      main.addChild( unit );
    }
    else if ( node.type == 'topic' ) {
      topic = node;
      unit.addChild( topic );
    }
    else if ( node.type == 'page' ) {
      topic.addChild( node );
    }
    else if ( node.type == 'video' ) {
      topic = node;
      unit.addChild( topic );
    }
    else if ( node.type == 'xtra' ) {
      topic = node;
      unit.addChild( topic );
    }
  }

  order = new Array();
  order.size = 0;
  orderNodes( main );
}

function orderNodes( root ) {
  order[order.size] = root;
  order.size++;
  for ( var i = 0; i < root.children.size; i++ ) {
    orderNodes( root.children[i] );
  }
}


function Node_addChild( node ) {
  this.children[this.children.size] = node;
  this.children.size++;
  node.parent = this;
}

function Node( type, url, title ) {
  this.type = type;
  this.url = url;
  this.title = title;
  this.parent;
  this.children = new Array();
  this.children.size = 0;
  this.addChild = Node_addChild;
  nodes[url] = this;
}

function getCurrentNode() {
  var thisURL = document.location.href;
  for ( var url in nodes ) {
    if ( thisURL.lastIndexOf( url ) != -1 ) {
      return nodes[url];
    }
  }

  return tree_nodes[0];
}

function getWoodKeyPath() {
  var thisURL = document.location.href;

	if ( thisURL.lastIndexOf( 'w01.html' ) != -1 ) {
		return '../';
	}
	else {
		return '';
	}
}

function getPath( url ) {
  depth = url.split('/').length - 1;
  var path = '';
  for ( i = 0; i < depth; i++ ) {
    path = path + '../';
  }
  return path;
}

init();
