var newEl
var sVersion="Eng"
function DoInit() {

	document.frmCategory.selCategory.options(0).selected=true

	sVersion=document.frmCategory.txtVersion.value

	FooterLink(sVersion);
}
function OpenSysReq() {

		if (sVersion=="Eng") {
			sDoc="SystemReq.html"
		}
		else {
			sDoc="SystemReq_c.html"
		}

window.open(sDoc,null,"height=300,width=500,status=yes,toolbar=no,menubar=no,location=no");

}
function ChgPic(iIndex) {
	var sPicture

	switch (iIndex) {
		case 1:
			sPicture="product/PicBuilding.gif"
		break;
		case 2:
			sPicture="product/PicLycal.gif"
		break;
		case 3:
			//sPicture="product/PicElectric.gif"
			sPicture="product/PicHaoly.gif"
		break;
		case 4:
			sPicture="product/PicBattery.gif"
		break;
		default:
			sPicture="product/PicHaoly.gif"
		break;
	}

	document.PicProduct.src=sPicture
}
function importXML()
{

	if (document.getElementById('writeroot').hasChildNodes()) {
		document.getElementById('writeroot').removeChild(newEl)
	}

	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = init;
		
		
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = tmp;
		
		
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}


	var iIndex=document.frmCategory.selCategory.selectedIndex;

	if (sVersion=="Eng") {
		switch (iIndex) {
			case 1:
			xmlDoc.load("ProBuilding.xml");
			break;
			case 2:
			xmlDoc.load("ProLycal.xml");
			break;
			case 3:
			xmlDoc.load("ProElectronic.xml");
			break;
			case 4:
			xmlDoc.load("ProBattery.xml");
			break;
		}
	}
	else {

		switch (iIndex) {
			case 1:
			xmlDoc.load("ProBuilding_c.xml");
			break;
			case 2:
			xmlDoc.load("ProLycal_c.xml");
			break;
			case 3:
			xmlDoc.load("ProElectronic_c.xml");
			break;
			case 4:
			xmlDoc.load("ProBattery_c.xml");
			break;
		}
	}
	showPS(iIndex)
}

function showPS(iNum) {
	if (iNum!=0) {
		document.all.PDFIntro.style.display=""
	}
	else {
		document.all.PDFIntro.style.display="none"
	}

}

function tmp() {
	if (xmlDoc.readyState == 4) {
		init();
		
	}
}


function init()
{

	var y = xmlDoc.getElementsByTagName('Name');
	var x = xmlDoc.getElementsByTagName('Material');
	var colno=5;

	newEl = document.createElement('TABLE');
	newEl.setAttribute('cellPadding',5);
	newEl.setAttribute('border',1);
	newEl.setAttribute('width',"100%");
	var tmp = document.createElement('TBODY');

	newEl.appendChild(tmp);
	var row = document.createElement('TR');
		

	for (j=0;j<y[0].childNodes.length;j++)
	{
		if (y[0].childNodes[j].nodeType != 1) continue;
		var container = document.createElement('TH');
			container.setAttribute('align','left');
			container.setAttribute("bgColor","#aaaaaa");					
		var theData = document.createTextNode(y[0].childNodes[j].firstChild.nodeValue);
		container.appendChild(theData);
		row.appendChild(container);
	}
	tmp.appendChild(row);

	for (i=0;i<x.length;i++)
	{
		var row = document.createElement('TR');
		var COL=1;
		
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var container = document.createElement('TD');

			if (document.implementation && document.implementation.createDocument) {
					var iNum=7
				} 
				else if (window.ActiveXObject) {
					var iNum=3
				}
			
 			if (COL==4) {

				var slink=document.createElement("A") 						
	slink.setAttribute("href","Spec/"+sVersion+"/"+x[i].childNodes[iNum].firstChild.nodeValue+".pdf")			
					slink.setAttribute("target","_blank")
				var theData = document.createTextNode("[.pdf] / ");
				slink.appendChild(theData)
				container.appendChild(slink);
				row.appendChild(container);
								
				var slink=document.createElement("A") 						
	slink.setAttribute("href","Spec/"+sVersion+"/"+x[i].childNodes[iNum].firstChild.nodeValue+".doc")			
					slink.setAttribute("target","_blank")
				var theData = document.createTextNode(" [.doc]");
				slink.appendChild(theData)
				container.appendChild(slink);
				row.appendChild(container);

			}
			else if (COL==1) {
				var slink=document.createElement("A") 						
	slink.setAttribute("href","Spec/"+sVersion+"/"+x[i].childNodes[iNum].firstChild.nodeValue+".pdf")			
					slink.setAttribute("target","_blank")
				var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
				slink.appendChild(theData)
				container.appendChild(slink);
				row.appendChild(container);
			}
			else {
				var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
				container.appendChild(theData);
				row.appendChild(container);
			}
			COL++;
		}
		tmp.appendChild(row);
	}

	document.getElementById('writeroot').appendChild(newEl);	

}
