var total=1;
var db = new Array();

// -- Enter Values Here --
// Format: dbAdd(parent[true|false] , description, URL [blank for nohref], level , TARGET [blank for "content"], new? [1=yes])
  dbAdd( false, "Welcome", "/" , 0 , "_parent" , 0)
  
  dbAdd( true , "WILD Programs" , "/programs/wld_prog.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Project WILD", "/programs/project_wild/prog_wld.asp", 1 , "_parent" , 0)
  dbAdd( false, "Fish Ways", "/programs/fish_ways/fishways.asp", 1 , "_parent" , 0)
  dbAdd( false, "Habitat 2000 / WILD Schools", "/programs/hab_2000/hab2000.asp", 1 , "_parent" , 0)
  dbAdd( false, "Ocean Education / Blue School", "/programs/blue_school/oceneduc.asp", 1 , "_parent" , 0)
  dbAdd( false, "Focus on Forests / Fire", "/programs/focus_forests/forests.asp", 1 , "_parent" , 0)
  dbAdd( false, "Below Zero", "/programs/below_zero/belwzero.asp", 1 , "_parent" , 0)
  dbAdd( false, "Space for Species", "/programs/space.asp", 1 , "_parent" , 0)

  dbAdd( true , "WILD Connections" , "/connections/wildconn.asp" , 0 , "_parent" , 0)
  dbAdd( false, "WILD News", "/connections/wildnews.asp", 1 , "_parent" , 0)
  dbAdd( false, "WILD Discussion Forum", "/construc.asp?page=2", 1 , "_parent" , 0)
  dbAdd( false, "Provincial and Territorial Project WILD Coordinators", "/construc.asp?page=2", 1 , "_parent" , 0)
  dbAdd( false, "Learning Activities Submitted by Our Guests", "/connections/activities/guest_submissions.asp", 1 , "_parent" , 0)
  dbAdd( false, "Submit Your Own Learning Activities", "/connections/activities/submit.asp", 1 , "_parent" , 0)
  dbAdd( false, "Contact WILD Education", "/connections/contcwld.asp", 1 , "_parent" , 0)
   
  dbAdd( true , "WILD Workshops" , "/workshops/workshop.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Project WILD Workshops", "/workshops/prjwldwk.asp", 1 , "_parent" , 0)
 // dbAdd( false, "Fish Ways Workshops", "/workshops/fishwywk.asp", 1 , "_parent" , 0)
 // dbAdd( false, "WILD Education Facilitator Workshops", "/workshops/wldeduwk", 1 , "_parent" , 0)
  
  dbAdd( true , "WILD Resources" , "/resources/wld_prog.asp" , 0 , "_parent" , 0)
  dbAdd( false, "<i>One Earth, One Ocean, One Life </i>CD-ROM", "/resources/onecdrom.asp", 1 , "_parent" , 0)
  dbAdd( false, "Coast-to-coast Butterfly Survey", "/resources/buttrfly.asp", 1 , "_parent" , 0)
  dbAdd( false, "On-line Directory of Wildlife Surveys", "/resources/surveys.asp", 1 , "_parent" , 0)
  dbAdd( false, "<i>Backyard Habitat for Canada's Wildlife </i>Guidebook", "/resources/guidebok.asp", 1 , "_parent" , 0)
  dbAdd( false, "<i>Think About the Planet </i> CD", "/resources/planetcd.asp", 1 , "_parent" , 0)
  dbAdd( false, "Our Membership Magazines", "/resources/cwfmemag.asp", 1 , "_parent" , 0)
  dbAdd( false, "Additional Resources", "/resources/addresrc.asp", 1 , "_parent" , 0)

  dbAdd( true , "WILD Facilitators" , "/leaders/leaders.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Facilitators Only Section", "/construc.asp?page=5", 1 , "_parent" , 0)
  
  dbAdd( false, "français", "http://www.educationnature.org", 0 , "_parent" , 0)
  dbAdd( false, "about us", "/about_us.asp", 0 , "_parent" , 0)
  dbAdd( false, "contact us", "/connections/contcwld.asp", 0 , "_parent" , 0)
  dbAdd( false, "what's new", "/construc.asp?page=23", 0 , "_parent" , 0)
  dbAdd( false, "site map", "/sitemap.asp", 0 , "_parent" , 0)
  dbAdd( false, "News Flash", "/connections/news/news.asp", 0 , "_parent" , 0)
  dbAdd( false, "Curriculum Fit", "/construc.asp?page=31", 0 , "_parent" , 0)
  
// -- End modifications --

// Get current cookie setting
var current=getCurrState()
function getCurrState() {
  var label = "currState="
  var labelLen = label.length
  var cLen = document.cookie.length
  var i = 0
  while (i < cLen) {
    var j = i + labelLen
    if (document.cookie.substring(i,j) == label) {
      var cEnd = document.cookie.indexOf(";",j)
      if (cEnd == -1) { cEnd = document.cookie.length }
      return unescape(document.cookie.substring(j,cEnd))
    }
    i++
  }
  return ""
}

// Add an entry to the database
function dbAdd(mother,display,URL,indent,top,newitem) {
  db[total] = new Object;
  db[total].mother = mother
  db[total].display = display
  db[total].URL = URL
  db[total].indent = indent
  db[total].top = top
  db[total].newitem = newitem
  total++
  }

// Record current settings in cookie
function setCurrState(setting) {
  var expire = new Date();
  expire.setTime(expire.getTime() + ( 24*60*60*1000 ) ); // expire in 1 day
  document.cookie = "currState=" + escape(setting) + "; expires=" + expire.toGMTString();
  }

// toggles an outline mother entry, storing new value in the cookie
function toggle(n) {
  if (n != 0) {
    var newString = ""
    var expanded = current.substring(n-1,n) // of clicked item
    newString += current.substring(0,n-1)
    newString += expanded ^ 1 // Bitwise XOR clicked item
    newString += current.substring(n,current.length)
    setCurrState(newString) // write new state back to cookie
  }
}

// returns padded spaces (in mulTIPles of 2) for indenting
function pad(n) {
  var result = ""
  for (var i = 1; i <= n; i++) { result += "&nbsp;&nbsp;&nbsp;&nbsp;" }
  return result
}

// Expand everything
function explode() {
  current = "";
  initState="";
  for (var i = 1; i < db.length; i++) { 
    initState += "1"
    current += "1"
    }
  setCurrState(initState);
  history.go(0);
  }

// Collapse everything
function contract() {
  current = "";
  initState="";
  for (var i = 1; i < db.length; i++) { 
    initState += "0"
    current += "0"
    }
  setCurrState(initState);
  history.go(0);
  }

function tree_close() {
  window.parent.location = window.parent.content.location;
  }

// end 