function test(txt)
{
alert(txt);
}

//Pre-load images
Image1= new Image(32,32);
Image1.src = "/includes/images/loading.gif";
var eid = null;
var succes = false;
var teller = 0;


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function stateChanged(xmlHttp,eid) {
	if (xmlHttp.readyState==4){
		if ((xmlHttp.responseText != "false") ) {
			document.getElementById(eid).innerHTML=xmlHttp.responseText;
		}
	}
}

function stateChanged200(xmlHttp,eid,funcfail) {
	if (xmlHttp.readyState==4){
		if ((xmlHttp.responseText != "false") && xmlHttp.status == 200 ) {
		    if (xmlHttp.responseText == null) {
			xmlHttp.responseText = "";
		    }
			document.getElementById(eid).innerHTML=xmlHttp.responseText;
		}
		else
		{
			funcfail();
		}
	}
}

//Haal pagina op
// eid = element id
// req200 = require HTTP status 200
function getPage(url1,eid,loading,req200,funcfail){ 
	this.url1 = url1;
	this.eid = eid;	
	this.loading = loading;
	this.req200 = req200;
	this.funcfail = funcfail;
	
	if(!this.loading){
		this.loading = false;
	}
	if(this.loading){
		document.getElementById(this.eid).innerHTML = "<img src='/includes/images/loading.gif'>";
	}
	
	var xmlHttp=GetXmlHttpObject();
	this.xmlHttp = xmlHttp;
	
	if(!this.req200){
		this.xmlHttp.onreadystatechange = function () { with (this) stateChanged(xmlHttp,eid); };
	} else {
		// HTTP Status 200 vereist om element update te doen
		this.xmlHttp.onreadystatechange = function () { with (this) stateChanged200(xmlHttp,eid,funcfail); };
	}
	
	this.xmlHttp.open("GET",url1,true);
	this.xmlHttp.send(null);

	//Set debug info
	//document.getElementById('ajax_debug').innerHTML += url1+'<br />';

	//lert(succes);

}

