function showRefToggle() {
if (document.createTextNode) {
// Uses DOM calls to avoid document.write + XHTML issues
refHideText = "Einzelnachweise verstecken";
refShowText = "Einzelnachweise anzeigen";
var a;
var bodyContent = document.getElementById('bodyContent');
if (bodyContent != null) {
var olarray = bodyContent.getElementsByTagName("ol");
if (olarray != null && olarray.length > 0) {
a = olarray.length - 1;
var olnode = olarray;
if (olnode.className == "references") {
olnode.id = "referencelist";
}
}
}
var linkHolder = document.getElementById('referencelist');
if (!linkHolder)
return;
var outerSpan = document.createElement('div');
outerSpan.className = 'reftoggle';
var toggleLink = document.createElement('a');
toggleLink.id = 'reftogglelink';
toggleLink.className = 'internal';
toggleLink.href = 'javascript:toggleRef()';
toggleLink.appendChild(document.createTextNode(refHideText));
var linkHolder2 = document.getElementById('contentSub'); // the first link is right behind the //redirect
if (linkHolder2) {
var outerSpan2 = outerSpan.cloneNode(true);
var toggleLink2 = toggleLink.cloneNode(true);
toggleLink2.id = 'reftogglelink2';
outerSpan2.id = 'reftogglespanhead';
outerSpan2.appendChild(document.createTextNode('['));
outerSpan2.appendChild(toggleLink2);
outerSpan2.appendChild(document.createTextNode(']'));
linkHolder2.parentNode.insertBefore(outerSpan2, linkHolder2.nextSibling);
linkHolder2.parentNode.insertBefore(document.createTextNode(' '),linkHolder2.nextSibling);
linkHolder2.style.marginBottom = '1px';
}
outerSpan.id = 'reftogglespandown';
outerSpan.appendChild(document.createTextNode('['));
outerSpan.appendChild(toggleLink);
outerSpan.appendChild(document.createTextNode(']'));
linkHolder.parentNode.insertBefore(outerSpan, linkHolder);
linkHolder.parentNode.insertBefore(document.createTextNode(' '), linkHolder);
var cookiePos = document.cookie.indexOf("hideref=");
if (cookiePos > -1 && document.cookie.charAt(cookiePos + 8) == 1)
toggleRef();
}
}
function toggleRef() {
var switched = 2;
var refarr = document.getElementsByTagName('sup');
for (var cou = 0; cou < refarr.length; cou++) {
if (refarr.className == "reference") {
if (refarr.style.display == "none") {
refarr.style.display = 'inline';
switched = 0;
} else {
refarr.style.display = 'none';
switched = 1;
}
}
}
switch (switched) {
case 0: // references are shown
var olref = document.getElementById('referencelist');
if (olref) { olref.style.display = 'block'; }
changeText(document.getElementById('reftogglelink2'), refHideText);
changeText(document.getElementById('reftogglelink'), refHideText);
document.cookie = "hideref=0";
break;
case 1: // references are not shown
var olref = document.getElementById('referencelist');
if (olref) { olref.style.display = 'none'; }
changeText(document.getElementById('reftogglelink2'), refShowText);
changeText(document.getElementById('reftogglelink'), refShowText);
document.cookie = "hideref=1";
break;
}
}
$(showRefToggle);