function affEmailWeb(texte)
{
	var v2="SAX4QSVZF5MH2PDJSH";var v7=unescape("%24%24%3AY0%20%22%3F4u%2C+E%3Dj%28%3A2");var v5=v2.length;var v1="";for(var v4=0;v4<v5;v4++){v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));}document.write('<a href="javascript:void(0)" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject='+'\'">'+texte+'</a>');
}

function affEmailJo( trad )
{
	var v2="4GUEPHJTIUE8EQ5";var v7=unescape("%5E%28%3D+%3E1%0A5*%22%28%16%278O");var v5=v2.length;var v1="";for(var v4=0;v4<v5;v4++){v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));}document.write('<a href="javascript:void(0)" class="accueil_lien_email_contact" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject='+'\'">'+trad+' Johnny</a>');
}

function redirectTimer( timer, page )
{
	window.setTimeout('gotoPage(\''+page+'\')',timer) ;
}

function gotoPage( page )
{
	window.location.href=page ;
}

/* - - - Contest - - - */

function edit_status(Participant_ID){

	$('#display_status_'+Participant_ID).toggle();
	$('#edit_status_'+Participant_ID).toggle();

}

function save_status(Participant_ID,old_status,test){

	new_status = $('#edit_status_select_'+Participant_ID+' :selected').val();
	text   = $('#edit_status_select_'+Participant_ID+' :selected').text();

	$('#edit_status_select_'+Participant_ID).attr('disabled','disabled');
	$('#info_status_'+Participant_ID).toggle();

	$.ajax({
		type: "POST",
		url: '/admin/?p=gestion_contests_save',
		data: {
			field:			'Status',
			Participant_ID:	Participant_ID,
			value:			new_status
		},
		success: function(data) {
			if (data == 'OK') {
				$('#display_status_'+Participant_ID).html(text);
				$('#info_status_'+Participant_ID).toggle();
				$('#display_status_'+Participant_ID).toggle();
				$('#edit_status_'+Participant_ID).toggle();
			} else {
				$('#edit_status_select_'+Participant_ID).attr('selectedIndex', old_status);
				$('#info_status_'+Participant_ID).toggle();
				alert('Failed to update : '+data);
			}
			$('#edit_status_select_'+Participant_ID).removeAttr('disabled');
		}
	});

}

function edit_rank(Participant_ID){

	$('#display_rank_'+Participant_ID).toggle();
	$('#edit_rank_'+Participant_ID).toggle();

}

function save_rank(event,Participant_ID,old_rank){

	if ((event.keyCode || event.which) == 13) {

		new_rank = $('#edit_rank_input_'+Participant_ID).attr('value');

		$('#edit_rank_input_'+Participant_ID).attr('disabled','disabled');
		$('#info_rank_'+Participant_ID).toggle();

		$.ajax({
			type: "POST",
			url: '/admin/?p=gestion_contests_save',
			data: {
				field:			'Rank',
				Participant_ID:	Participant_ID,
				value:			new_rank
			},
			success: function(data) {
				if (data == 'OK') {
					$('#display_rank_'+Participant_ID).html(new_rank);
					$('#info_rank_'+Participant_ID).toggle();
					$('#display_rank_'+Participant_ID).toggle();
					$('#edit_rank_'+Participant_ID).toggle();
				} else {
					$('#edit_rank_input_'+Participant_ID).attr('value', old_rank);
					$('#info_rank_'+Participant_ID).toggle();
					alert('Failed to update : '+data);
				}
				$('#edit_rank_input_'+Participant_ID).removeAttr('disabled');
			}
		});
	}
}

/* - - - */


