function change_countries(id, sex)
{
	for (i = document.getElementById(id).options.length; i > -1;  i--)
		document.getElementById(id).options[i] = null;

	var option = document.createElement('option');

	if (id == 'country')
		option.text = 'All countries';
	else
		option.text = 'Choose country !';

	option.value = '-1';

	document.getElementById(id).options.add(option);

	switch (sex) {
		case '0':
			for (i = 0; i < countries_m.length - 1; i++) {
				var option = document.createElement('option');

				option.text = countries_m[i];
				option.value = countries_id_m[i];

				document.getElementById(id).options.add(option);
			}
		break;

		case '1':
			for (i = 0; i < countries_f.length - 1; i++) {
				var option = document.createElement('option');

				option.text = countries_f[i];
				option.value = countries_id_f[i];

				document.getElementById(id).options.add(option);
			}
		break;
	}
}

function set_country(id, country)
{
	for (i = document.getElementById(id).options.length; i > -1;  i--)
		if (document.getElementById(id).options[i])
			if (document.getElementById(id).options[i].value == country)
				document.getElementById(id).selectedIndex = i;
}

function confirm_captain(id)
{
	document.getElementById('action').value = 'captain_' + id;

	document.getElementById('coaches').submit();
}

function confirm_edit(id)
{
	document.getElementById('action').value = 'edit_' + id;

	document.getElementById('coaches').submit();
}

function confirm_delete(id)
{
	if (confirm('Do you want to delete this coach ?')) {
		  document.getElementById('action').value = 'delete_' + id;

		  document.getElementById('coaches').submit();
	}
}

function confirm_save(id)
{
	document.getElementById('action').value = 'save_' + id;

	document.getElementById('coaches').submit();
}

function confirm_close()
{
	document.getElementById('action').value = 'cancel';

	document.getElementById('coaches').submit();
}

