function openWindow(URL, width, Height) {
	var top = (screen.height - parseInt(Height)) / 2;
	var left = (screen.width - parseInt(width)) / 2;
   options = 'height='+Height+',width='+width+',toolbar=0,location=0,directories=0,menubar=0,top='+top+',left='+left+',scrollbars=1,status=1';
   w = window.open('', '', options);
   w.document.write('<html><head><title>Chargement en cours...</title></head><body>Chargement en cours...</body></html>');
   w.document.close();
   w.document.location.href=URL;
   return false;
}

function openWindow2(URL, width, Height) {
	var top = (screen.height - parseInt(Height)) / 2;
	var left = (screen.width - parseInt(width)) / 2;
   options = 'height='+Height+',width='+width+',toolbar=0,location=0,directories=0,menubar=0,top='+top+',left='+left+',scrollbars=1,status=1,resizable=1';
   w = window.open('', '', options);
   w.document.write('<html><head><title>Chargement en cours...</title></head><body>Chargement en cours...</body></html>');
   w.document.close();
   w.document.location.href=URL;
   return false;
}

function openSimulateur() {
   openWindow('index.php?page=Conseiller:Simulateur', 700, 620);
}

function openComparatif() {
   openWindow('index.php?page=Conseiller:ComparatifOffres', 780, 675);
}

function openAideConseiller() {
   openWindow('index.php?page=Conseiller:AideConseiller', 540, 200);
}

function openCharte() {
   openWindow('index.php?page=Conseiller:Charte', 700, 450);
}

function openConditionsGenerales() {
   openWindow('index.php?page=Conseiller:ConditionsGenerales', 740, 650);
}

function openPaiementSecurise() {
   openWindow('index.php?page=Conseiller:PaiementSecurise', 400, 180);
}

function openSatisfait() {
   openWindow('index.php?page=Conseiller:Satisfait', 400, 200);
}

function openSerenite() {
   openWindow('index.php?page=Conseiller:Serenite', 400, 200);
}

function openContrat() {
   openWindow('index.php?page=Conseiller:Contrat', 700, 400);
}

function openAssistance() {
   openWindow('index.php?page=MRT:Assistance', 530, 380);
}

function openPrincipes() {
   openWindow('index.php?page=Conseiller:Principes', 950, 750);
}

function openMRT(cid) {
   openWindow('index.php?page=MRT:ConsultationDemande&s=1&cid='+cid, 650, 700);
}

function openPopup() {
   openWindow('index.php?page=MRT:Popup&parent='+window.location, 650, 700);
}

function openFiche(cid) {
   openWindow('index.php?page=MRT:ConsultationDemande&s=0&cid='+cid, 650, 700);
}

function openRDV(cid) {
   openWindow('index.php?page=MRT:DemandeRendezVous&s=0&cid='+cid, 650, 700);
}

function openConsultationEnCours(cid) {
   openWindow('index.php?page=MRT:ConsultationEnCours&cid='+cid, 650, 700);
}

function openAmeliorations() {
   openWindow('index.php?page=Membre:Ameliorations', 450, 250);
}

function openContratUtilisation() {
   openWindow('index.php?page=Membre:ContratUtilisation', 650, 700);
}

function openAideContextuelle(fichier) {
   openWindow2('index.php?page=Aide&fichier='+fichier, 660, 550);
}

function accesFormContact() {
   window.close();
   window.opener.location = '?page=Index:Contacter';
}

//Fonction de mise ? jour de la derni?re activit? du conseiller

function majEtat(id) {
   var xhr_object = null;
   if(window.XMLHttpRequest) { // Firefox 
      xhr_object = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { // Internet Explorer 
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
   }
   xhr_object.open("POST", "majEtat.php?a="+id, false);
   xhr_object.send(null);
   if(xhr_object.readyState == 4) {
      document.getElementById('Encart:DispoImage').src = 'images/ico_'+xhr_object.responseText+'.gif';
   }
}

function majSuivi(cid) {
   var xhr_object = null;
   if(window.XMLHttpRequest) { // Firefox 
      xhr_object = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { // Internet Explorer 
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
   }
   xhr_object.open("POST", "majSuivi.php?cid="+cid, false);
   xhr_object.send(null);
   if(xhr_object.readyState == 4) {
    eval(xhr_object.responseText);
    switch (c.etat) {
        case 1 : 
            document.getElementById('Content:CEtat').innerHTML = "La consultation n'a pas encore commencé.";
            break;
        case 3 :
            document.getElementById('Content:CEtat').innerHTML = "La consultation est en cours.";

            if (!chronoStarted) {
                gCount = c.ecart;
                Chrono();
                chronoStarted = true;
            }
            break;
        case 4 :
            document.getElementById('Content:CEtat').innerHTML = "La consultation est terminée.";
            clearTimeout(tchrono);
            clearTimeout(tsuivi);
            break;
        case 5 :
            document.getElementById('Content:CEtat').innerHTML = "La consultation a été abandonnée par le client.";
            clearTimeout(tchrono);
            clearTimeout(tsuivi);
            break;
    }

   }
}