All global JavaScript functions and variables shall be prefixed with “xhtml2to1_”.
function xhtml2to1_onload()
{
var nav_div = document.getElementById('_navigation');
xhtml2to1_tree_load_state(nav_div);
return true;
}
function xhtml2to1_onunload()
{
var nav_div = document.getElementById('_navigation');
xhtml2to1_tree_save_state(nav_div);
return true;
}
Certain block-level elements displayed in the document body
can be optionally collapsed and hidden by the user.
In particular,
this is used for sub-sections in the document.
The xhtml2to1_collapse_toggle JavaScript
function implements this functionality.
This function can be called via the onclick attribute,
passing it as parameters:
event object
function xhtml2to1_collapse_toggle(id, event)
{
if(!event) event = window.event;
var switch_elem = event.target ? event.target : event.srcElement;
var target = document.getElementById(id);
if(target.style.display == 'none') {
target.style.display = 'block';
switch_elem.childNodes.item(0).data = '\u25bc';
} else {
target.style.display = 'none';
switch_elem.childNodes.item(0).data = '\u25ba';
}
return false;
}
function xhtml2to1_get_child_element(e, gi) {
var cl = e.childNodes;
for(var i = 0; i < cl.length; ++i) {
if(cl[i].nodeType == document.ELEMENT_NODE
&& cl[i].tagName == gi)
return cl[i];
}
return null;
}
Formatted using xhtml2to1 by Steve Cheng.