/*--- AJAX Tools ---*/



var W3CDOM = (document.createElement && document.getElementsByTagName);






/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

var req = null;
var onloadXMLfunction = null;

function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            xmlDoc = req.responseXML;
            onloadXMLfunction();
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}



function loadXML(xmlfile,onloadXML){
	// code for IE
	if (window.ActiveXObject){
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		xmlDoc.load(xmlfile);
		window[onloadXML]();
	}
	// code for Mozilla, Firefox, Opera, etc.
	else if (document.implementation && document.implementation.createDocument){
		req = new XMLHttpRequest();
		onloadXMLfunction = window[onloadXML];

		req.onreadystatechange = processReqChange;
		req.open("GET", xmlfile, true);
		req.send("");


		/*alert('load test 3');

		xmlDoc=document.implementation.createDocument("","",null);
		xmlDoc.load(xmlfile);
		xmlDoc.onload=window[onloadXML];*/
	}else{
		alert("Din browser underst?tter ikke de n?dvendige krav");
	}
	
}




function getCdata(obj){
	for(var i=0; i<obj.length; i++){
		if(obj[i].nodeType == 4)
			return obj[i].nodeValue;
	}
	return false;
}



