function change_quantite(nom,valeur) {
	if ( fields = document.getElementsByName(nom) ) {
		quantite = fields[0].value;
		quantite = parseInt(quantite) + parseInt(valeur);
		if ( quantite < 0  ) { quantite = 0;  }
		if ( quantite > 99 ) { quantite = 99; }
		fields[0].value = quantite;
	}
}
function raz_quantite(nom) {
	if ( fields = document.getElementsByName(nom) ) {
		fields[0].value = 0;
		if ( fields[0].form && fields[0].form.submit ) {
			fields[0].form.submit();
		}
	}
}
function focusAndExit(champ) {
	if (champ.select) champ.select();
	if (champ.focus)  champ.focus();
	return false;
}
function check_pwd(champ1,champ2) {
	if (champ1.value==champ2.value) return true;
	else if (champ1.value=='')
	  if (champ2.value=='')  return true;
	  else {
		alert('Vous devez saisir deux fois le mot de passe pour le confirmer');
		return focusAndExit(champ1);
	  }
	else if (champ2.value=='') {
	  alert('Vous devez saisir deux fois le mot de passe pour le confirmer');
	  return focusAndExit(champ2);
	} else {
	  alert('La confirmation du mot de passe n\'est pas valide (les deux champs sont differents)');
	  return focusAndExit(champ1);
	}
}
function check_pwd_en(champ1,champ2) {
	if (champ1.value==champ2.value) return true;
	else if (champ1.value=='')
	  if (champ2.value=='')  return true;
	  else {
		alert('You must fill the 2 passwords fields (to confirm it)');
		return focusAndExit(champ1);
	  }
	else if (champ2.value=='') {
	  alert('You must fill the 2 passwords fields (to confirm it)');
	  return focusAndExit(champ2);
	} else {
	  alert('Your password confirmation is invalid (the two fields are differents)');
	  return focusAndExit(champ1);
	}
}
function check_isset(champ,nomchamp) {
	if (champ.value=='') {
		alert('Vous devez remplir le champ > '+nomchamp+' <');
		return focusAndExit(champ);
	} else return true;
}
function check_isset_en(champ,nomchamp) {
	if (champ.value=='') {
		alert('You must fill the field > '+nomchamp+' <');
		return focusAndExit(champ);
	} else return true;
}
function check_email(champ) {
	with (champ)
	{
	  if (value=='') return true;
	  apos=value.indexOf('@');
	  dotpos=value.lastIndexOf('.');
	  lastpos=value.length-1;
	  if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) {
		alert('Adresse email non valide');
		return focusAndExit(champ);
	  } else return true;
	}
}
function check_email_en(champ) {
	with (champ)
	{
	  if (value=='') return true;
	  apos=value.indexOf('@');
	  dotpos=value.lastIndexOf('.');
	  lastpos=value.length-1;
	  if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) {
		alert('Your E-mail is invalid (bad format)');
		return focusAndExit(champ);
	  } else return true;
	}
}

