var xDoc;

function verifySupport(xFile) {
	if (document.implementation && document.implementation.createDocument) {
		xDoc = document.implementation.createDocument("", "theXdoc", null);
	} else if (typeof ActiveXObject != "undefined") {
		if (document.getElementById("msxml").async) {
			xDoc = new ActiveXObject("Msxml.DOMDocument");
		}
	}
	if (xDoc && typeof xDoc.load != "undefined") {
		xDoc.load(xFile);
		return true;
	} else {
		alert("このブラウザではXMLをサポートしていませんので" +
			"越後雪かき道場ブログの最新記事が表示されません");
	}
	return false;
}

function drawTable(tbody) {
	var li, a, i, j, oneRecord;
	tbody = document.getElementById(tbody);
	var data = xDoc.getElementsByTagName("rdf:RDF")[0];
	var maxLength = data.getElementsByTagName("item").length;
	if(maxLength > 5) maxLength = 5;
	for (i = 0; i < maxLength; i++) {
		if (data.getElementsByTagName("item")[i].nodeType == 1) {
			oneRecord = data.getElementsByTagName("item")[i];
			li = document.createElement("li");
			li.className ="widget-list-blog";
			a = document.createElement("a");
			a.href = oneRecord.getElementsByTagName("link")[0].firstChild.nodeValue;
			a.setAttribute("title", oneRecord.getElementsByTagName("description")[0].firstChild.nodeValue);
			a.innerHTML = oneRecord.getElementsByTagName("title")[0].firstChild.nodeValue;
			li.appendChild(a);
			tbody.appendChild(li);
		}
	}
}

function initXml(xFile) {
	if (verifySupport(xFile)) {
		setTimeout("drawTable('matchData')", 1000);
	}
}


