function getHTML(target, lien, infos) {
	$(target).update("<center><br /><img src='images/spin.gif' /><br />En attente du serveur...</center>");
	var myAjax = new Ajax.Updater($(target), lien, {method: 'post', parameters: infos, evalScripts: true, onSuccess: function () { eval(arguments[3])}});
}

 function addAlliance() {
  var win =  new Window({className: "nuncio", blurClassName: "nuncio", width:760, height:500,  resizable: true, title: "<b>Créer une nouvelle alliance :</b> ",  draggable:true, wiredDrag: true, destroyOnClose: true}).setAjaxContent( "inc/al_add.php", "", true, true);
} 
function newAlliance() { affWin('al_add.php', "<b>Créer une nouvelle alliance :</b>"); }

 function detailAlliance(id) {
  var win =  new Window({className: "nuncio", blurClassName: "nuncio", width:760, height:500,  resizable: true, title: "<b>Détails de l'alliance :</b> ",  draggable:true, wiredDrag: true, destroyOnClose: true}).setAjaxContent( "al_detail.php?id="+id, "", true, true);
} 

function affWin(gotoURL, winCaption) {
 var win =  new Window({className: "nuncio", blurClassName: "nuncio", width:760, height:500,  resizable: true, title: "<b>"+winCaption+" :</b> ",  draggable:true, wiredDrag: true, destroyOnClose: true}).setAjaxContent( gotoURL, "", true, true);
}

function alMembreSetGrade(ng, p, id, g) { getHTML('al_membre_'+id+'_'+p, 'al_membreSetGrade.php?p='+p+'&id='+id+'&g='+g+'&ng='+ng);}
function alAffMembre(p, id, g) {getHTML('al_membre_'+id+'_'+p, 'al_affMembre.php?p='+p+'&id='+id+'&g='+g);}

function alPreExclureMembre(p, id, g) { getHTML('al_membre_'+id+'_'+p, 'al_preExclureMembre.php?p='+p+'&id='+id+'&g='+g);}
function alExclureMembre(p, id, g, msg) { getHTML('al_membre_'+id+'_'+p, 'al_exclureMembre.php?p='+p+'&id='+id+'&g='+g+'&msg='+msg);}

function alAddPeuple(p, id) { getHTML('peuple', 'al_addPeuple.php?p='+p+'&id='+id);}
function alAddPeuple10(p, id) { getHTML('peuple', 'al_addPeuple10.php?p='+p+'&id='+id);}
function alAddNive(id) { getHTML('nivsup', 'al_addNiv.php?id='+id);}

function alExclusionMsg(id) { affWin('al_exMsg.php?id='+id, "Raisons de votre exclusion :");}

function alShowInfos() { affWin('al_infos.php', "Règles des alliances :"); }

function alLstMembres(id) { affWin('al_listeMembres.php?id='+id, "Liste des membres de l'alliance"); }
function alModProd(id) { affWin('al_modProd.php?id='+id, "Modifier vos productions");  }
function alDon(id) { affWin('al_don.php?id='+id, "Faire un don à l'alliance");  }
function alQuitterAl(id) { affWin('al_desinscr.php?id='+id, "Quitter cette alliance");  }
function alGestDemAd(id) { affWin('al_gestDem.php?id='+id, "Gestion des demandes d'adhésion"); }

function alGestPeuple(id) { affWin('al_gestPeuple1.php?id='+id, "Gestion du peuple"); }
function alGestMembres(id, g) { affWin('al_gestMembres1.php?id='+id+'&g='+g, "Gestion des membres"); }
function alGestTaxes(id) { affWin('al_mod_taxes.php?id='+id, "Gestion des taxes"); }
function alModCharte(id) { affWin('al_mod_infos.php?id='+id, "Modifier les infos de l'alliance"); }  
function alModChef(id) {  affWin('al_mod_chef.php?id='+id, "Transférer le pouvoir"); }
function alDelAl(id) {  alert('bientôt disponible !');      /*affWin('al_listeMembres.php?id='+id, "Supprimer l'alliance");*/ }

function alNivUp(id) { affWin('al_nivsup1.php?id='+id, "Monter l'alliance de niveau"); }

function sendDem(id) { affWin('al_sendDemFrm.php?id='+id, "Envoyer une demande d'adhésion");}

function demOk(id_al, id_pers) { 
 getHTML("al_dem_"+id_al+"_"+id_pers, "al_dem_ok.php?a="+id_al+"&p="+id_pers);
}

function demNo(id_al, id_pers) { 
 getHTML("al_dem_"+id_al+"_"+id_pers, "al_dem_no.php?a="+id_al+"&p="+id_pers);
}

function sendMsg(id) {
 alert('bientôt disponible !');
}
