    function verification_contact(formulaire)
    {
        var msg = 'Veuillez remplir les champs suivants :\n';
        var nbErreurs = 0;
        if (formulaire.name.value == '')
        {
            msg += 'Votre nom\n';
            nbErreurs++;
        }
        if (formulaire.email.value == '')
        {
            msg += 'Votre adresse e-mail\n';
            nbErreurs++;
        }
        else
        {
            if (!verifierMail(formulaire.email))
                return false;
        }
        if (formulaire.object.value == '')
        {
            msg += 'L\'objet du message\n';
            nbErreurs++;
        }
        if (formulaire.message.value == '')
        {
            msg += 'Le message\n';
            nbErreurs++;
        }
        if (nbErreurs > 0)
        {
            alert(msg);
            return false;
        }
        return true;
    }

function verifierMail(champ)
{
    var str = champ.value;
    var regexp = new RegExp("^[a-zA-Z0-9_\\-\\.]{3,}@[a-zA-Z0-9\\-_]{2,}\\.[a-zA-Z]{2,4}$", "g");
    if (!regexp.test(str))
    {
        alert("L'adresse e-mail n'est pas valide !");
        return false;
    }
    return true;
}
function	upd(total)
{
	var url = 'bin.php';
	var parametres = 'op=recalc';
	for (i = 0; i < total; i++)
	{
		line = 'qte_' + i;
		parametres += '&' + $F('ref_' + i) +'=' + $F(line);
	}
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: get_product
		}
	);
}

function	cmd(total)
{
	var url = 'bin.php';
	var parametres = 'op=recalc';
	for (i = 0; i < total; i++)
	{
		line = 'qte_' + i;
		parametres += '&' + $F('ref_' + i) +'=' + $F(line);
	}
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres
/*			onComplete: get_product*/
		}
	);
	window.location.replace("cmd.php");
}
function	add_product(id, cid_start)
{
/*	var url = 'bin.php';
	var parametres = 'op=add_product&id=' + id;

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: showAll
		}
	);*/
    window.location.replace("bin.php?result=ok&id=" + id+ "&op=add_product&cid_start=" + cid_start);
}

var _id;

function updateQte(qte, id)
{
    if (isNaN(qte))
    {
        qte = 0;
        document.getElementById('qte_' + id).value='0';
    }
	var url = 'bin.php';
	var parametres = 'op=upd_qte&id=' + id + '&qte=' + qte;
    _id = id;

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: updatePrice
		}
	);
}

function updateTotal()
{
	var url = 'bin.php';
	var parametres = 'op=getTotal';

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: showTotal
		}
	);
}

function showTotal(requete)
{
    $('totalValue').innerHTML = requete.responseText;
}

function updatePrice(requete)
{
	$('total_price_' + _id).innerHTML = requete.responseText;
}

function closeDiv(id)
{
    document.getElementById(id).style.display='none';
}

function	del_product(id)
{
	var url = 'bin.php';
	var parametres = 'op=del_product&id=' + id;

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: redirect
		}
	);
}

function redirect()
{
    window.location.replace('bin.php');
}

function	get_product()
{
	var url = 'bin.php';
	var parametres = 'op=get_product'

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: show_product
		}
	);
}

function show_product(requete)
{
	$('show_bin').innerHTML = requete.responseText;
}

function show_bin(requete)
{
	$('bin').innerHTML = requete.responseText;
	if (document.getElementById("show_bin"))
		get_product();
}

function	empty_bin()
{
	var url = 'bin.php';
	var parametres = 'op=empty_bin';

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: parametres,
			onComplete: redirectBin
		}
	);
}

function redirectBin()
{
    window.location.replace('bin.php');
}
function check_cmd()
{

	a = 0;
    if (document.getElementById('cgvs').checked)
        $('cgvs_error').innerHTML = "";
    else
    {
        $('cgvs_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
        a = a + 1;
    }
    if (document.getElementById('login').value == '' && document.getElementById('email_login').value == '')
    {
        if (document.getElementById('lastname').value == '')
        {
            $('lastname_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('lastname_error').innerHTML = "";
        if (document.getElementById('firstname').value == '')
        {
            $('firstname_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('firstname_error').innerHTML = "";
        if (document.getElementById('tel').value == '')
        {
            $('tel_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('tel_error').innerHTML = "";
        if (document.getElementById('mail').value == '')
        {
            $('mail_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('mail_error').innerHTML = "";
        if (document.getElementById('adr').value == '')
        {
            $('adr_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('adr_error').innerHTML = "";
        if (document.getElementById('codep').value == '')
        {
            $('codep_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('codep_error').innerHTML = "";
        if (document.getElementById('town').value == '')
        {
            $('town_error').innerHTML = " <img src=\"images/icons/cancel.png\" title=\"Vous avez oubli&eacute; ce champs\" alt=\"Vous avez oubli&eacute; ce champs\" valign=\"bottom\">";
            a = a + 1;
        }
        else
            $('town_error').innerHTML = "";
    }
    if (a > 0)
	{
		$('error').innerHTML = "Veuillez remplir tous les champs obligatoires !";
		return (false);
	}
	return (true);
}