function POPUP(url,nom,largeur,hauteur,options)
{		
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent = window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}
	
function ChangeUrl(formulaire, page)
{
	location.href = page + formulaire.options[formulaire.selectedIndex].value;
}

function showhide(layer_ref)
{
	// current state	
	state = null;

	if (document.all) 
	{	
		if (document.all[layer_ref].style.visibility == 'visible')
		{
			state = 'visible';
		}
	}
	
	if (document.layers) 
	{	
		if (document.layers[layer_ref].visibility == 'visible')
		{
			state = 'visible';
		}
	}
	
	if (document.getElementById && !document.all) 
	{	
		maxwell_smart = document.getElementById(layer_ref);
		if (maxwell_smart.style.visibility == 'visible')
		{
			state = 'visible';
		}
	}
	
	if (state == 'visible') 
	{
		state = 'hidden';
		disp = 'none';
	}
	else 
	{
		state = 'visible';
		disp = 'block';
	}

	if (document.all) 
	{ 
		//IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility ='"+ state+"'");
		eval( "document.all." + layer_ref + ".style.display ='"+disp+"'");
	}
	if (document.layers) 
	{ 
		//IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
		document.layers[layer_ref].display = disp;
	}
	if (document.getElementById && !document.all) 
	{
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.visibility = state;
		maxwell_smart.style.display = disp;
	}
}

function layer_show(layer_ref) 
{
	state = 'visible';
	disp = 'block';

	if (document.all) 
	{ 
		//IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility ='"+ state+"'");
		eval( "document.all." + layer_ref + ".style.display ='"+disp+"'");
	}
	if (document.layers) 
	{ 
		//IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
		document.layers[layer_ref].display = disp;
	}
	if (document.getElementById && !document.all) 
	{
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.visibility = state;
		maxwell_smart.style.display = disp;
	}
}

function layer_hide(layer_ref) 
{
	state = 'hidden';
	disp = 'none';

	if (document.all) 
	{ 
		//IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility = state");
		eval( "document.all." + layer_ref + ".style.display = disp");
	}
	if (document.layers) 
	{ 
		//IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
		document.layers[layer_ref].display = disp;
	}
	if (document.getElementById && !document.all) 
	{
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.visibility = state;
		maxwell_smart.style.display = disp;
	}
}

function change_select(elt, new_val)
{
	for(i=0; i<elt.options.length; i++)
	{
		if (elt.options[i].value == new_val)
		{
			elt.selectedIndex = i;
			return true;
		}
	}

}

//return the value of a specific checkbox
function return_value_checkbox(checkbox)
{
	user_input='';
	if (checkbox.checked)
	{
		user_input = checkbox.value
	}
	return user_input;
}

//return the value of a select
function return_value_select(id)
{
	user_input='';
	if (document.getElementById(id).options)
	{
		if (document.getElementById(id).options.length>0)
		{
			user_input = document.getElementById(id).options[document.getElementById(id).selectedIndex].value;
		}
	}

	return user_input;
}

// build part of a querystring
function qs(name, value)
{
	return '&'+name+'='+encodeURIComponent(value);
}

function fqs(name)
{
	//alert(name);
	//alert(document.getElementById(name).value);
	return '&'+name+'='+encodeURIComponent(document.getElementById(name).value);
}

