function simuler(taux) {
	var montant = document.getElementById('montant').value;

	if(montant != '' && montant > 0) {
		if(document.getElementById('mode').checked == true) {
			document.getElementById('simuler').innerHTML = "Dépos de " + montant + " <img title=\"Drachme\" alt=\"Drachme\" src=\"images/drachme.jpg\">";
		}
		else {
			if(document.getElementById('calcul').checked == true) {
				document.getElementById('simuler').innerHTML = "Retrait de " + montant* (100-taux)/100 + " <img title=\"Drachme\" alt=\"Drachme\" src=\"images/drachme.jpg\">";
			}
			else {
				document.getElementById('simuler').innerHTML = "Retrait de " + Math.floor(10000*montant/ (100-taux))/100 + " <img title=\"Drachme\" alt=\"Drachme\" src=\"images/drachme.jpg\">";
			}
		}
	}
}

function affiche_cache(id)
{
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display='';
	}
	else {
		document.getElementById(id).style.display='none';
	}
}

function annuler_candidature(id){
   $.ajax({
     type: "GET",
     url: "form/annuler_candidature.php"/*,
     data: "id="+id,
     success: function(msg){ alert(msg); }*/
   });
   $("#cadre_candidature").hide("slow");
}

function demande_pacte(id) {
   $.ajax({
     type: "GET",
     url: "form/demander_pacte.php",
     data: "alliance="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function declarer(id) {
   $.ajax({
     type: "GET",
     url: "form/declarer.php",
     data: "alliance="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function declarer_contrat(id) {
   $.ajax({
     type: "GET",
     url: "form/declarer_contrat.php",
     data: "alliance="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function fermer_pacte() {
	$("#cadre_milieu_petit").hide("slow");
}

function observer(id) {
   $.ajax({
     type: "GET",
     url: "form/observer.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function espionner(id) {
   $.ajax({
     type: "GET",
     url: "form/espionner.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function visiter(id) {
   $.ajax({
     type: "GET",
     url: "form/visiter.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function furie(id) {
   $.ajax({
     type: "GET",
     url: "form/furie.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function foudre(id) {
   $.ajax({
     type: "GET",
     url: "form/foudre.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function preparer(id) {
   $.ajax({
     type: "GET",
     url: "form/preparer.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function programme(id) {
   $.ajax({
     type: "GET",
     url: "form/programme.php",
     data: "id="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

function attaquer(id) {
   $.ajax({
     type: "GET",
     url: "form/attaquer.php",
     data: "ciblej="+id,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }
   });
}

$(function(){
	$("#bouton_attaquer").click( function() {
		$("#bouton_attaquer").hide('slow');
	});
});

function gagnerdrachme(id) {
   $.ajax({
     type: "GET",
     url: "form/gaindrachme.php",
     data: "jeu="+id/*,
     success: function(msg){ $("#cadre_centre_petit").html(msg);$("#cadre_milieu_petit").show("slow"); }*/
   });
}

function retour_pause() {
   $.ajax({
     type: "GET",
     url: "form/retour_pause.php",
     /*data: "jeu="+id,*/
     success: function(msg){ location.reload(); }
   });
}

function reset() {
   $.ajax({
     type: "GET",
     url: "form/reset.php",
     /*data: "jeu="+id,*/
     success: function(msg){ location.reload(); }
   });
}

function changer_recrutement() {
   $.ajax({
     type: "GET",
     url: "form/changer_recrutement.php"/*,
     data: "jeu="+id*/,
     success: function(msg){ $("#fermer_recrutement").html(msg);}
   });
}

function recruter(id, action) {
	$("#cadre_recrutement_"+id).hide("slow");
	$("#cadre_recrutement2_"+id).hide("slow");
   $.ajax({
     type: "GET",
     url: "form/recrutement.php",
     data: "joueur="+id+"&action="+action,
     success: function(msg){ $("#affichage_erreur").html(msg);}
   });
}

function cocher2(i)
{
	if(document.getElementById("et").checked)
	{
		for(var a=1;a<=i;a++)
		{
			document.getElementById("dest"+a).checked=true;
		}
	}
}

function decoche()
{
	if(document.getElementById("et").checked)
	{
		document.getElementById("et").checked=false;
	}
}

function modifier_temple(id) {

   $.ajax({
     type: "GET",
     url: "fr/form/modifier_temple.php",
     data: "id="+id,
     success: function(msg){ $("#changement_temple").html(msg);}
   });
   
   $.ajax({
     type: "GET",
     url: "fr/form/prix_temple.php",
     data: "id="+id,
     success: function(msg){ $("#prix_temple").html(msg);}
   });
}

function retour_abo(id) {
   $.ajax({
     type: "GET",
     url: "form/retour_abo.php",
     data: "id="+id,
     success: function(msg){ location.reload(); }
   });
}

function etape_suivante() {
   $.ajax({
     type: "GET",
     url: "form/etape_suivante.php",/*
     data: "id="+id,*/
     success: function(msg){ $("#etape").html(msg); }
   });
}

function info_case(btn, x, y) {
   $.ajax({
     type: "GET",
     url: "fr/form/info_case.php",
     data: "btn=" + btn + "&x=" + x + "&y=" + y,
     success: function(msg){ $("#info_btn").show("slow"); $("#info_btn").html(msg); }
   });
}

function afficher_recrutement() {
	$("#btn_deplacer").hide("slow");
	$("#btn_bouton").hide("slow");
	$("#btn_recruter").show("slow");
}

