﻿//====================================================================
//  書き換え対象のID
  var target = "sidecontent";

//====================================================================
// HTTP通信用、共通関数
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;
}

//====================================================================
// document.getElementById
function __$(tagId){
	return document.getElementById(tagId);
}

//====================================================================
function get_response_text ( req ) {
  var text = req.responseText;
  if ( navigator.appVersion.indexOf( "KHTML" ) > -1 ) {
    var esc = escape( text );
    if ( esc.indexOf("%u") < 0 && esc.indexOf("%") > -1 ) {
      text = decodeURIComponent( esc );
    }
  }
return text;
}

//====================================================================
function loadHTMLFile(fName){
	httpObj = createXMLHttpRequest(displayData);
	if (httpObj){
		httpObj.open("GET",fName,true);
		httpObj.send(null);
	}
}

//====================================================================
function displayData(){
	if ((httpObj.readyState == 4) && (httpObj.status == 200))	{
		__$(target).innerHTML = get_response_text(httpObj);

	}else{
		__$(target).innerHTML = "読み込み中…";
	}
}
//====================================================================
