Rnd = Math.floor(Math.random()*1000);
var news = "./xml/news.xml?"+Rnd;
Rnd = Math.floor(Math.random()*1000);
var pic = "./xml/pic.xml?"+Rnd;
function loadTOPICFile()
{
	topicObj = createXMLHttpRequest(Topic);
	if (topicObj)
	{
		topicObj.open("GET",news,true);
		topicObj.send(null);
	}
	picupObj = createXMLHttpRequest(Picup);
	if (picupObj)
	{
		picupObj.open("GET",pic,true);
		picupObj.send(null);
	}
}
function Topic()
{
	if ((topicObj.readyState == 4) && (topicObj.status == 200))
	{
		xmlData = topicObj.responseXML;
		ArtListTags = xmlData.getElementsByTagName("Article");
		DateListTags = xmlData.getElementsByTagName("date");
		CompListTags = xmlData.getElementsByTagName("compname");
		CompidListTags = xmlData.getElementsByTagName("compid");
		userLen = ArtListTags.length;
		resultText = "";
		for(i=0; i<userLen; i++){
			if(i < 5){
				day = DateListTags[i].firstChild.nodeValue;
				comp = CompListTags[i].firstChild.nodeValue;
				compid = CompidListTags[i].firstChild.nodeValue;
				resultText = 'UPDATE:'+day + '  <a href="search_db.cgi?mode=com&CompID=' + compid + '">' + comp + "</a>";
			}
		}
		$("PICUP").innerHTML = resultText;
	}else{
		$("PICUP").innerHTML = "<b>Loading...</b>";
	}
}

function Picup()
{
	if ((picupObj.readyState == 4) && (picupObj.status == 200))
	{
		xmlData = picupObj.responseXML;
		ArtaListTags = xmlData.getElementsByTagName("MESSEG");
		DatesListTags = xmlData.getElementsByTagName("date");
		TitleListTags = xmlData.getElementsByTagName("title");
		LinkListTags = xmlData.getElementsByTagName("linkfile");
		userLens = ArtaListTags.length;
		resultTexts = "";
		for(i=0; i<userLens; i++){
			if(i < 10){
				days = DatesListTags[i].firstChild.nodeValue;
				titles = TitleListTags[i].firstChild.nodeValue;
				Linkf = LinkListTags[i].firstChild.nodeValue;
				resultTexts = resultTexts+'UPDATE:' + days + '  <a href="' + Linkf + '">' + titles + '</a>　';
			}
		}
		$("TOPIC").innerHTML = resultTexts;
	}else{
		$("TOPIC").innerHTML = "<b>Loading...</b>";
	}
}

