/* ----------------------------------------------------------------- */
/* ajax */
var xmlHttp;
var thisText;
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function openPage(mid) {
	document.getElementById('entry_bodytext').innerHTML='<div style="text-align:center">Loading...</div>';
	if (!mid.match(/id/)) { mid='id='+mid; }

    createXMLHttpRequest();
    xmlHttp.onreadystatechange = loadPage;
    xmlHttp.open("POST", 'http://starblood.com/tc/_sb/readxml.php', true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
    xmlHttp.send(mid);
}

function loadPage() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			showPage();
        }
	}
	else if(xmlHttp.readyState == 1) {
// Loading
	}
}
function showPage() {
	var thisRead=xmlHttp.responseXML;
	if (thisRead.getElementsByTagName("pageset")[0]) {
		var parseRead=thisRead.getElementsByTagName("pageset")[0].childNodes;
	}
	else {
		alert('에러.');
	}
	var bodytext='';
	for(var i = 0; i < parseRead.length; i++) {
		tkey=parseRead[i].tagName;
		if (parseRead[i].firstChild) {
			eval(tkey+'=parseRead[i].firstChild.nodeValue;');
		}
		else {
			eval(tkey+'="";');
		}
	}

	document.getElementById('entry_bodytext').innerHTML=bodytext;
}

/* ----------------------------------------------------------------- */

