// ajaxMenu

var htmlConnection = createXMLHttp();

function createXMLHttp(){
  var ret = null;
  browserIE = false;
  if (window.ActiveXObject){
    ret = new ActiveXObject('Microsoft.XMLHTTP');
    browserIE = true;
  }
  else if(window.XMLHttpRequest){
    ret = new XMLHttpRequest();
  }
  return ret;
}

var resultFunction = null;
//var errorFunction = null;

function GetUrl(url, resultFunc){
  resultFunction = resultFunc;
  //errorFunction = errorFunc;
  if(htmlConnection!=null)
  {
    if(browserIE==true){
      htmlConnection.open('GET', url, true);
      htmlConnection.setRequestHeader('Content-Type', "text/xml; charset=UTF-8");
      htmlConnection.onreadystatechange = stateHandler;
      htmlConnection.send(null);
    }
    else{
      htmlConnection.onreadystatechange = stateHandler;
      htmlConnection.open('GET', url, true);
      htmlConnection.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
      htmlConnection.send(null);
    }
  }
}
    
function stateHandler(){
  if (htmlConnection.readyState == 4){
    if (htmlConnection.status != null && htmlConnection.status == 200){
      if(resultFunction!=null){
        resultFunction();
      }
    }
  }
  //if(errorFunction!=null){
  //  errorFunction();
  //}
}

function GetResultXML(){
  //alert(htmlConnection.responseXML);
  //alert(htmlConnection.responseXML.documentElement);
  return htmlConnection.responseXML.documentElement;
}
 
function GetResultText(){
  return htmlConnection.responseText;
}