summaryrefslogtreecommitdiff
path: root/assignment1/materials/Environmental Impact Assessment Course Module » 2-5 Principles for a Functional EIA System_files/unu.js
blob: 5e70cf16e0039ce508e9785cd81b34cf4960765a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
  UNU-specific JavaScript
*/

var UNU = {

prepareNavigation:function()
{
  var lis = $('navul').childNodes;
  for(var i=0;i<lis.length;i++)
  {
    // grab just the list items
    if(lis[i].nodeType == 1 && lis[i].tagName.toLowerCase() == 'li')
    {
   
   
     current	= lis[i].childNodes;
	 current[0].className = 'h';
	 el = current[0];
	 var wrapper = document.createElement('span');
	 el.parentNode.replaceChild(wrapper, el);
	 wrapper.appendChild(el);
   
      var sub = lis[i].getElementsByTagName("ul");
      if(sub.length > 0)
      {
        // attach a rollup effect and onclick event to the span inside the list item
        // this element must be the first element (ie: no space between the open
        // li and the <span> or <a>
        lis[i].childNodes[0].fx = new fx.Height(sub[0], {duration:300});
        lis[i].childNodes[0].fx.hide();
        lis[i].childNodes[0].onclick = this.fxonclick;
      }
    }
  }

 var lis = $('navul').getElementsByTagName('li');
  for(var i=0;i<lis.length;i++)
  {
      if(lis[i].className && lis[i].className.match(/current_page_item/))
      {
		  
        if(lis[i].childNodes[0].fx)
        {
			
		  
          lis[i].childNodes[0].fx.toggle();
        }else if(lis[i].parentNode.parentNode.parentNode.parentNode.childNodes[0].fx){
				lis[i].parentNode.parentNode.parentNode.parentNode.childNodes[0].fx.toggle();
		} else if(lis[i].parentNode.parentNode.childNodes[0].fx){
           
	
				lis[i].parentNode.parentNode.childNodes[0].fx.toggle();
        } 
      }
  }
},

fxonclick:function(){
  this.fx.toggle();
  return false;
}

};