
function createXmlHttp(){
    if (window.XMLHttpRequest) {             // Mozilla, Firefox, Safari, IE7
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {       // IE5, IE6
        try {
            return new ActiveXObject("Msxml2.XMLHTTP");    // MSXML3
        } catch(e) {
            return new ActiveXObject("Microsoft.XMLHTTP"); // MSXML2まで
        }
    } else {
        return null;
    }
}


function requestXmlHttp(url, onRead){

  onRead = onRead ? onRead : null;

  /* XML通信オブジェクトを作成 */
  var xmlhttp = createXmlHttp();
  if (xmlhttp == null) {
  //    window.alert("XMLHttpRequest非対応のブラウザです。");
  }

  if (xmlhttp) {
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        // パネルにHTMLを設定
      	if(onRead!=null) onRead(xmlhttp);
      }
    }
    xmlhttp.open('GET', url, true);
    xmlhttp.send('');
  }

}

function postXmlHttp(url, postdata, onRead){

  /* XML通信オブジェクトを作成 */
  var xmlhttp = createXmlHttp();
  if (xmlhttp == null) {
  //    window.alert("XMLHttpRequest非対応のブラウザです。");
  }

  if (xmlhttp) {
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        // パネルにHTMLを設定
      	if(onRead!=null) onRead(xmlhttp);
      }
    }
    xmlhttp.open('POST', url, true);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send(postdata);
  }

}
