function gestion(type)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  switch(type){
    case 1:
      OAjax.open('POST',"get-Pause",true);
      break;
    case 2:
      OAjax.open('POST',"get-Reset",true);
      break;
    case 3:
      OAjax.open('POST',"get-Suppression",true);
      break;
  }

  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      if(type==1){
      window.location.replace("game/index");
      }
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('type='+type);

}

function membrecom(type,membreID)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  switch(type){
    case 1:
      OAjax.open('POST',"get-President",true);
      break;
    case 2:
      OAjax.open('POST',"get-Exclusion",true);
      break;
  }

  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(membreID).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('type='+type+'&membreID='+membreID);

}

function recrutement(type,demandeID)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  switch(type){
    case 1:
      OAjax.open('POST',"get-Accepter",true);
      break;
    case 2:
      OAjax.open('POST',"get-Refuser",true);
      break;
  }

  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(demandeID).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('type='+type+'&demandeID='+demandeID);

}

function embaucher(ide)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Embauche",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(ide).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('ide='+ide);
}

function traiterpatient(maladie,duree,serv1,serv2,serv3)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  document.getElementById('retour2').innerHTML='';
  OAjax.open('POST',"get-Traitement",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
       document.getElementById('retour2').innerHTML=OAjax.responseText;
       document.getElementById('consult').innerHTML='Patient trait&eacute;';
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('maladie='+maladie+'&duree='+duree+'&serv1='+serv1+'&serv2='+serv2+'&serv3='+serv3);
}

function confierpatient(maladie,membre)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  document.getElementById('retour2').innerHTML='';
  OAjax.open('POST',"get-Confier",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('retour2').innerHTML=OAjax.responseText;

    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('maladie='+maladie+'&membre='+membre);
}

function affecter(ide,service)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Affecter",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(ide).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('ide='+ide+'&service='+service);
}

function taches(ide,tache)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Taches",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(ide).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('ide='+ide+'&tache='+tache);
}

function specialisation(ide,spe,type)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Specialisation",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('specia').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('ide='+ide+'&spe='+spe+'&type='+type);
}

function alliance(nom,desc,logo,service)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Creation",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('msg').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('nom='+nom+'&desc='+desc+'&logo='+logo+'&service='+service);
}

function password(pass)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Password",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('pass').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('pass='+pass);
}

function check(login,mdp)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"index/get-Check",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      if(OAjax.responseText!=1){
        document.getElementById('msg').innerHTML=OAjax.responseText;
      }else{
        window.location.replace("game/index");
      }
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('login='+login+'&mdp='+mdp);
}

function inscription(login,mdp,verifmdp,email,nom,sexe,langue)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"index/get-Inscription",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
      if(OAjax.responseText!=9){
        document.getElementById('msg2').innerHTML=OAjax.responseText;
      }else{
        window.location.replace("game/index");
      }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('login='+login+'&mdp='+mdp+'&verifmdp='+verifmdp+'&nom='+nom+'&email='+email+'&langue='+langue+'&sexe='+sexe);
}

function passeperdu(mail)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"index/get-Password",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {

        document.getElementById('pw').innerHTML=OAjax.responseText;

    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('mail='+mail);
}

function niveauobj(num)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Levelup",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
        document.getElementById('objectif').innerHTML=OAjax.responseText;
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('num='+num);
}

function language(langue)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Langue",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('langue').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('langue='+langue);

}

function logo(urllogo)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Logo",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('logo').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('logo='+urllogo);
}

function description(desc)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Description",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('descr').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('desc='+desc);
}

function annonce(ann)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Annonce",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('idann').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('annonce='+ann);
}

function quittercomm()
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Quitter",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('retour').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('quitter=1');
}

function setBudget(nom,valeur)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Budget",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById('retour').innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('nom='+nom+'&valeur='+valeur);
}

function giveprime(id,prime,moral)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Prime",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      Sexy.nada(OAjax.responseText,{ onComplete: function(returnvalue2){if (returnvalue2){ location.reload(true); }}});
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('id='+id+'&prime='+prime+'&moral='+moral);

}



function giveaugmentation(id,salaire,moral)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Augmentation",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      Sexy.nada(OAjax.responseText,{ onComplete: function(returnvalue2){if (returnvalue2){ location.reload(true); }}});
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('id='+id+'&salaire='+salaire+'&moral='+moral);
}

function licencier(id)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Licenciment",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      Sexy.nada(OAjax.responseText,{ onComplete: function(returnvalue2){if (returnvalue2){ location.reload(true); }}});
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('id='+id);
}

function construire(nom)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Construction",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      document.getElementById(nom).innerHTML=OAjax.responseText;
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('nom='+nom);
}

function rediriger(id)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Redirection",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
      document.getElementById('retour').innerHTML=OAjax.responseText;
          
    }
  }
  document.getElementById('retour').innerHTML=OAjax.responseText;
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('id='+id);
}

function acheter(nom,prix)
{
  var OAjax;
  if (window.XMLHttpRequest) OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject) OAjax = new ActiveXObject('Microsoft.XMLHTTP');
  OAjax.open('POST',"get-Achat",true);
  OAjax.onreadystatechange = function()
  {
    if (OAjax.readyState == 4 && OAjax.status==200)
    {
    //if (document.getElementById)
    {
      Sexy.nada(OAjax.responseText,{ onComplete: function(returnvalue2){if (returnvalue2){ window.location.replace("index"); }}});
    }
    }
  }
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('nom='+nom+'&prix='+prix);
}

function load_data_communaute()
{
  if (document.getElementById('req_subject').value.length > 2)
  {
    send_data('q='+ escape(document.getElementById('req_subject').value), 'get-Listecomm', 'POST');
    document.getElementById('recherche_topic').innerHTML = '<center><font color="blue">Chargement en cours !</font></center>';
  }
  else
  {
    document.getElementById('recherche_topic').innerHTML = '<center><font color="red">nom trop court !</font></center>';
  }
}

function load_data()
{
  if (document.getElementById('req_subject').value.length > 2)
  {
    send_data('q='+ escape(document.getElementById('req_subject').value), 'get-Liste', 'POST');
    document.getElementById('recherche_topic').innerHTML = '<center><font color="blue">Chargement en cours !</font></center>';
  }
  else
  {
    document.getElementById('recherche_topic').innerHTML = '<center><font color="red">login trop court !</font></center>';
  }
}

function send_data(data, page, method)
{
  if (window.ActiveXObject)
  {
    //Internet Explorer
    var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
  }
  else
  {
    var XhrObj = new XMLHttpRequest();
  }

  //d�finition de l'endroit d'affichage:
  var content = document.getElementById("recherche_topic");

  //Ouverture du fichier en methode POST
  XhrObj.open("POST", page);

  //Ok pour la page cible
  XhrObj.onreadystatechange = function()
  {
    if (XhrObj.readyState == 4 && XhrObj.status == 200)
      content.innerHTML = XhrObj.responseText ;
  }

  XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  XhrObj.send(data);
}