function popupImage( img )
{
  var largeur = 0;
  var hauteur = 0;
  
  var top  = 10;
  var left = 10;
  
	var titre = "Aperçu de l'image";
	
	w = open( "", 'image', 'left='+left+',top='+top+',width=' + largeur + ',height=' + hauteur + ',status=yes,toolbar=no,scrollbars=yes,resizable=yes,menubar=no,directories=no' );
	
	w.document.write( "<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>" );
	w.document.write( "<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+60,document.images[0].height+110); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>" );
	w.document.write( "<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>" );
	w.document.write( "<table width=100% height=100%><tr><td><center><table align=center><tr><td align=center><a href='#' onclick='self.close();'><IMG src='"+img+"' border=0 style='border: 5px solid black;'><a></td></tr></table></center></td></tr></table>" );
	w.document.write( "</BODY></HTML>" );
	
	w.document.close();
}

//-----------------------------------------------------------------------------------------------------------------------
// OPTION                         DESCRIPTION
// ------                         -----------
// directories = yes/no           Affiche ou non les boutons de navigation
// location = yes/no              Affiche ou non la barre d'adresse
// menubar = yes/no               Affiche ou non la barre de menu (fichier, edition, ...)
// resizable = yes/no             Définit si la taille de la fenêtre est modifiable ou non
// scrollbars = yes/no            Affiche ou non les ascenceurs (barres de défilement)
// status = yes/no                Affiche ou non la barre d'état
// toolbar = yes/no               Affiche ou non la barre d'outils
//-----------------------------------------------------------------------------------------------------------------------
function popupc( page, id, largeur, hauteur, options )
{
  var top  = (screen.height - hauteur) / 2;
  var left = (screen.width - largeur) / 2;
  if( largeur == -1 ) largeur = screen.width;
  if( hauteur == -1 ) hauteur = screen.height;

  window.open( page, id, "top="+top+", left="+left+", width="+largeur+", height="+hauteur+","+options );
}

function popup( page, idpage, largeur, hauteur, options ) {
  var top  = 20; var left = 20;
  window.open( page, idpage, "top="+top+", left="+left+", width="+largeur+", height="+hauteur+", "+options );
}

function ajouterAuxFavoris( title, url )
{
  //--- firefox
  if( window.sidebar ) {
    window.sidebar.addPanel( title, url, "" );
  }
  
  //--- opera
  else if( window.opera && window.print )
  {
  	var elem = document.createElement('a');
  	elem.setAttribute('href',url);
  	elem.setAttribute('title',title);
  	elem.setAttribute('rel','sidebar');
  	elem.click();
  }
  
  //--- ie
  else if( document.all ) {
  	window.external.AddFavorite(url, title);
  }
}

function getElement( elem )
{
  if( document.getElementById ) {
    if( document.getElementById(elem) ) return document.getElementById(elem);
  } else if( document.all ) {
    if( document.all[elem] ) return document.all[elem];
  }
  return null;
}

function getValueElement( elem )
{
  if( document.getElementById ) {
    if( document.getElementById(elem) ) return document.getElementById(elem).value;
  } else if( document.all ) {
    if( document.all[elem] ) return document.all[elem].value;
  }
  return null;
}

function setValueElement( elem, val )
{
  if( document.getElementById ) {
    document.getElementById(elem).value = val;
  } else if( document.all ) {
    document.all[elem].value = val;
  }
}

function setFocus( elem )
{
  if( document.getElementById ) {
    document.getElementById(elem).focus();
  } else if( document.all ) {
    document.all[elem].focus();
  }
}

function disableElement( elem )
{
  if( document.getElementById ) {
    if( document.getElementById(elem) != null ) document.getElementById(elem).disabled = true;
  } else if( document.all ) {
    if( document.all[elem] != null ) document.all[elem].disabled = true;
  }
}

function changeStyle( elem, style ) {
	if (document.all) {
		// pour ie
		document.getElementById(elem).style.setAttribute('cssText', style);
	} else {
		document.getElementById(elem).setAttribute('style', style);
	}
}

function checkAll( check, label, nb )
{
	var oDiv = null;
	
	for ( var i=0; i < nb; i++ )
	{
    if( document.getElementById ) {
  		oDiv = document.getElementById(label+i);
    } else if( document.all ) {
      oDiv = document.all[label+i];
    }
		if ( check == 0 )
			oDiv.checked = false;
		else
			oDiv.checked = true;
	}
}

//--- DreamFunctions (not really) ---//
function MM_swapImgRestore()
{
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages()
{
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d)
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage()
{
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function hideSelects( action )
{
  //possible values for action are 'hidden' and 'visible'
  if( action != 'visible' ) action = 'hidden';

  if( !navigator.appName.indexOf("MSIE 7") )
  {
    for( var S = 0; S < document.forms.length; S++ )
    {
      for( var R = 0; R < document.forms[S].length; R++ ) {
        if( document.forms[S].elements[R].options ) {
          document.forms[S].elements[R].style.visibility = action;
        }
      }
    } 
  }
}

function toogleLang( nom, idVisible )
{
  document.getElementById(nom + "0").style.display = "none";
  document.getElementById(nom + "1").style.display = "none";
  document.getElementById(nom + idVisible).style.display = "block";
  
  return true;
}

