$(function() {
	$('#btn_reg')
	.click(function() {
		$.ajax({
			type: 'get',
			url: '/bg/registration.php',
			cache: false,
			data: { 'act': 'registration', 'email': $('#reg_email').val(), 'passwd': $('#reg_passwd').val(), 'passwd_confirm': $('#reg_passwd_confirm').val() },
			dataType: 'json',
			success: function(json) {
				if (json.result == 0) {
					window.location.href = '/registration.php';
				} else {
					$.showError(json.errors);
				}
			}
		});
	})
	.parents('form').submit(function() {
		return false;
	});
});