var ContactForm = Class.create();

ContactForm.prototype = {
	initialize: function () {
		this.buildEvents();
	},
	buildEvents : function () {

		$('contactForm').onclick = function () {
			ContactForm.changeFields();
		}
		$('ToelichtingButton').onclick = function () {
			$('Toelichting').disabled = !$('ToelichtingButton').checked
		}
		
	},
	
	changeFields: function () {
		if($('moreInfoButton').checked){
			$('Toelichting').disabled = !$('ToelichtingButton').checked
			var inputs = Form.getInputs('contactForm','checkbox', 'moreInfo[]')
			inputs.each(function(node){
				node.disabled = false;
			});
		} else {
			var inputs = Form.getInputs('contactForm','checkbox', 'moreInfo[]')
			inputs.each(function(node){
				node.disabled =true;
				$('Toelichting').disabled = true;
			});
		}
			$('appointment').disabled = !$('appointmentButton').checked;
	},
}
