function payment_response_access_enabled(response)
{
	url = response.url + '/registration/enter/?id=' + payment_user_id;
	location.href = url;
	return;
}

$(document).ready(function() {
	$('.register_submit').click(function(event) {
		event.preventDefault();
		$(this).parents('form').submit();
	});
	
	$('.tab-select').click(function(event) {
		event.preventDefault();
		$('.tab-select').removeClass('active');
		$(this).addClass('active');
		var id = $(this).attr('id').replace(/\D+/, '');
		$('.tab_content').hide();
		$('#tab' + id).show();
	});
	
	$('.country_select').change(function() {
		var country_id = parseInt($(this).val());
		if (country_id) {
			var region_select = $(this).parents('.geo_form').find('.region_select');
			var city_select = $(this).parents('.geo_form').find('.city_select');
			$(region_select).attr('disabled', 'disabled');
			$(city_select).attr('disabled', 'disabled');
			$.post('/?action=regions', {'id': country_id}, function(response) {
				$(region_select).removeAttr('disabled');
				$(city_select).removeAttr('disabled');
				if (response.status && response.status == 'success') {
					$(region_select).children('option:not(:first)').remove();
					for (i in response.regions) {
						$(region_select).append('<option value="' + i + '">' + response.regions[i] + '</option>');
					}
					$(city_select).children('option:not(:first)').remove();
				}
			}, 'json');
		}
	});
	
	$('.region_select').change(function() {
		var id = parseInt($(this).val());
		if (id) {
			var city_select = $(this).parents('.geo_form').find('.city_select');
			$(city_select).attr('disabled', 'disabled');
			$.post('/?action=cities', {'id': id}, function(response) {
				$(city_select).removeAttr('disabled');
				if (response.status && response.status == 'success') {
					$(city_select).children('option:not(:first)').remove();
					for (i in response.cities) {
						$(city_select).append('<option value="' + i + '">' + response.cities[i] + '</option>');
					}
				}
			}, 'json');
		}
	});	
});


