/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
    $('#submitform').submit(function(event) {
        event.preventDefault();
     
        var errors = 0;
        
        $('.error').removeClass('error');
        $('.vraag').each(function(){
               var $vraag = this;
               var $checkedradioButton = $('input:checked',this);
               if ($checkedradioButton.length == 0)
               {
                   //question is not answered
                   errors++;
                   $($vraag).addClass('error');
               }
           });
           if (errors > 0)
           {			
			  return false;
		   }
		   $('#submit').remove();
		   //no errors
			$('#submitform').unbind('submit');
			$('#submitform').submit();
			
			//return true;
    });
})
