function openCenteredWindow(nameWindow, url, width, height)
{
	if ( width == null )
	{
		width = screen.width / 2;
	}
	
	if ( height == null )
	{
		height = screen.height / 2;
	}
	
	var left = ( screen.width / 2 ) - ( width / 2 ),
	top = ( screen.height / 2 ) - ( height / 2 ),
	position;
	
	if ( navigator.appName.indexOf("Microsoft") >= 0 ) //Pour Microsoft Internet Explorer
	{
		position = ",left=" + left + ",top=" + top;
	}
	
	else //Pour Netscape
	{
		position =",screenX=" + left + ",screenY=" + top;
	}
	
	var win = window.open(url, nameWindow, "scrollbars=yes,status=yes,resizable=yes,width=" + width + ",height=" + height + position);
	
	win.focus();
}





function changeUrlParameter(paramName, paramValue)
{
	var url = window.location.href;
	var ndx = url.indexOf("?");
	
	if (ndx != -1)
	{
		var strParams = url.substring(ndx, url.length);
		url = url.substring(0, ndx);
		
		ndx = strParams.indexOf("?" + paramName);
		var firstParam = "&";
		
		if (ndx == -1)
			ndx = strParams.indexOf("&" + paramName);
		else
			firstParam = "?";
		
		
		if (ndx != -1)
		{
			var ndx2 = strParams.indexOf("&", ndx + 1);
			if (ndx2 == -1)
				ndx2 = strParams.length;
			
			// ndx est mis sur le début de &paramName
			// ndx2 est mis sur la fin de paramValue ou la fin de strParams
			
			var tmp1 = strParams.substring(0, ndx);
			var tmp2 = strParams.substring(ndx2, strParams.length);
			
			url = url + tmp1 + firstParam + paramName + "=" + paramValue + tmp2;
		}
		else
		{
			url = url + strParams + "&" + paramName + "=" + paramValue;
		}
	}
	else
	{
		url = url + "?" + paramName + "=" + paramValue;
	}
	
	
	return url;
}


function selectComboValue(formName, inputName, inputValue)
{
	var form = document.forms[formName];
	var combo = form[inputName];
	
	for (var i = 0; i < combo.options.length; i++)
	{
		if (combo.options[i].value == inputValue)
		{
			combo.options.selectedIndex = i;
			return;
		}
	}
}

