//Check of rating element aanwezig is
if (typeof LLINK == 'undefined') { LLINK = new Object()}

LLINK.juistnu = {
	init: function(){
		if($('searchform')){
			$('searchform').onsubmit=LLINK.juistnu.checkForm;
		}
	},
	checkForm: function(){
		errors=new Array();
		counter=1;
		themesChecked=0;
		var nextEl=$('theme1');
		while(nextEl){
			themesChecked+=(nextEl.checked) ? 1 : 0;
			counter++;
			nextEl=$('theme'+counter);
		}
		if(themesChecked==0) errors.push("Kies in ieder geval één thema");
		counter=1;
		idealsChecked=0;
		var nextEl=$('ideal1');
		while(nextEl){
			idealsChecked+=(nextEl.checked) ? 1 : 0;
			counter++;
			nextEl=$('ideal'+counter);
		}
		if(idealsChecked==0) errors.push("Kies in ieder geval één ideaal");
		if(errors.length > 0){
			alert(errors.join("\n"));
		}		
		return (errors.length > 0 ) ? false : true;
	},
	showPage: function(pageNum,what){
		$('pagenum_'+what).value=pageNum;
		$('resultform').submit();
	}
};

window.addEvent('domready', LLINK.juistnu.init);
