startList=function() {

	if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");

	for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
	if (node.nodeName=="LI") {
	node.onmouseover=function() {
	  this.className += " over";
	  }
	node.onkeyup=function() {
	  this.className += " over";
	}
	node.onmouseout=function() {
	  this.className=this.className.replace(" over", "");
	}
	node.onkeydown=function() {
	  this.className=this.className.replace(" over", "");
	}
	   
	   }
	  }
	 }
	}
	
initStretches=function() {

var stretchLinks;
var el, el_handler;

stretchLinks = document.getElementsByClassName("read_more");

stretchDivs  = document.getElementsByClassName("stretch_container");

hideAllStretchDivs(stretchDivs);

for (i=0; i<stretchLinks.length; i++) {

  el = node_after(stretchLinks[i]);
 
  if (!el.className == "stretchContainer") {
	 // collapsable div must be immediately after stretch handler
	 // Ignore if next element isn't a div
  }
  else {
	createStretch(el, stretchLinks[i]);
  }
  
}

}

createStretch=function(el_to_alter, el_to_trigger) {

	var stretch = new Fx.Height(el_to_alter);
	
	el_to_trigger.style.cursor = "pointer";

	el_to_trigger.onmouseover   = assignOverClass;
	el_to_trigger.onmouseout    = removeOverClass;


	el_to_trigger.title = "Expand this section";
	
	
	el_to_trigger.onclick = function() {	
	
			stretch.toggle();
						
			if (el_to_alter.style.height == "0px" || el_to_alter.style.height == "0pt") {
				this.innerHTML = "Close this section";
			} else {
				this.innerHTML = "Read More";
			}

			
		};
	
}

assignOverClass=function() {
  Element.addClassName(this, "over");
}

removeOverClass=function() {
  Element.removeClassName(this, "over");
}

function hideAllStretchDivs(stretchDivs) {

for (i=0; i<stretchDivs.length; i++) {
	stretchDivs[i].style.height = "0";
}

}


Event.observe(window, "load", startList, false);
Event.observe(window, "load", initStretches, false);


