function spanload(nom)
{
   document.getElementById(nom).style.background='white no-repeat top center';
  
}

function initImage() 
{
  imageId = 'thephoto';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}

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 += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 10);
    }
  }
}
function fadeInSlow(objId,opacity) 
{
  
  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity <= 100)
    {
      setOpacity(obj, opacity);
      opacity += 1;
      window.setTimeout("fadeInSlow('"+objId+"',"+opacity+")", 50);
    }
  }
}
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);
    }
  }
}

function fadeOutSlow(objId,opacity,opacity2) 
{
  if(opacity2==undefined)
  {
    opacity2=30;
  }
  

  if (document.getElementById)
  {
    obj = document.getElementById(objId);
    if (opacity >= opacity2)
    {
      setOpacity(obj, opacity);
      opacity += -1;
      window.setTimeout("fadeOutSlow('"+objId+"',"+opacity+","+opacity2+")", 20);
    }
  }
}

function PlaySound(soundobj)
{
 var thissound= eval("document."+soundobj);
 thissound.Play();
}
function StopSound(soundobj)
{
 var thissound= eval("document."+soundobj);
 thissound.Stop();
}

function ouvrir_menu(url,titre,img_width,img_height)
{
   
   var widthMax=800;
   var heightMax=600;
    
    monImage = new Image;
    monImage.src = url;
        
    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;
     } 
   
    
         
    parent.document.getElementById("menuimg").src=monImage.src;
    
    parent.document.getElementById("menu_titre").innerHTML=titre;
    parent.document.getElementById("menu_context").style.display = "block";
     
    var position_x = (parent.document.body.clientWidth -tailleW )/2 ;
    var position_y = (parent.document.body.scrollTop) ;                                                      
    
    parent.document.getElementById("placement").style.top = position_y+100;
    parent.document.getElementById("placement").style.left =position_x;
    parent.document.getElementById("menuimg").style.width =tailleW;
    parent.document.getElementById("menuimg").style.height =tailleH;

    
    fadeIn('menuimg',0,100);
  }

  function fermer_menu()
  {
    
    document.getElementById("menu_context").style.display = "none";
    parent.document.getElementById("menuimg").src="../images/spacer.gif";
  
  }
  
  function tailleimg(id,url)
  {
     var heightMax=170;
     var widthMax=170;
     
      monImage = new Image;
      monImage.src = document.getElementById(id).src;
      var tailleW = monImage.width
      var tailleH = monImage.height 
      if(tailleH >heightMax)
      {      
        tailleW=tailleW /(tailleH/heightMax);
        tailleH=heightMax;
      } 
      if(tailleW >widthMax)
      {      
        tailleH=tailleH /(tailleW/widthMax);
        tailleW=widthMax;
      } 
     
     
      
     // alert(position_x +" - " +position_y);
      //document.getElementById(id).src=url;
      document.getElementById(id).width = tailleW;
      document.getElementById(id).height = tailleH;
     
  }
  
  function showorhide(id)
  {
    if(document.getElementById(id).style.display=="none")
      document.getElementById(id).style.display="block";
    else  
      document.getElementById(id).style.display="none";
  }
  function changeImg(obj,obj2,url,txt)
  {
  //alert(txt);
    document.getElementById(obj).src="../admin/"+url;
    //document.getElementById(obj2).innertext=txt;
  }

