function preloadImages() 
{
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
  var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
  function ouvrir_menu(url,titre,img_width,img_height)
 {
    var widthMax=600;
    var heightMax=600;
    
    var monImage = new Image();
    document.getElementById("menuimg").src="images/spacer.gif";
    
    
  
    var tailleW = img_width;
    var tailleH = img_height;
    
    if(tailleH >heightMax)
    {      
      tailleW=tailleW /(tailleH/heightMax);
      tailleH=heightMax;
    } 
    if(tailleW >widthMax)
    { 
     
      tailleH=tailleH /(tailleW/widthMax);
      tailleW=widthMax;
     } 
    document.getElementById("menuimg").src=url;
    document.getElementById("menuimg").style.width = tailleW+ "px";
    document.getElementById("menuimg").style.height = tailleH +"px";
    document.getElementById("menu_context").style.display = "block"; 
    
    var position_x = 0;//(document.body.clientWidth -tailleW )/2 -100;
    var position_y = (document.body.scrollTop+00) ;
    document.getElementById("menu_context").style.top = position_y;
    document.getElementById("menu_context").style.left = position_x;
    
    fadeIn('menu_context',-50);
   
  }
   function fermer_menu()
  {
     document.getElementById("menuimg").src="images/spacer.gif";
    document.getElementById("menu_context").style.display = "none";
  //activ_pop = setTimeout("ouvrir_menu()",30000)
  }
  
function change_img(img)
{
  TEMP.location="temp.php?img="+img;
  bannerup.src=img;
}
function initImage() 
{
  imageId = 'thephoto';
  image = document.getElementById(imageId);
  setOpacity(imageId, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}
function spanload(nom)
{
   document.getElementById(nom).style.background='white no-repeat top center';
  
}
function setOpacity(objid, opacity) 
{
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
   document.getElementById(objid).style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  document.getElementById(objid).style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  document.getElementById(objid).style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  document.getElementById(objid).style.opacity = opacity/100;
}

var fadeInT=1;
function fadeIn(objId,opacity,opacity2) 
{
  if(opacity2==undefined)
  {
    opacity2=100;
  }
  
  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity <= opacity2)
    {
      setOpacity(objId, opacity);
      opacity += 10;
      fadeInT=window.setTimeout("fadeIn('"+objId+"',"+opacity+","+opacity2+")", 10);
    }
  }
}
function fadeOut(objId,opacity,opacity2) 
{
  //clearTimeout(fadeInT);
  if(opacity2==undefined)
  {
    opacity2=00;
  }
  

  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity >= opacity2)
    {
      setOpacity(objId, opacity);
      opacity += -10;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+","+opacity2+")", 10);
    }
  }
}

