$(document).ready(function()
{
    $(".listTitle").click(function() {
        var current_id = $(this).attr("id");
        $temp = current_id.split('_');
        $id = $temp[1];
        $('#listText_'+$id).slideToggle("medium");
        $(this).toggleClass("expanded").toggleClass("collapsed");
        $(this).hide();
        $(this).parent().parent().nextAll('.reactie').children('.reacties').slideDown();
	});
    
    $(".reactielink").click(function() {
        var current_id = $(this).attr("id");
        $temp = current_id.split('_');
        $id = $temp[1];
        if($(this).hasClass("expanded")) {
            $('#reactieform_'+$id).hide();
        } else {
            $('#reactieform_'+$id).show();
        }
        $(this).toggleClass("expanded").toggleClass("collapsed");
	});
    
    $(".toonalles").click(function() {
        var current_id = $(this).attr("id");
        $temp = current_id.split('_');
        $id = $temp[1];
        $('.liHide_'+$id).show();
        $(this).hide();
	});
    
	$("a[rel='lightbox']").colorbox();
    
    $('.innerfade').innerfade({
		speed: 750,
		timeout: 5000,
		type: 'random'
	});
    
    $(".validateForm").validate({
        errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
    });
});
