/*if (parent.frames.length==0) 
  parent.location.href="index.php";
  
parent.document.title=document.title;
  */
  function ouvrir_menu(url,titre,img_width,img_height)
 {
    var widthMax=900;
    var heightMax=600;
    
    var monImage = new Image();
      
    
  
    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("menuborder").style.width = tailleW +2;
    document.getElementById("menuborder").style.height = tailleH +2;
    document.getElementById("menuimg").src=url;
    document.getElementById("titre").innerHTML=titre;
    document.getElementById("menuimg").style.width = tailleW+ "px";
    document.getElementById("menuimg").style.height = tailleH +"px";
    document.getElementById("menu_context").style.display = "block"; 
    fadeIn('menu_context',-50);
    var position_x = (document.body.clientWidth -tailleW )/2 -127 ;
    var position_y = (document.body.scrollTop+100) ;
    document.getElementById("menu_context").style.top = position_y;
    document.getElementById("menu_context").style.left = position_x;
    document.getElementById("menu_context").style.width = tailleW +100;
    document.getElementById("menu_context").style.height = tailleH +100;

   document.getElementById("imgspacer").width = tailleW+10;
    document.getElementById("imgspacer").height = tailleH+10;
    document.getElementById("imgspacer").style.top= document.getElementById("menuimg").style.top;
    document.getElementById("imgspacer").style.left= 0; 
  }
   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(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}
function spanload(nom)
{
   document.getElementById(nom).style.background='white no-repeat top center';
  
}
function setOpacity(obj, opacity) 
{
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) 
{
  
  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity <= 100)
    {
      setOpacity(obj, opacity);
      opacity += 5;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 10);
    }
  }
}
function fadeOut(objId,opacity,opacity2) 
{
  if(opacity2==undefined)
  {
    opacity2=30;
  }
  

  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity >= opacity2)
    {
      setOpacity(obj, opacity);
      opacity += -10;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+","+opacity2+")", 10);
    }
  }
}
