Event.observe(document, 'dom:loaded', initDpaQuestions);

function initDpaQuestions() {
	$('productAndServices_N').observe('click', hideAndResetDpaQuestions);
	$('productAndServices_Y').observe('click', showDpaQuestions);
	hideDpaQuestionsIfApplicable();
}
function hideDpaQuestionsIfApplicable() {
	if ($('dpaQuestions') && !$('productAndServices_Y').checked) {
		$('dpaQuestions').hide();
		resetDpaQuestions();
	}
}
function hideAndResetDpaQuestions(){
	if ($('dpaQuestions') && $('dpaQuestions').visible()) {
		Effect.BlindUp('dpaQuestions', {afterFinish: resetDpaQuestions, duration: 0.5});
	}
}
function resetDpaQuestions(){
	$$("#dpaQuestions input[type='checkbox']").each(function(ele){ele.checked = false;});
}
function showDpaQuestions(){
	if ($('dpaQuestions') && !$('dpaQuestions').visible()) {
		Effect.BlindDown('dpaQuestions', {duration: 0.5});
	}
}