<!--
function DOMhide(clickfor)   // replaces DIV by "Click for" + clickfor - unless DIV attribute "clickfor" is set
{
coll=document.getElementsByTagName("div")
if (coll[0].style.display!=null)  //check that style.display works
	{
		style=document.createStyleSheet()
		style.addRule(".divbutton","background-color: #ccccff; float: Right;position: relative; top:-24")
		style.addRule(".divbutton_LHS","color: Darkgray") // for Click for or Покажи, button само за затваряне "btype"="lhs"
		style.addRule(".divbutton2","background-color: #ffcccc;float: Right;position: relative;top:-24")
		for (i=0;i<coll.length;i++)
		{
		div=coll[i]
		div.style.display="none"
		p=div.parentNode
		msg=clickfor
		if (div.getAttribute("clickfor")!=null)
			{msg=div.getAttribute("clickfor")}
		if (div.getAttribute("btype")=="lhs")
			{
			t=document.createTextNode("Покажи "+msg)
			button=document.createElement("p")
			button.className="divbutton_LHS"
			} 
			else
			{
			t=document.createTextNode("+")
			button=document.createElement("button")
			button.title="Click for "+msg
			button.className="divbutton"
			}
		button.appendChild(t)
		p.insertBefore(button,div)
		button.onclick=showDiv   //NB = Function - if want parameters must use =new Function(" etc")
		button2=document.createElement("button")
		t=document.createTextNode("-")
		button2.appendChild(t)
		button2.title="Click to hide ....."+msg
		button2.className="divbutton2"
		p.insertBefore(button2,button)
		button2.onclick=hideDiv  
		button2.style.display="none" 
		}
	}
document.parentWindow.scrollTo(0,0)
}

function showDiv(){
button=event.srcElement; button.style.display="none"
button2=button.previousSibling; button2.style.display="block" 
div=button.nextSibling; div.style.display="block"}

function hideDiv(){
button2=event.srcElement; button2.style.display="none"
button=button2.nextSibling; button.style.display="block"
div=button.nextSibling; div.style.display="none" }

function refhide()   // hide items in reference tables (except first and "end" class)
{
colltd=document.getElementsByTagName("td")
if (colltd[0].style.display!=null)  //check that style.display works - else exit
	{
	style=document.createStyleSheet()
	style.addRule(".clickfor","color: #7777FF; text-indent: 40")
	style.addRule(".clickhide","color: #FF7777; text-indent: 40")
	style.addRule("TD P","text-indent: 40; text-align: Justify; margin-top: 0; margin-bottom: 0")
	style.addRule("SELECT","background-color: #C0C0C0")
	for (itd=0;itd<colltd.length;itd++)    //check each cell
		{
		td=colltd[itd]
		if(td.cellIndex==1) // skip LH cells   
			{
			div=null   // reset <div>  
			np=1             // para number
			for (ichild=1;ichild<td.childNodes.length;ichild++)   //check each node in cell but first
				{
				child=td.childNodes[ichild]
				if (child.className!="end")  // no action on .end para
					{
					if (child.nodeName=="P")    // look for <P>
						{
						np++
						if (np==2)					// create <div> before second para
							{
							div=document.createElement("div")
							div.style.display="none"  
							//div.style.backgroundColor="#c8c8c8"
							td.insertBefore(div,child)
							ichild++
							}
						div.appendChild(child)
						ichild--
						}
						else   // if not <p> insert <blockquote> and <ul> into <div>
						{
						if (np>1&&(child.nodeName=="BLOCKQUOTE"||child.nodeName=="UL")){div.appendChild(child);ichild--}//child.style.display="none"}
						}
					}
				}    // next node
			if (div!=null)
				{
				plural=""; if (np>2){plural="s"}
				t=document.createTextNode("Click for "+(np-1)+" earlier item"+plural)
				button=document.createElement("p")  // assemble <p> button 
				button.appendChild(t)
				button.onclick=showDiv       
				button.className="clickfor"
				td.insertBefore(button,div)
				t=document.createTextNode("Click to hide earlier item"+plural)
				button2=document.createElement("p") 
				button2.appendChild(t)
				button2.onclick=hideDiv       
				button2.className="clickhide"
				button2.style.display="none"
				td.insertBefore(button2,button)
				} 
			}      // next cell
		}
	document.parentWindow.scrollTo(0,0)
	}
}  


function alphaindex()  // create alphabetical index - insert before id=index1
{
myarray=new Array()
iopt=0
colltd=document.getElementsByTagName("td")
for (itd=0;itd<colltd.length;itd++)
	{
	td=colltd[itd]
	if(td.cellIndex==0&&td.className!="noindex")  // check only in first column
		{
		//coll=td.childNodes
		coll=td.getElementsByTagName("a")
		address=coll[0].getAttribute("name")
		text=gettext(td)
		myarray[iopt]=text+"#"+address; iopt++
		}
	}
myarray.sort()
menu=document.createElement("select")
menu.onchange=jumpto 
opt=new Option("Alphabetical index")
menu.options[0]=opt
for (i=0;i<myarray.length;i++)
	{
	s=myarray[i].split("#")
	opt=new Option(s[0],"#"+s[1]) 
	menu.options[i+1]=opt
	}
index1.style.display="none" // high index - pointer
index1.parentElement.insertBefore(menu,index1)
index2.style.display="none" // hide index - data
}

function artindex()  // create article index - insert before id=index3
{
style=document.createStyleSheet()
	style.addRule("SELECT","background-color: #C0C0C0; color:#0000FF ")
menu=document.createElement("select")
menu.onchange=jumpto 
opt=new Option("Evolving articles - by date with the most recent first")
menu.options[0]=opt
collli=articles.getElementsByTagName("li")
for (ili=0;ili<collli.length;ili++)
	{
	opt=new Option("");menu.options[2*(ili+1)-1]=opt  // blank line
	li=collli[ili]
	coll=li.getElementsByTagName("a")
	address=coll[0].getAttribute("href")
	text=gettext(li)
	opt=new Option(text,address) 
	menu.options[2*(ili+1)]=opt
	}
index3.style.display="none" // hide index - pointer
index3.parentElement.insertBefore(menu,index3)
articles.style.display="none" // hide index - data
}

function gettext(obj)
{
t=""
stack=new Array()
stack[0]=obj
while (stack.length>0)
	{
	e=stack[stack.length-1];stack.length--
	if(e.nodeType==3) {t+=e.nodeValue}  // check for textnode (=3)
		else
		{if(e.firstChild!=null)
			{
			c=e.childNodes
			for (i=c.length-1;i>-1;i--) {stack[stack.length]=c[i]	}
			}
		}
	}
return t
}

function jumpto ()
{
menu=event.srcElement
with (menu){
if(selectedIndex==0||options[selectedIndex].value==""){selectedIndex=0;return}
location.href=options[selectedIndex].value}
}
-->


