
function ShowChapters(ChapterNo, SectionHeight) {

var ChapterSection = document.getElementById("ChapterSection");
  while(ChapterSection.firstChild)ChapterSection.removeChild(ChapterSection.firstChild)
	var objectitem = document.createElement("iframe");
	attrib = "HTMLs/Section" + ChapterNo + ".htm";
	objectitem.style.cssText = "width:100%; height:"+ SectionHeight + "px";
	objectitem.setAttribute("src", attrib);
	objectitem.frameBorder = 0;
ChapterSection.appendChild(objectitem);
}


function ShowSubChapters(SubChapterNo, SectionHeight) {

var SubChapterSection = parent.document.getElementById("SubChapterSection");
  while(SubChapterSection.firstChild)SubChapterSection.removeChild(SubChapterSection.firstChild)
	var objectitem = document.createElement("iframe");
	attrib = "HTMLs/Chapter" + SubChapterNo + ".htm";
	objectitem.style.cssText = "width:100%; height:"+ SectionHeight + "px";
	objectitem.setAttribute("src", attrib);
	objectitem.frameBorder = 0;
SubChapterSection.appendChild(objectitem);
}


function ShowProcedures(ProcedureNo, SectionHeight) {

var ProcedureSection = parent.document.getElementById("ProcedureSection");

while(ProcedureSection.firstChild)ProcedureSection.removeChild(ProcedureSection.firstChild)
	var objectitem = document.createElement("iframe");
	attrib = "HTMLs/Procedure" + ProcedureNo + ".htm";
	objectitem.style.cssText = "width:100%; height:"+ SectionHeight + "px";
	objectitem.setAttribute("src", attrib);
	objectitem.frameBorder = 0;
ProcedureSection.appendChild(objectitem);
}

window.onload = loadIndex;


function loadIndex() { // load indexfile
// most current browsers support document.implementation
	if (document.implementation && document.implementation.createDocument) {
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.load("HS_Codes_EL.xml");
	}
// MSIE uses ActiveX
	else if (window.ActiveXObject) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async = "false";
		xmlDoc.load("HS_Codes_EL.xml");
	}
}

function FindProcedures(SubChapterNo, Language, SectionHeight) {
	if (!xmlDoc) {
		loadIndex();
	}

var ProcedureSection = parent.document.getElementById("ProcedureSection");
var Chapter_lmnt = xmlDoc.getElementsByTagName("HS_Chapter");
var SubChapter_lmnt = xmlDoc.getElementsByTagName("HS_SubNumber");
var text_lmnt = xmlDoc.getElementsByTagName("HS_SubNumber_Title_EL");


while(ProcedureSection.firstChild)ProcedureSection.removeChild(ProcedureSection.firstChild)

ProcedureSection.style.cssText = "width:100%; overflow:auto; height:"+ SectionHeight + "px";

	for (i = 0; i < Chapter_lmnt.length; i++) {
		if (Chapter_lmnt[i].firstChild.nodeValue == SubChapterNo) {
			var listitem = document.createElement("div");
			listitem.style.cssText = "font-weight:bold";

			var SubChapteritem = document.createTextNode(SubChapter_lmnt[i].lastChild.nodeValue);
			var textitem = document.createTextNode(": ");
			if (navigator.appName=="Microsoft Internet Explorer") {
				var SubtitleDiv = parent.document.createElement("div");}
			if (navigator.appName!="Microsoft Internet Explorer") {
				var SubtitleDiv = document.createElement("div");}
			SubtitleDiv.innerHTML = text_lmnt[i].lastChild.nodeValue;
			SubtitleDiv.style.cssText = "font-weight:normal; margin-left:85px; margin-top:-18px";

			ProcedureSection.appendChild(listitem);
			listitem.appendChild(SubChapteritem);
			listitem.appendChild(textitem);
			listitem.appendChild(SubtitleDiv);
		}
	}

}

