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, 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()
{
  browserName = navigator.appName;
  browserVer  = parseInt(navigator.appVersion);
  if( browserName == "Microsoft Internet Explorer" & browserVer >= 4 ) {
    window.external.AddFavorite( 'http://www.otiazur.fr/', 'Office de Tourisme \'Les Coteaux d\'Azur\'' );
  }
}

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;
	}
}

