// Functie voor het aanmaken van het ajax object
function ajaxinit()
{
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}

  	return xmlhttp;
}

// Functie voor ophalen van de projecten
function loadProjects(count, id)
{
    // We gaan de request string maken
    var http = ajaxinit();
    if(http)
    {
        http.open('GET','/index.php?page=projecten&ajax=1&type=rightList&start=' + count + '&id=' + id,true);
        http.onreadystatechange = function() {
            if (http.readyState == 4)
            {
                if (http.status == 200)
                {
                    response = http.responseText;
                    document.getElementById("right-items").innerHTML = response;
                } else {
                    alert("There was a problem retrieving the XML data:\n" + http.statusText);
                    return false;
                }
            }
        }
        http.send(0);
    }
}

// Functie voor ophalen van de project afbeeldingen
function loadProjectImages(count, id)
{
    // We gaan de request string maken
    var http = ajaxinit();
    if(http)
    {
        http.open('GET','/index.php?page=projecten&ajax=1&type=imageList&id=' + id + '&start=' + count,true);
        http.onreadystatechange = function() {
            if (http.readyState == 4)
            {
                if (http.status == 200)
                {
                    response = http.responseText;
                    document.getElementById("topimage").innerHTML = response;
                } else {
                    alert("There was a problem retrieving the XML data:\n" + http.statusText);
                    return false;
                }
            }
        }
        http.send(0);
    }
}
