/* ****************** HEADER MODULE ******************************************* */
var match_header_module_result_index = 0;
var match_header_module_total_results = 1;
var match_header_module_result_sending = false;
function match_header_module_result(direction)
{
	if (!match_header_module_result_sending)
	{
		match_header_module_result_sending = true;
		match_header_module_result_index += direction; // values of direction: -1=left, 1=right
		if (match_header_module_result_index < 0)
			match_header_module_result_index = match_header_module_total_results - 1;
		else if (match_header_module_result_index >= match_header_module_total_results)
			match_header_module_result_index = 0;
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/match_home_result.php",
			data: { index: match_header_module_result_index },
			success: function(response) {
				match_header_module_result_sending = false;
				$('#home_match_result').html(response);
				match_header_module_total_results = $('#match_header_module_total_results').val();
				// Actualizar fecha:
				$('#home_match_date').html($('#match_header_date').val());
			},
			error: function(obj, what_happen, other_obj) {
				match_header_module_result_sending = false;
				//calendar_dates_collections = new Array();
			}
		});
	}
}
/* ****************** END HEADER MODULE ******************************************* */

function match_list(page)
{
	if (!document.sending)
	{
		document.sending = true;
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/match_list.php",
			data: { p: page },
			success: function(response) {
				document.sending = false;
				$('#match_list').html(response);

			},
			error: function(obj, what_happen, other_obj) {
				document.sending = false;
			}
		});
	}
}
