function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function copiedonnees(){
	document.formUser.liv_nom.value=document.formUser.ad_nom.value;
	document.formUser.liv_adresse.value=document.formUser.ad_adresse.value;
	document.formUser.liv_cp.value=document.formUser.ad_cp.value;
	document.formUser.liv_tel.value=document.formUser.ad_tel.value;
	document.formUser.liv_commune.value=document.formUser.ad_commune.value;
	document.formUser.liv_email.value=document.formUser.ad_email.value;
	document.formUser.liv_pays.value=document.formUser.ad_pays.value;
}

function trim(string)
{
	return string.replace(/(^\s*)|(\s*$)/g,'');
} 

function verifieformulaire(){
	
	
	var msgdeb  = "";
	var msg = "";
	var msgLiv = "";
	var i = 0;
	var j = 0;
	if ( (trim(document.formUser.ad_nom.value)).length == 0 ) {
		msg += "nom\n";
		i += 1;
	}
	if ( (trim(document.formUser.ad_adresse.value)).length == 0 ) {
		msg += "adresse \n";
		i += 1;
	}
	if ( (trim(document.formUser.ad_cp.value)).length == 0 ) {
		msg += "code postal \n";
		i += 1;
	}
	if ( (trim(document.formUser.ad_tel.value)).length == 0) {
		msg += "téléphone \n";
		i += 1;
	}
	
	if ( (trim(document.formUser.ad_commune.value)).length == 0 ) {
		msg += "commune \n";
		i += 1;
	}
	// controle livraison
	if ( (trim(document.formUser.liv_nom.value)).length == 0 && msg.length == 0) {
		msgLiv += "nom\n";
		j += 1;
	}       
	if ( (trim(document.formUser.liv_adresse.value)).length == 0 && msg.length == 0) {
		msgLiv += "adresse \n";
		j += 1;
	}       
	if ( (trim(document.formUser.liv_cp.value)).length == 0 && msg.length == 0) {
		msgLiv += "code postal \n";
		j += 1;
	}    
	 
	if ( (trim(document.formUser.liv_tel.value)).length == 0 && msg.length == 0) {
		msgLiv += "téléphone \n";
		j += 1;
	} 
	
	  
	if ( (trim(document.formUser.liv_commune.value)).length == 0 && msg.length == 0) {
		msgLiv += "commune \n";
		j += 1;
	} 
	     
	if ( i > 1 ) {
		msgdeb  = "Les champs suivants sont obligatoires :\n";
	}else{
		msgdeb  = "Le champ suivant est obligatoire : \n";
	}
	
	if (msg.length > 0 ) {
		msg  = msgdeb + msg ;
		alert (msg);
		return false;
	}
	if ( j > 1 ) {
		msgdeb  = "Les champs suivants sont obligatoires :\n";
	}else{
		msgdeb  = "Le champ suivant est obligatoire : \n";
	}
	if (msgLiv.length > 0 ) {
		msgdeb = "Une adresse de livraison est obligatoire.\n" + msgdeb;
	}
	if (msgLiv.length > 0 ) {
		msgLiv  = msgdeb + msgLiv ;
		alert (msgLiv);
		return false;
	}
	return true;
}

function checkCommande( qte ){		
	if ( qte <= 0 ) {
		alert("Vous devez saisir une quantité > 0.");
		return false;
	}
	return true;
	
}
