function newXMLHttpRequest() {
    //alert("in newXMLHttpRequest()");
    var xmlreq = false;
    if (window.XMLHttpRequest) {
        // Create XMLHttpRequest object in non-Microsoft browsers
        xmlreq = new XMLHttpRequest();
    } 
    else if (window.ActiveXObject) {
        // Create XMLHttpRequest via MS ActiveX
        try {
            // Try to create XMLHttpRequest in later versions
            // of Internet Explorer
            xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e1) {
            // Failed to create required ActiveXObject
            try {
            // Try version supported by older versions
            // of Internet Explorer
            xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e2) {
            // Unable to create an XMLHttpRequest with ActiveX
            }
        }
    }
    return xmlreq;
}      
function getReadyStateHandler(req, responseXmlHandler) {
  //alert("in getReadyStateHandler(req, responseXmlHandler)");
  // Return an anonymous function that listens to the 
  // XMLHttpRequest instance
  return function () {

    // If the request's status is "complete"
    if (req.readyState == 4) {
      
      // Check that a successful server response was received
      if (req.status == 200) {

        // Pass the XML payload of the response to the 
        // handler function
        responseXmlHandler(req.responseXML);

      } else {

        // An HTTP problem has occurred
        alert("HTTP error: "+req.status+" "+req.statusText);
      }
    }
  }
}
function colorLink() {
}
function showData(page,co) {
	if (document.getElementById('load') != null) {
		document.getElementById('load').style.display = "block";
	}
    var div = document.getElementById(co);   
	//smazeme potomky
	while (div.hasChildNodes()) {
		div.removeChild(div.childNodes.item(0));
	}
   
	var xmlhttp = newXMLHttpRequest();      
	xmlhttp.open("GET", "xml/"+page+".xml",true);
	xmlhttp.setRequestHeader("encoding", "UTF-8");	
	//Some Mozillas don't work if response has no XML mime-type header
	if(xmlhttp.overrideMimeType) {
		xmlhttp.overrideMimeType('text/xml');
	}
    xmlhttp.setRequestHeader("Content-Type","text/xml");
	xmlhttp.onreadystatechange=function() {
		// If the request's status is "complete"
		if (xmlhttp.readyState == 4) {		  
			// Check that a successful server response was received
			if (xmlhttp.status == 200) {
				// Pass the XML payload of the response to the 
				div.innerHTML = xmlhttp.responseText;
				if (document.getElementById('load') != null) {
					document.getElementById('load').style.display = "none";
				}
			} else {
				// An HTTP problem has occurred
				alert("HTTP error: "+xmlhttp.status+" "+xmlhttp.statusText);
			}	
		}
	}
	 xmlhttp.send(null)	
}
