var checker;
$(".comment_delete").click(function(ev){
	ev.preventDefault();
	item = $(this);
	if (confirm($(this).attr("title"))) {
		$.ajax({
			url: $(this).attr("href"),
			type: "post",
			success: function () {
				item.parent().parent().hide("slow");
			}
		});
	}
});

$(".confirm").click(function(ev){
	if (!confirm($(this).attr("title"))) {
		ev.preventDefault();
	}
});

$(document).ready(function () {
	$("label.overlabel").overlabel();
	$(".columnize").columnize({ columns: 2 })
});

$("#register").validate();

$(".val").validate({
	rules: {
		password1: {
			equalTo: "#password2"
		},
		username1: {
			remote: {
				url: "/login/check_username/",
				type: "post",
				data: {
					username: function() {
						return $("#username1").val();
					}
				}
			},
			required: true
		},
		email: {
			remote: {
				url: "/login/check_email_ajax/",
				type: "post",
				data: {
					email: function() {
						return $("#email").val();
					}
				}
			}
		}
	},
	messages: {
		username1: {
			remote: "Deze gebruikersnaam is al in gebruik!"
		},
		email: {
			remote: "Dit e-mailadres is al in gebruik!"
		}
	}
});
$("#comment").validate();
$(".close").hide().slideDown();
$(".close").click(function (ev) {
	ev.preventDefault();
	$(this).slideUp("slow", function (){
		$(this).remove();
	});
});
$(".login").click(function(ev){
	ev.preventDefault();
	scrolltop = $("#loginpos").offset().top;
	$("html, body").animate({
		scrollTop: scrolltop
	});
});
