remplir_livraison = function() {

	$('com_nom').value 					= $('client_nom').value;
	$('com_prenom').value 			= $('client_prenom').value;
	$('com_adresse').value 			= $('client_adresse').value;
	$('com_cp').value 					= $('client_cp').value;
	$('com_ville').value 				= $('client_ville').value;

	return false;
}

panier_changer_qte = function(these,prod_id) {
	i = these.selectedIndex;
	val = these.options[i].value;
	if(val == 0) {
		if(confirm("Voulez vous retirer ce produit de votre panier ?") == false) {
			return;
		}
	}
	window.location = "panier.php?prod_id=" + prod_id + "&chg_qte=" + val;
}

sidentifier = function() {
	email = $('login_email').value;
	pwd = $('login_mdp').value;
	
  param = "email=" + email + "&pwd=" + pwd;
  
	var ajax = new Ajax.Request('/ajax/sidentifier.php',{
		method: 'POST',
		parameters: param,
		evalScripts: false,
    asynchronous: true,
		onComplete: function(response) {
       if(response.responseText == "0") {       
        msg = "Votre email/mot de passe sont invalides.";
        $('encart_login_msg').innerHTML = msg;
        $('encart_login_msg').style.display = 'block';         
       } else {
				msg = "Vous êtes identifié.";
				$('encart_login_msg').innerHTML = msg;
        $('encart_login_msg').style.display = 'block';  
				$('encart_login').style.display = "none";
        window.location.reload();
       }
		}		
	}); 

}

nbsabonner = function() {
	email = $('abo_email').value;
	
  param = "email=" + email;
  
	var ajax = new Ajax.Request('/ajax/nbsabonner.php',{
		method: 'POST',
		parameters: param,
		evalScripts: false,
    asynchronous: true,
		onComplete: function(response) {
       if(response.responseText == "0") {       
        msg = "Votre email est incorrect.";
        $('encart_abonl_msg').innerHTML = msg;
        $('encart_abonl_msg').style.display = 'block';         
       } else {
				msg = "Vous êtes à présent abonné.";
				$('encart_abonl_msg').innerHTML = msg;
        $('encart_abonl_msg').style.display = 'block';  
				$('encart_abonl').style.display = "none";
       }
		}		
	}); 	
}

search_vin_reset = function() {
  search_vin_change(true);
}
search_vin_change = function(is_reset) {
  
  
  if(is_reset != true) {
  region      = $('search_region').value;
  couleur     = $('search_couleur').value;
  appellation = $('search_appellation').value;
  domaine     = $('search_domaine').value;
  millesime   = $('search_millesime').value;
  prix        = $('search_prix').value;
  } else {
  region      = 0;
  couleur     = 0;
  appellation = 0;
  domaine     = 0;
  millesime   = 0;
  prix        = 0;
  }
  
  param  = "region=" + region;
  param += "&couleur=" + couleur;
  param += "&appellation=" + appellation;
  param += "&domaine=" + domaine;
  param += "&millesime=" + millesime;
  param += "&prix=" + prix;  
  
	var ajax = new Ajax.Updater('form_search', '/ajax/moteur_vin.php',{
		method: 'POST',
		parameters: param,
		evalScripts: false,
    asynchronous: true	
	});
  
}
