//retrieve.js
    function makeXmlHttp() {
        var xmlhttp = false;
        if(window.XMLHttpRequest){
        xmlhttp = new XMLHttpRequest();
        }
        else{
            try{
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                window.alert("Some page functionality is unavailable!");
            }
        }
        return xmlhttp;
    }
    
    function retrieve_data(pagina) {
    	var indicator = document.getElementById("indicator").style;
        var xmlhttp = makeXmlHttp();
        loc = document.location.href;
		splitted = loc.split("#");
		if (pagina == null && splitted[1] == null) {
  			pagina = 'home';
		}
        else if ((splitted[1] != null) && (pagina == null)) {
			pagina = splitted[1];
		}
		else {
			pagina = pagina;
		}
        xmlhttp.open('get', './'+pagina+'.php', true);
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState == 4) {
            	indicator.display = "none";
                document.getElementById('content').innerHTML = xmlhttp.responseText;
                document.getElementById('link').innerHTML = '<img src="images/link.jpg"> <a href="http://www.12-09-1944.nl/#'+pagina+'">http://www.12-09-1944.nl/#'+pagina+'</a> (link naar deze pagina)';
                if (pagina != 'home') {
                    document.getElementById('back').innerHTML = '<p><a href="javascript: retrieve_data(\'home\')"><img src="images/back.png" border="0"></a></p>';
                }
                else {
                	document.getElementById('back').innerHTML = '';
                }
            }
        }
        indicator.display = "block";
        xmlhttp.send('');
    }
    
    function retrieve_data_en(page) {
    	var indicator = document.getElementById("indicator").style;
        var xmlhttp = makeXmlHttp();
        loc = document.location.href;
		splitted = loc.split("#");
		if (page == null && splitted[1] == null) {
  			page = 'home_en';
		}
        else if ((splitted[1] != null) && (page == null)) {
			page = splitted[1];
		}
		else {
			page = page;
		}
        xmlhttp.open('get', './'+page+'.php', true);
        xmlhttp.onreadystatechange = function() {
            if(xmlhttp.readyState == 4) {
            	indicator.display = "none";
                document.getElementById('content').innerHTML = xmlhttp.responseText;
                document.getElementById('link').innerHTML = '<img src="images/link.jpg"> <a href="http://www.12-09-1944.nl/#'+page+'">http://www.12-09-1944.nl/#'+page+'</a> (link naar deze pagina)';
                if (page != 'home_en') {
                    document.getElementById('back').innerHTML = '<p><a href="javascript: retrieve_data_en(\'home_en\')"><img src="images/back.png" border="0"></a></p>';
                }
                else {
                	document.getElementById('back').innerHTML = '';
                }
            }
        }
        indicator.display = "block";
        xmlhttp.send('');
    }
    
    
    //Gastenboek
    function POSTRequest(query) {
    	var indicator = document.getElementById("indicator").style;
        var xmlhttp = makeXmlHttp();
    
    	var url = "guestbook/toevoegen.php";
   
    	xmlhttp.open("POST", url, true);
    	xmlhttp.onreadystatechange = function() {
    	if(xmlhttp.readyState == 4) {
            	indicator.display = "none";
                document.getElementById('content').innerHTML = xmlhttp.responseText;
                document.getElementById('link').innerHTML = '<img src="images/link.jpg"> <a href="http://www.12-09-1944.nl/#'+pagina+'">http://www.12-09-1944.nl/#'+pagina+'</a> (link naar deze pagina)';
            }
    	}
        indicator.display = "block";
    	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");    
    	xmlhttp.send(query);
	}
	
	function GETRequest(query) {
    	var indicator = document.getElementById("indicator").style;
        var xmlhttp = makeXmlHttp();
          
    	var queryString = "guestbook/lees.php?" + query;
    
    	xmlhttp.onreadystatechange = function() {
    	if(xmlhttp.readyState == 4) {
            	indicator.display = "none";
                document.getElementById('content').innerHTML = xmlhttp.responseText;
                document.getElementById('link').innerHTML = '<img src="images/link.jpg"> <a href="http://www.12-09-1944.nl/#'+pagina+'">http://www.12-09-1944.nl/#'+pagina+'</a> (link naar deze pagina)';
            }
    	}
        indicator.display = "block";
    	xmlhttp.open("GET", queryString, true);
    	xmlhttp.send(null);
}