//<script>
var MSIE = (document.all) && (window.navigator.userAgent.indexOf('MSIE') > 0);

function setAttr(node,vals) {
//  node.setAttribute("style",vals); // ginge f&uuml;r alle Browser ausser MicroSchrott IE
var s=node.style.cssText;
var options=vals.split(";");
for (var i=0;i<options.length;i++) {
  var opt=options[i].split(":");
  s+=((i>0)?";":"")+opt[0]+":"+node.style[opt[0]];
  node.style[opt[0]]=opt[1]; }
return s; } // setAttr

var index=""; var index_css=""; var node=""; var node_css=""; var body=""; var body_css="";

function printok() {
body.removeChild(body.firstChild);
void setAttr(body,body_css);   body="";  body_css="";
void setAttr(index,index_css); index=""; index_css="";
void setAttr(node,node_css);   node="";  node_css="";
return; }
  
function ausdrucken(id,titel) {
index=document.getElementById("index");        index_css=setAttr(index,"overflow:hidden;height:auto;display:none");
node=document.getElementById(id);              node_css=setAttr(node,"overflow:visible;height:auto");
body=document.getElementsByTagName("body")[0]; body_css=setAttr(body,"overflow:visible;height:auto");
var retour=document.createElement("a");
retour.href="javascript:printok();"; retour.appendChild(document.createTextNode("Zur&uuml;ck"));
void setAttr(retour,"margin:1ex 1em;float:left;");
body.insertBefore(retour,body.firstChild);
this.print();
return; } // ausdrucken

function buildIndex (document) {
var idx=document.getElementById("index");
var txt=document.getElementById("text");
var ix=Array(1,1,1,1,1,1);
var ai=0;

  function addIndex(node,l) {
  if (!node) return;
  var aname=""; var nd,a;
  for (var i=1;i<=l;i++) aname+="h"+ix[i-1];
  ix[l-1]++;
  nd=document.createElement("h"+l);
  a=document.createElement("a"); a.href="\#"+aname;
  for (var j=0;j<node.childNodes.length;j++) a.appendChild(node.childNodes[j].cloneNode(true));
  nd.appendChild(a);
  idx.appendChild(nd);
  if (MSIE) a=document.createElement("<A NAME='"+aname+"'></A>"); // IE only
  else { a=document.createElement("a"); a.name=aname; } // rest of the worl
  node.parentNode.insertBefore(a,node);
  return; } // addIndex

for (var i=0;i<txt.childNodes.length;i++)
  if (txt.childNodes[i].nodeName.substr(0,1)=="H")
  { addIndex(txt.childNodes[i],parseInt(txt.childNodes[i].nodeName.substr(1,1)));
    i++;
  } // if nodeName=="H*"
return; } // buildIndex
//</script>
