
function contact_post(){
	
	is_filled_contact_post()
		
	var url = 'sendcontact.php';
	postForm2Ajax(document.forms['contact'], url,"show_contact_status()" ,"")
		
		

	
	
}

function show_contact_status(){
	var container = document.createElement('div');
	container.setAttribute('id', 'contactstatus');
		
	container.innerHTML = "";
	
	container.style.position= "absolute";
	container.style.top = "300px";	
	container.style.left = "50%";
	container.style.marginLeft = "-280px";
	
	container.style.zIndex = "10";
	container.style.display= "block";	
	//container.style.height = 200+"px";
	container.style.width = 548+"px";
	//container.style.backgroundColor = "#FFFFFF";
	
	
	if(xmlhttp.readyState==4){
			
		container.innerHTML = xmlhttp.responseText;
	}
	
	document.body.appendChild(container);
	
}


function is_filled_contact_post(){
	
	var verplicht =  Array("email", "naam", "geslacht", "postcode", "adres", "plaats", "land", "netnummer", "telefoonnummer", "vraag_opmerking" );

	var fault = true;
	var mainFault = false;
	
	
	for(i=0;i<verplicht.length;i++){
		
		var ele23 = document.getElementsByName(verplicht[i])[0];
		if(ele23){
			if(ele23.type == "radio" || ele23.type == "checkbox"){
				var chkEles =  document.getElementsByName(verplicht[i]);
				var chkFault = true;
				
				for(chkI=0; chkI<chkEles.length;chkI++){
					if(chkEles[chkI].checked==true){
						chkFault=false;
						break;
					}	
				}
				
				if(chkFault){
					ele = document.getElementById(verplicht[i]+"_field")
					if(ele)ele.style.color = "#FF0000";
				}else{
					ele = document.getElementById(verplicht[i]+"_field")
					if(ele)ele.style.color = "#663300";
				}
				
			}else{
				if(ele23.value == ""){
							
					ele = document.getElementById(verplicht[i]+"_field")
					if(ele)ele.style.color = "#FF0000";
				
					mainFault = true;				
				}else{
					ele = document.getElementById(verplicht[i]+"_field")
					if(ele)ele.style.color = "#663300";
				}
			}
		}
	}
	
	return mainFault;
}
