var xmlhttp = null;
	
if(window.XMLHttpRequest){
	xmlhttp = new XMLHttpRequest();
}
else{
	try{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e){
		window.alert("Uw browser ondersteunt het XMLHttpRequest object niet!");
	}
}

function expand(id){
	if(document.getElementById(id).className == "SubMenuShow"){
		document.getElementById(id).className = "SubMenuHide";	
	}
	else{
		document.getElementById(id).className = "SubMenuShow";
	}
}

function setID(id, category){
	if(document.getElementById("frm" + id).checked == true){
		xmlhttp.open("GET", "scripts/session_compare.php?id=" + id + "&cat=" + category, true);
		xmlhttp.send('');		
	}
	else{
		xmlhttp.open("GET", "scripts/session_compare.php?remove=true&id=" + id + "&cat=" + category, true);
		xmlhttp.send('');
	}
}

function setFavorite(id, language){
	if(language == "FR"){
		alert("Le produit a été ajouté ŕ vos favoris");			
	}
	else if(language == "NL"){
		alert("Het product is toegevoegd aan uw favorieten");		
	}
	xmlhttp.open("GET", "scripts/session_favorite.php?id=" + id, true);
	xmlhttp.send('');
}

function check(form){
	var x = form.emailfield.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	
	
	if(document.getElementById("lastnamefield").value == ""){
		window.alert("U dient uw achternaam in te vullen");
		return false;	
	}
	if(document.getElementById("firstnamefield").value == ""){
		window.alert("U dient uw voornaam in te vullen");
		return false;	
	}	
	if(document.getElementById("emailfield").value == ""){
		window.alert("U dient uw e-mailadres in te vullen");
		return false;	
	}
	else{
		if(!filter.test(x)){
			window.alert("Vul een geldig e-mailadres in");				
			return false;			
		}		
	}
}
