// GLOBALE STRING
var ERREUR_CHARGEMENT = "Erreur chargement des données!";
var MSG_CHARGEMENT = "Chargement en cours ...";

// Affichage du menu d'identification Administrateur
function getPHPFile(divid, phpfile)
{
 //alert(phpfile);
 var div = document.getElementById(divid);
 if (div.style.visibility && (div.style.visibility != 'visible')) div.style.visibility = 'visible';
 div.innerHTML = "<span class='acefetiq'>"+MSG_CHARGEMENT+"</span>";
 dojo.io.bind({
    url: phpfile,
    error: function(type, errObj){
      alert(type);
      alert(errObj);
       div.innerHTML = "<span class='acefetiq'>"+ERREUR_CHARGEMENT+"</span>";
    },
    load: function(type, data, evt)
    {
        div.innerHTML = data;
    },
    changeURL: false,
    mimetype: "text/html"
 });
}

// Affichage du menu d'identification Administrateur
function getPHPFileCh(divchargement, divid, phpfile)
{
 var div = document.getElementById(divid);
 if (div.style.visibility && (div.style.visibility != 'visible')) div.style.visibility = 'visible';
 var divch = document.getElementById(divchargement);
 divch.innerHTML = "<span class='acefetiq'>"+MSG_CHARGEMENT+"</span>";
 dojo.io.bind({
    url: phpfile,
    error: function(type, errObj){
       divch.innerHTML = "<span class='acefetiq'>"+ERREUR_CHARGEMENT+"</span>";
    },
    load: function(type, data, evt)
    {
        div.innerHTML = data;
        divch.innerHTML = "";
    },
    changeURL: false,
    mimetype: "text/html"
 });
}

// Affichage d'un texte
function setTexte(divid,texte)
{
 var div = document.getElementById(divid);
 if (div.style.visibility && (div.style.visibility != 'visible')) div.style.visibility = 'visible';
 div.innerHTML = texte;
}

// Affichage d'une info dans le calendrier
function setTextColor(divid,texte,bgcolor)
{
 var div = document.getElementById(divid);
 if (div.style.visibility && (div.style.visibility != 'visible')) div.style.visibility = 'visible';
 div.innerHTML = texte;
 div.style.backgroundColor = bgcolor;
}

// Visualisation des images en taille maximale compte tenu de la définition de l'écran
function visupix(PIX,WP,HP)
{
 var WS = screen.width-100;
 var HS = screen.height-100;

 if ((WP<=WS)&&(HP<=HS)) window.open("visupixmax.php?photo="+PIX+"&wp="+WP+"&hp="+HP,"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,resizable=0,width="+WP+",height="+HP);
 else if ((WP>WS)&&(HP<=HS)) window.open("visupixmax.php?photo="+PIX+"&wp="+WS+"&hp="+Math.floor(HP*WS/WP),"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,resisable=0,width="+WS+",height="+Math.floor(HP*WS/WP));
 else if ((WP<=WS)&&(HP>HS)) window.open("visupixmax.php?photo="+PIX+"&wp="+Math.floor(WP*HS/HP)+"&hp="+HS,"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,resisable=0,width="+Math.floor(WP*HS/HP)+",height="+HS);
 else
 {
  if (Math.floor(HP*WS/WP)<HS) window.open("visupixmax.php?photo="+PIX+"&wp="+WS+"&hp="+Math.floor(HP*WS/WP),"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,resisable=0,width="+WS+",height="+Math.floor(HP*WS/WP));
  else window.open("visupixmax.php?photo="+PIX+"&wp="+Math.floor(WP*HS/HP)+"&hp="+HS,"","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=no,resisable=0,width="+Math.floor(WP*HS/HP)+",height="+HS);
 }
}


