function ContactForm(){
	this.formelementId = [];
	this.formelementType = [];
	this.correct = true;
	this.oldchecked;
}

ContactForm.prototype.addField = function(id, type){
	
	this.formelementId[this.formelementId.length] = id;
	this.formelementType[this.formelementId.length] = type;
}

ContactForm.prototype.check = function(){
	this.correct = true;
	this.checkopafleveradres = false;
	var arrAfleveradres = [];
	//alert(this.formelementId.length)
	if(document.getElementById('mail')){
		
		var mail = document.getElementById("mail");
		var post = document.getElementById('post');
		this.formelementId = [];
		if(mail.checked){
			this.formelementId[0] = 'naam';
			this.formelementId[1] = 'bedrijfsnaam';
			this.formelementId[2] = 'telefoonnummer';
			this.formelementId[3] = 'emailadres';
		}
		else if(post.checked){
			this.formelementId[0] = 'naam';
			this.formelementId[1] = 'bedrijfsnaam';
			this.formelementId[2] = 'telefoonnummer';
			this.formelementId[3] = 'postadres';
			this.formelementId[4] = 'postcode';
			this.formelementId[5] = 'plaats';
		}

	}
	for(var i = 0; i < this.formelementId.length; i++){
			var oFormelement = document.getElementById(this.formelementId[i]);
			var oFormelementValue = oFormelement.value;
			var parentFormelement = oFormelement.parentNode;
			var parentOfFormelementParent = parentFormelement.parentNode;
	
			if (oFormelementValue.length < 1) {
					
					//parentOfFormelementParent.childNodes[1].style.display = 'block';					
					//parentOfFormelementParent.style.backgroundColor = '#F3F3F3';
					//parentOfFormelementParent.style.marginTop = "3px";
					//parentOfFormelementParent.style.marginBottom = "3px";
					parentOfFormelementParent.childNodes[1].className = "foutmelding";
					parentOfFormelementParent.className = "foutmeldingInputBox";				
					this.correct = false;
			}
			else {
				//parentOfFormelementParent.childNodes[1].style.display = 'none';
				//parentOfFormelementParent.style.backgroundColor = 'transparent';
				parentOfFormelementParent.className = 'inputBox';
				parentOfFormelementParent.childNodes[1].className = "geenfoutmelding";
			}
	}
	return this.correct;
}

oContactForm = new ContactForm();