﻿// File JScript

function loadXML(ok, Er, Bu, url, onComplete, onTimeOut, onError, async){

    if (async == undefined) async = true;
    var xmlhttp = null;
    var isIE = false;
    function state_Change(){    
        var xmlData;

        // readyState = 0 Object is not initialized // 1 Loading object is loading data // 2 Loaded object has loaded data // 3 Data from object can be worked with // 4 Object completely initialized
        if (xmlhttp.readyState==4)
          if (xmlhttp.status!=200){
            if(onError != undefined)
                onError();
            else
                feedback.run(ok, Er, Bu, url + "<br><br>" + xmlhttp.responseText, 3);
            return false;
          }
          else{
            onComplete(xmlhttp.responseXML.documentElement);
            
            return true;
          }
        else
            return false;
    }

    if (window.ActiveXObject){ // code for IE
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")    
      isIE = true;
    }
    else if (window.XMLHttpRequest) // code for Mozilla, etc.
      xmlhttp=new XMLHttpRequest()

    if (xmlhttp!=null){
      xmlhttp.onreadystatechange = state_Change;
      xmlhttp.open("GET",url,async);
      xmlhttp.send(null);
    }
    else
      alert("Your browser does not support XMLHTTP.")
}
