function trim(s) {
    return s.replace(/^\s+/, '').replace(/\s+$/, '');
}
function ltrim(s) {
    return s.replace(/^\s+/, '');
}

function rtrim(s) {
    return s.replace(/\s+$/, '');
}
function copy() {

		if (document.forms[0].detail_prod.value.length <= 0)
		{
				document.forms[0].detail_prod.value = document.forms[0].commentaire_prod.value;
		}

	}
function controle(champ, nbmax) 
	{
//	LongueurMax = champ.value.maxlength ;
	LongueurMax = nbmax
	document.forms[0].nbre.value = champ.value.length;
	
		if (champ.value.length > LongueurMax) 
		{
			champ.value = champ.value.substring(0, LongueurMax) + "...";
			document.forms[0].nbre.value = LongueurMax;
		}
	}
function ResetOrder() 
{
	if (document.TableSet.OrderBy.value!="") 
	{
	document.TableSet.OrderBy.value="";
	document.TableSet.Direct.value="";
	}
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField && limitCount) {
		if (limitField.value.length > limitNum) {
			limitField.value = limitField.value.substring(0, limitNum);
		} else {
			limitCount.innerHTML = limitNum - limitField.value.length;
		}
	}
}
function Focus(champ) {
	document.forms[0].elements[champ].focus();
}

// JavaScript Document
function enabled() {
	vNb = document.frecordset.Ref.length;
	if (vNb == 0) {
		//document.frecordset.Action.disabled=false;
		document.getElementById("Activate").disabled=true;
	}
	if (vNb > 0) {
		//document.frecordset.Action.disabled=false;
		document.getElementById("Activate").disabled=false;
	}
}
<!--
// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}
