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, "Bienvenue", "/" , 0 , "_parent" , 0)
  
  dbAdd( true , "Programmes NATURE" , "/programs/wld_prog.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Atout-faune", "/programs/project_wild/prog_wld.asp", 1 , "_parent" , 0)
  dbAdd( false, "Petit poisson deviendra grand !", "/programs/fish_ways/fishways.asp", 1 , "_parent" , 0)
  dbAdd( false, "École FAUNIQUE / Projet d'habitat", "/programs/hab_2000/hab2000.asp", 1 , "_parent" , 0)
  dbAdd( false, "Pour mieux connaître la nature", "/programs/learningaboutwildlife/index.asp", 1 , "_parent" , 0)
  dbAdd( false, "Éducation-océan", "/programs/blue_school/oceneduc.asp", 1 , "_parent" , 0)
  dbAdd( false, "Semaine Nationale de la conservation de la faune", "/programs/nww/nww.asp", 1 , "_parent" , 0)
  dbAdd( false, "Objectif forêts / feu (Ontario)", "/programs/focus_forests/forests.asp", 1 , "_parent" , 0)
  dbAdd( false, "Sous zéro", "/programs/below_zero/belwzero.asp", 1 , "_parent" , 0)
  dbAdd( false, "L'espace pour les espèces", "/programs/space.asp", 1 , "_parent" , 0)

  dbAdd( true , "Connexions NATURE", "/connections/wildconn.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Nouvelles NATURE", "/connections/wildnews.asp", 1 , "_parent" , 0)
  dbAdd( false, "Groupe de discussion", "/construc.asp?page=2", 1 , "_parent" , 0)
  dbAdd( false, "Provincial and Territorial Project WILD Coordinators", "/construc.asp?page=2", 1 , "_parent" , 0)
  dbAdd( false, "Idées NATURE de nos visiteurs", "/connections/activities/guest_submissions.asp", 1 , "_parent" , 0)
  dbAdd( false, "Présentez vos propres activités", "/connections/activities/submit.asp", 1 , "_parent" , 0)
  dbAdd( false, "Contactez Éducation-nature", "/connections/contcwld.asp", 1 , "_parent" , 0)
   
  dbAdd( true , "Ateliers NATURE", "/workshops/workshop.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Ateliers Atout-faune", "/workshops/prjwldwk.asp", 1 , "_parent" , 0)
  dbAdd( false, "Ateliers Petit poisson deviendra grand!", "/workshops/fishwywk.asp", 1 , "_parent" , 0)
  dbAdd( false, "Ateliers de chef d'Éducation-nature", "/workshops/wldeduwk", 1 , "_parent" , 0)
  
  dbAdd( true , "Ressources NATURE", "/resources/wld_prog.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Disque compact <i>Une terre, un océan, une vie</i>", "/resources/onecdrom.asp", 1 , "_parent" , 0)
  dbAdd( false, "Sondage sur les papillons d'un océan à lautre", "/resources/buttrfly.asp", 1 , "_parent" , 0)
  dbAdd( false, "Répertoire en direct de recensements des espèces sauvages", "/resources/surveys.asp", 1 , "_parent" , 0)
  dbAdd( false, "Guide Backyard Habitat for Canada's Wildlife", "/resources/guidebok.asp", 1 , "_parent" , 0)
  dbAdd( false, "Disque compact <i>Think About the Planet</i>", "/resources/planetcd.asp", 1 , "_parent" , 0)
  dbAdd( false, "Revue des membres de la FCF", "/resources/cwfmemag.asp", 1 , "_parent" , 0)
  dbAdd( false, "Ressources supplémentaires", "/resources/addresrc.asp", 1 , "_parent" , 0)

  dbAdd( true , "Facilitateurs NATURE", "/leaders/leaders.asp" , 0 , "_parent" , 0)
  dbAdd( false, "Section Facilitateurs seulement", "/construc.asp?page=5", 1 , "_parent" , 0)
  
  dbAdd( false, "english", "http://www.wildeducation.org", 0 , "_parent" , 0)
  dbAdd( false, "à notre sujet", "/about_us.asp", 0 , "_parent" , 0)
  dbAdd( false, "contactez-nous", "/connections/contcwld.asp", 0 , "_parent" , 0)
  dbAdd( false, "quoi de neuf", "/construc.asp?page=23", 0 , "_parent" , 0)
  dbAdd( false, "carte du site", "/sitemap.asp", 0 , "_parent" , 0)
  dbAdd( false, "Nouvelles-éclair", "/connections/news/news.asp", 0 , "_parent" , 0)
  dbAdd( false, "Adaptation au curriculum", "/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 