// Everything which is to be executed only after the page has finished loading its content
window.addEvent('domready', function() {

	// The page has been set to "visibility: hidden" to allow the initialization of
	// the accordion tree menu on certain pages, without the user seeing a flash of all
	// the togglers collapsed in IE7; after the page has finished loading, turn it visible
	$('container').setStyle('visibility', 'visible');

	
	// Hide the last background image in the footer menu (the separation vertical line)
	if ($("footermenu")) {
		//De eerste a een andere class geven
		var aFooterListItems = $("footermenu").getElementsByTagName('li');
		aFooterListItems[(aFooterListItems.length - 1)].className = 'last';
	}


	// Showing the language menu
	var bClick = false;
	$('langToggle').addEvent('click', function() {
		if (!bClick) {
			$('ulLanguage').setStyle('display', 'inline');
			bClick = true;
		} else {
			$('ulLanguage').setStyle('display', 'none');
			bClick = false;
		}
	});
	$('langToggleImg').addEvent('click', function() {
		if (!bClick) {
			$('ulLanguage').setStyle('display', 'inline');
			bClick = true;
		} else {
			$('ulLanguage').setStyle('display', 'none');
			bClick = false;
		}
	});


	// Dealing with mouseover and mouseout for the language flags
	for (iCnt = 0; iCnt < 3; iCnt++) {
		$('flag' + iCnt).addEvent('mouseover', function() {
			this.setStyle('border', '1px solid #FFCC00');
		});
		$('flag' + iCnt).addEvent('mouseout', function() {
			this.setStyle('border', '1px solid #48463a');
		});
	}
});

//contact formulier check
function inputCheck() {
	var validation = 0;
	//if (fieldIsEmpty('geslacht_m', 'Aanhef is een verplicht veld')) validation++;
	if (fieldIsEmpty('name', 'Naam is een verplicht veld')) validation++;
	if (validate_email('email', 'E-mail is een verplicht veld')) validation++;
	if (fieldIsEmpty('phone', 'Telefoon is een verplicht veld')) validation++;
	if (fieldIsEmpty('comment', 'Commentaar is een verplicht veld')) validation++;

	if (validation == 0 || validation == undefined) { //no errors occured, so submit the form
		return true;
	} else {
		return false;
	}
}