
isGecko = false;

function ndWriteAnchorLinks() {

	 var h4s = document.getElementsByTagName("H4");
	 var indexObj = document.getElementById("anchorlinks");
	 var str = "";
	 
	 if (h4s.length > 0) {
	 
	  str = "<UL>";
	  
	  for (var i = 0; i< h4s.length; i++) {
	  
	   title = h4s[i].innerHTML;
	   title = title.replace(/<[^>]+>/g,""); //remove tags
	   
	   //add anchor before the H2
	   if(isGecko) {
	    //Mozilla
	    newNode = document.createElement("A");
	    newNode.setAttribute("ID", "anchor" + i)
	    newNode.setAttribute("NAME", "anchor" + i)
	    h4s[i].parentNode.insertBefore(newNode,h4s[i]);
	   } else {
	    //IE
	    h4s[i].insertAdjacentHTML("BeforeBegin","<a name='anchor"+i+"'></a>");
	   }
	   
	    // list item
	    str += "<LI><a href='#anchor" + i + "'>" + title + "</a></LI>";
	   
	   indexObj.innerHTML = str;
	  }
	 
	   str += "</UL>";
	  
	 }
 }


function ndPopup(aTag, pWidth, pHeight) {
	//This function is supposed to be called from the a-tag with valid href-attribute
	//If pWidth and pHeight are given, the popup will assume them as width and height
	if (!pWidth) pWidth=700; if (!pHeight) pHeight=500;
	if (top.ndCMSPopup && !top.ndCMSPopup.closed && top.ndCMSPopup.close) top.ndCMSPopup.close();
	top.ndCMSPopup = top.open(aTag.href, "ndCMSPopup", "width="+pWidth+",height="+pHeight+",resizable=1,menubar=1");
	top.ndCMSPopup.focus();
	return false;
}
