function exec( espace, extra ) {
        document.location.href = "./actions.php?fuse=" + espace + "&" + extra;
}

function dctGo( espace, extra ) {
        document.location.href = "./actions.php?fuse=directNav&scr=" + espace + "&" + extra;
}

function wac_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 wac_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 wac_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 wac_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 wac_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 wac_setValueElement( elem, val )
{
  if( document.getElementById ) {
    document.getElementById(elem).value = val;
  } else if( document.all ) {
    document.all[elem].value = val;
  }
}

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

function wac_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 wac_changeStyle( elem, style ) {
	if (document.all) {
		// pour ie
		document.getElementById(elem).style.setAttribute('cssText', style);
	} else {
		document.getElementById(elem).setAttribute('style', style);
	}
}

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

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

  if( navigator.appName.indexOf("MSIE") )
  {
    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 wac_switchLayer( layer_ref )
{
  var etat = eval( "wac_etat_"+layer_ref );
  
  if( etat == 'block' ) {
    etat = 'none';
  } else {
    etat = 'block';
  }
  eval( "wac_etat_"+layer_ref+" = '"+etat+"'" );

  if( document.all ) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.display = etat");
  }
  if( document.layers ) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].display = etat;
  }

  if( document.getElementById && !document.all ) {
    hza = document.getElementById( layer_ref );
    hza.style.display = etat;
  }
}

var state = 'none';

function wac_showhide( layer_ref )
{
  if( state == 'block' ) {
    state = 'none';
  } else {
    state = 'block';
  }

  if( document.all ) { //IS IE 4 or 5 (or 6 beta)
    eval( "document.all." + layer_ref + ".style.display = state");
  }
  if( document.layers ) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].display = state;
  }

  if( document.getElementById && !document.all ) {
    hza = document.getElementById( layer_ref );
    hza.style.display = state;
  }
}

function wac_openclose( layer_ref, etat )
{
  if( etat == 'block' ) {
    var noetat = 'none';
  } else {
    var noetat = 'block';
  }

  if( document.all ) { //IS IE 4 or 5 or 6
    if( eval("document.all."+layer_ref+".style.display == '"+noetat+"'") ) {
      eval( "document.all." + layer_ref + ".style.display = '" + etat + "'" );
    }
  }
  if( document.layers ) { //IS netscape 4 or below
    if( document.layers[layer_ref].display == noetat ) {
      document.layers[layer_ref].display = etat;
    }
  }

  if( document.getElementById && !document.all ) {
    if( document.getElementById( layer_ref ).style.display == noetat ) {
      document.getElementById( layer_ref ).style.display = etat;
    }
  }
}

function isNumeric( strString )
{
  var strValidChars = "0123456789";
  var blnResult     = true;
  var strChar;

  //--- 2nd paramètre de la fonction optionnel
  //    => Autres caractères autorisés (exemple "-,." pour accepter les nombre négatifs et à virgule)
  if( arguments.length == 2 ) strValidChars += arguments[1];

  if( strString.length == 0 ) return false;

  //--- test strString consists of valid characters listed above
  for( i = 0; i < strString.length && blnResult == true; i++ ) {
    strChar = strString.charAt( i );
    if( strValidChars.indexOf(strChar) == -1 ) blnResult = false;
  }

  return blnResult;
}

function clean_string( obj ) {
  obj.value = obj.value.replace( "’", "'" );
}

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 swf_showFlash( file, width, height, trans )
{
  document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width + (height != '' ? '" height="'+height : '') + '">\n' );
  document.write( '<param name="movie" value="'+file+'">\n' );
  document.write( '<param name="quality" value="high">\n' );
  if( trans ) document.write( '<param name="wmode" value="transparent">\n' );
  document.write( '<embed src="'+file+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width + (height != '' ? '" height="'+height : '') +'"></embed>\n' );
  document.write( '</object>\n' );
}

function showhideAllSelectsIE( action )
{
  if( browser.isIE4x )
  {
    //possible values for action are 'hidden' and 'visible'
    if( action != 'visible' ) action = 'hidden';

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