// 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 project afbeeldingen
function loadProduct(id)
{
    // We gaan de box openen
    $('innerBox').innerHTML = '<div style="text-align:center;"><img src="/images/ajax-loader.gif" alt="Loading..." title="Loading..." border="0" /></div>';
    $('overlayer').style.display = 'block';
    $('infobox').style.display = 'block';

    // We gaan de request string maken
	var http = ajaxinit();
    var str = "getProduct=true&id=" + id;
	if(http)
	{
		http.open('POST','/index.php?ajax=1',true);
		http.setRequestHeader('Content-Type','application/x-www-form-urlencoded;');
		http.onreadystatechange = function() {
			if (http.readyState == 4)
			{
				if (http.status == 200)
				{
					$('innerBox').innerHTML = http.responseText; // responseXML
				} else {
					alert("There was a problem retrieving the XML data:\n" + http.statusText);
					return false;
				}
			}
		}
		http.send(str);
	}
}

// Functie voor het sluiten van het product
function closeProduct()
{
    // We gaan de box sluiten
    $('overlayer').style.display = 'none';
    $('infobox').style.display = 'none';
    $('innerBox').innerHTML = '';
}
