function max(a,b)
{
  return (a>b?a:b);
}


// Positionne tous les objets, cadres 
// en fonction de la taille de la fenetre (800x600 mini)
function adapterSite()
{
  var wH, wW, wSize = new Array(0,0);
  var dW=120, dh=150 ;
  
  getWindowSize(wSize);
  wH=max(400,wSize[1])
  wW=max(800,wSize[0]);

  var obj=document.getElementById('haut-page-d');
  obj.style.width=wW-dW+"px";  

  obj=document.getElementById('contenu');
  obj.style.width=wW-dW+"px";
  contenuHeight=(Math.floor((wH-dh)/35)*35)-1;
  obj.style.height=contenuHeight+"px"; // pour couper proprement la reliure... 

  obj=document.getElementById('bas-page-d');
  obj.style.width=wW-dW+"px";
    

  obj=document.getElementById('carnet');
  obj.style.display="block";

  obj=document.getElementById('accueil');
  if (obj)
  {
    photoAccueil=document.getElementById('photoAccueil');
    if (photoAccueil.height<contenuHeight)
      obj.style.marginTop=(contenuHeight-photoAccueil.height-15)/2+"px";
    obj.style.width=photoAccueil.width+"px";
  }
}

function getWindowSize(wSize) 
{
  if( typeof( window.innerWidth ) == 'number' ) 
  {
    wSize[0] = window.innerWidth;
    wSize[1] = window.innerHeight;
  } 
  else if( document.documentElement && document.documentElement.clientWidth) 
  {
    wSize[0] = document.documentElement.clientWidth;
    wSize[1] = document.documentElement.clientHeight;
  } 
  else if( document.body && document.body.clientWidth ) 
  {
    wSize[0] = document.body.clientWidth;
    wSize[1] = document.body.clientHeight;
  }
}


function affLoad()
{
//  montre("smenu1");
  adapterSite();
}

window.onload=affLoad;
window.onresize=adapterSite;

