function reloadJackpotAlertMemberRelationshipData() {
	$.ajax({
		url: "/tools/jackpotalerts/member_jackpot_alert_data",
		method: "GET",
		data: {
			selected_region_code: $('#selected_region').val(), 
			selected_game_code: $('#selected_game').val()
		},
		success: function(responseText) {	
			$('#jackpot_alert_section_partial').html(responseText);
		}
	});
	return false;
}

function reloadStateJackpotMemberRelationshipData() {
	$.ajax({
		url: "/tools/jackpotalerts/member_state_jackpot_data",
		method: "GET",
		data: {
			selected_region_code: $('#selected_region').val()
		},
		success: function(responseText) {	
			$('#state_jackpot_alert_section_partial').html(responseText);
		}
	});
	return false;
}
function reloadCurrentJackpotNotifications() {
	$.ajax({
		type: "GET",
		url:  "/tools/jackpotalerts/member_current_notifications",
		data: {
			selected_region_code: $('#selected_region').val(),
			selected_game_code: $('#selected_game').val()
		},
		success: function(responseText) {
			$('#current_jackpot_notifications_section').html(responseText);
		}
	});
	return false;
}
$(document).ready(function () {

	// Where games drop down list is generated by region drop down list
	$('option.drop_down_regions').click(function() {
		$.ajax({
			type: "GET",
			url: "/drop_down_region",
			data: { 
				selected_region_code: $('#selected_region').val() 
			},
			success: function(responseText){
				$('#selected_game').html(responseText);
				$('#selected_game').show();
			},
			error: function(response){
				alert('Error: ' + response);
			}
		});
		return false;
	});

	$('#current_jackpot_notifications_submit').click(function() {
		$.ajax({
			type: "POST",
			url:  "/tools/jackpotalerts/jackpot_alerts_done",
			data: {
				selected_region_code: $('#selected_region').val(),
				selected_game_code: $('#selected_game').val(),
				jackpot_alert_amount: $('#jackpot_alert_amount').val(),
				jackpot_alert_email: $('#jackpot_alert_email:checked').val(),
				jackpot_alert_phone: $('#jackpot_alert_phone:checked').val(),
				jackpot_alert_days: $('#jackpot_alert_days').val(),
				state_jackpot_email: $('#state_jackpot_email:checked').val(),
				state_jackpot_phone: $('#state_jackpot_phone:checked').val()
			},
			success: function(responseText) {
				$('#current_jackpot_notifications_section').html(responseText);
			}
		});
	});
});


