<!--
var ajaxBaseURL = "/";
function ajax() {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		/*if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');

		}*/
	} else if (window.ActiveXObject) { // IE
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return http_request;
}
var prevImgName = '';
function getNewsIndex(sectID, imgName) {
	resetAllIndexImage();
	var aj = new ajax();
	var img = document.getElementById("img_index_title_" + imgName);
	img.src = "images/index_btn_" + imgName + "_f2.gif";

	aj.onreadystatechange = function() {
		if (aj.readyState == 4) {
			if (aj.status == 200) {
				var xmldoc = aj.responseXML.documentElement;
				var root_node = xmldoc.getElementsByTagName('news');
				//alert(root_node[1].getElementsByTagName("date")[0].childNodes[0].nodeValue);
					
				if (root_node != null) {
					var str = '<table width="100%" border="0" cellspacing="0" cellpadding="4" class="index">';
					for (i=0; i<root_node.length; i++ ) {
//						var d = root_node.childNodes.item(i);
						var d = root_node[i];
						//alert(d.childNodes.item(0));
						//alert(d.getElementsByTagName("url")[0].childNodes.length);
						if (d.getElementsByTagName("url"))
						{
							if (d.getElementsByTagName("url")[0].childNodes.length > 0) {
								if (d.getElementsByTagName("isNews")[0].childNodes[0].nodeValue == "true") {
									url = "javascript:goNewsPopup('"+d.getElementsByTagName("url")[0].childNodes[0].nodeValue+"')";
								} else {
									url = d.getElementsByTagName("url")[0].childNodes[0].nodeValue;
								}
							} else {
								url = "";
							}
							
						} else {
							url = "";
						}
						str += '<tr valign="top">';
						if (d.getElementsByTagName("pic")[0].childNodes[0] != null) {
							str += '<td width="50" class="news">';
							if (url != "") {
								str += '<a href="'+url+'"><img src="' + d.getElementsByTagName("pic")[0].childNodes[0].nodeValue + '" id="pic" width="50" height="50" border="0"></a>';
							} else {
								str += '<img src="' + d.getElementsByTagName("pic")[0].childNodes[0].nodeValue + '" id="pic" width="50" height="50">';
							}
							str+= '</td>';
						}
						if (d.getElementsByTagName("topic")[0].childNodes[0]) {				
							if (url != "") {
								link = '<a href="'+url+'" class="news">' + d.getElementsByTagName("topic")[0].childNodes[0].nodeValue + '<br>' + d.getElementsByTagName("date")[0].childNodes[0].nodeValue  + '</a>';
							} else {
								link = d.getElementsByTagName("topic")[0].childNodes[0].nodeValue + '<br>' + d.getElementsByTagName("date")[0].childNodes[0].nodeValue;
							}
							str += '<td class="news">'+ link + '</td>';
						}
						str += '</tr>';
					}
					
					str += '</table>';
				} else {
					str = '';
				}
				document.getElementById("indexNews").innerHTML = str;
				/*
				document.getElementById("topic").innerHTML = root_node.childNodes.item(1).firstChild.nodeValue;
				document.getElementById("pic").innerHTML = root_node.childNodes.item(2).firstChild.nodeValue;
				*/
			} else {
				alert('There was a problem with the request.');
			}
		}
	}
	aj.open('GET', ajaxBaseURL + 'latestnewsxml.php?sectID=' + sectID, true);
	aj.send(null);
}

function resetAllIndexImage() {
	for (i=0; i<imgArray.length; i++)
	{
		var img = document.getElementById("img_index_title_" + imgArray[i]);
		img.src = "images/index_btn_" + imgArray[i] + ".gif";
	}
}
//-->