/*
ƱEǥƥȥեEɤ߹
(c)Sapphirus.Biz

HTMLбEidդ֥åѰդƲ
Ex.) <div id="text-doc">Loading...</div>
ɤ߹ߤɬפʬ
loadDocFile('textfile.txt', 'text-doc');
EsetOnload() ˵ҤƲ
*/

// եEɤ߹
function setOnload() {
	// loadDocFileʥեE, id
	loadDocFile('data.html', 'data1');
	loadDocFile('osusume1.html', 'osusume1');
	loadDocFile('osusume2.html', 'osusume2');
	loadDocFile('osusume3.html', 'osusume3');
	loadDocFile('osusume4.html', 'osusume4');
	loadDocFile('osusume5.html', 'osusume5');
	loadDocFile('osusume6.html', 'osusume6');
	loadDocFile('osusume7.html', 'osusume7');
	loadDocFile('osusume8.html', 'osusume8');
}
if (window.addEventListener) window.addEventListener('load', setOnload, false);
if (window.attachEvent) window.attachEvent('onload', setOnload);


// HTTP̿ǥɥȤƽ
var targetObj = new Array();
function createXMLHttpRequest(cbFunc) {
	var XMLhttpObject = null;
	try {
		XMLhttpObject = new XMLHttpRequest();
	} catch(e) {
		try {
			XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				return null;
			}
		}
	}
	if (XMLhttpObject) XMLhttpObject.onreadystatechange = cbFunc;
	return XMLhttpObject;
}
function loadDocFile(fName, idName) {
	targetObj[idName] = createXMLHttpRequest(function() { 
		document.getElementById(idName).innerHTML = ((targetObj[idName].readyState == 4) && (targetObj[idName].status == 200)) ? targetObj[idName].responseText : '<p class="loading">Loading...</p>';
	});
	if (targetObj[idName]) {
		targetObj[idName].open("GET", fName, true);
		targetObj[idName].send(null);
	}
}

