function check(fieldArray,form_name){
	var cont = true;	
	for( i=0; i <fieldArray.length; i++){
		document.getElementById(fieldArray[i][0]).style.backgroundColor =  '#000000';				
		//TEXT FIELD
		if(fieldArray[i][1] == "text"){		
			if( document.getElementById(fieldArray[i][0]).value == "" ) {
				document.getElementById(fieldArray[i][0]).style.backgroundColor =  '#920000';
				cont = false;	
			}								
		}
		
		//SELECT FIELD
		if(fieldArray[i][1] == "option"){
			if( document.getElementById(fieldArray[i][0]).options[document.getElementById(fieldArray[i][0]).selectedIndex].value == "" ){
				document.getElementById(fieldArray[i][0]).style.backgroundColor =  '#920000';
				cont = false;	
			}	
		}
		
		//DIV FIELD
		if(fieldArray[i][1] == "div"){
			if( document.getElementById(fieldArray[i][0]).innerHTML == "" ){
				document.getElementById(fieldArray[i][0]).style.backgroundColor =  '#920000';
				cont = false;	
			}	
		}
		
		//RADIO FIELD
		if(fieldArray[i][1] == "radio"){
			found = false;
			for(i2=0; i2< eval("document."+form_name+"."+fieldArray[i][0]+".length"); i2++){
				if( eval("document."+form_name+"."+fieldArray[i][0]+"["+i2+"].checked")  == true ) {
					found = true;
				}
			}
			if(found == false){
				for(i2=0; i2< eval("document."+form_name+"."+fieldArray[i][0]+".length"); i2++){
					if( eval("document."+form_name+"."+fieldArray[i][0]+"["+i2+"].checked")  == false ) {
						eval("document."+form_name+"."+fieldArray[i][0]+"["+i2+"].style.backgroundColor =  '#920000'");
					}
				}
				cont = false;	
			}
	  
		}
	}	
	if(cont==false){
		alert("U heeft niet alle verplichte velden ingevuld.");					
	}else{
		eval("document."+form_name+".submit()");
	}
}

var xmlHttp;
function select_als(groep){ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		//alert ("Browser does not support HTTP Request");
		return;
	}
	var url="/get_activiteiten.php";
	url=url+"?g="+groep;
	url=url+"&r="+Math.random();
	xmlHttp.onreadystatechange=activiteiten_changed;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}

function activiteiten_changed(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	 	outputText=xmlHttp.responseText;
	 	if(outputText==''){	
	 	}else{ 
	 		length_select = document.getElementById("doen").length
			for(i=length_select; i > 1; i--){				
				document.getElementById("doen").options[1] = null;
			}
			option_array = xmlHttp.responseText.split(",");
			for(i=0; i < option_array.length; i++){
				option_array_2 = option_array[i].split(";");
				document.getElementById("doen").options[document.getElementById("doen").length] = new Option(option_array_2[0], option_array_2[1]);
			}
		}
	} 
}

function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	}
	catch (e){
	//Internet Explorer
 		try{
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
		catch (e){
		 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	 }
	}
	return xmlHttp;
}

function zoek_activiteit(){
	if((document.getElementById("doen").options[document.getElementById("doen").selectedIndex].value!="")&&(document.getElementById("als").options[document.getElementById("als").selectedIndex].value!="")&&(document.getElementById("vervoermiddel").options[document.getElementById("vervoermiddel").selectedIndex].value!="")){
		location.href = document.getElementById("doen").options[document.getElementById("doen").selectedIndex].value;
	}else{
		alert("U heeft niet alle velden ingevuld.");
	}
}
