$(document).ready(function() {
	// form styling helpers
	$("form#form label").each(function() {
		$(this).html($(this).html().replace(/\|/g, '<br />'));
	});
	// make checkbox label clickable
	$("div.checkbox").each(function() {
		$(this).children('label').attr('for',$(this).children("input").attr('id'));
	});
	// extend checkerror for checkboxes
	$("input#submit").click(function() {
		setTimeout(function() {
			 $("div.checkbox input.checkerror").parent().addClass('checkerror');
		}, 10);				
		$("div.checkbox input").change(function() {
			$(this).animate({opacity:1},10,function() {
				if ($(this).is('.checkerror')) {
					$(this).parent().addClass('checkerror');
				} else {
					$(this).parent().removeClass('checkerror');
				}		
			});
		});
	});	
});
