function displayNewsArchive(year, month, day) {
	var callback = function(data) {
		document.getElementById("newsarchive").innerHTML = data; 
	}
	getViaAjax(ajaxPath + 'get_nieuws_archief.php?func=newsarchive&year='+year+'&month='+month+'&day='+day, callback);
}

function displayDateFilter(year, month, day) {
        var callback = function(data) {
                document.getElementById("datefilter").innerHTML = data;
        }
        getViaAjax(ajaxPath + 'get_nieuws_archief.php?func=datefilter&year='+year+'&month='+month+'&day='+day, callback);
}

function setPageTitle(indicText, year, month, day) {
	var currentTitle = document.title;
	var breakPos = currentTitle.indexOf(indicText);
	if (breakPos >= 0) {
		var newTitle = currentTitle.substring(0, breakPos);
	} else {
		var newTitle = currentTitle;
	}
	if (year) newTitle += indicText + year;
	if (month) newTitle += "-" + (month < 10 ? "0" + month : month);
	if (day) newTitle += "-" + (day < 10 ? "0" + day : day);
	document.title = newTitle + " | " + siteNaam;
}

function dateChanged() {
	var year = document.getElementById("year").value;
	var month = document.getElementById("month").value;
	var day = document.getElementById("day").value;
	if ((day > 0) && (month == 0)) day = 0;
	setPageTitle("Nieuws-archief ", year, month, day);
	// only the last one will be executed in IE, so make it the newsarchive. To bad for IE users: they can't select particulair days...
	displayDateFilter(year, month, day);
	displayNewsArchive(year, month, day);
}
