var
oubli_mail ="Veuillez saisir votre email, SVP";
oubli_civilite ="Veuillez saisir votre civilité, SVP";
oubli_nom ="Veuillez saisir votre nom, SVP";
oubli_adr ="Veuillez saisir votre adresse, SVP";
oubli_cp ="Veuillez saisir votre code postal, SVP";
oubli_ville ="Veuillez saisir votre ville, SVP";
oubli_pays ="Vous devez saisir un pays";
montant_depasse ="Le montant maximum pour une commande a été dépassé.";
qte_depasse ="La quantité maximale a été dépassée";
poids_depasse ="Le poids maximum pour une commande a été dépassé.";
montant_inf ="Le montant minimum pour une commande n'est pas réalisé.";
qte_inf ="La quantité minimum pour une commande n'est pas réalisée.";
poids_inf ="Le poids minimum pour une commande n'est pas réalisé.";
verif_region ="false";
oubli_region ="Vous devez saisir une région, SVP";
pays ="-";
port_pays ="Pays non disponible pour ce mode d'expédition";
oubli_telephone="Veuillez saisir votre n° de téléphone, SVP";
oubli_valide_cgv="Vous devez Valider les conditions générales de vente";
montant_achat="Montant de vos achats";
montant_duport="Frais de port";
montant_ctrbt="Montant contre remboursement";
montant_totalcde="Total de votre commande en";
reglement_par="Vous réglez par";
rglt_cheque="Chèque";
rglt_cb="Carte bancaire";
rglt_areception="A réception de la facture";
rglt_ctrb="Contre remboursement";
rglt_vir_post="Virement Postal";
rglt_vir_bank="Virement bancaire";
rglt_mdt_post="Mandat postal";
confirm_cde="Confirmez-vous cette commande ?";
devise="Euros";
oubli_prenom="Veuillez saisir votre prenom, SVP";



function valide()
{
var lib_paiement="";
calculport(); 
calcultva();
i="1";
  if (verif_region=="true") {
    if (primpays==pays && primregion=="") {
        {alert(oubli_region);
        document.cde.Emailperso.focus();

         i="0";
         }
    }

  }


  if (document.cde.Emailperso.value.length == 0)
       {alert(oubli_mail);
        document.cde.Emailperso.focus();

         i="0";
         }

 if (document.cde.Civilite.selectedIndex == 0)
       {alert(oubli_civilite);
        document.cde.Civilite.focus();

         i="0";
         }

if (document.cde.Nom.value.length == 0 && i == "1")
        {alert(oubli_nom);
        document.cde.Nom.focus();

         i="0";}
		 
if (document.cde.Prenom.value.length == 0 && i == "1")
        {alert(oubli_prenom);
        document.cde.Prenom.focus();

         i="0";}

if (document.cde.Adresse1.value.length == 0 && i == "1")
        {alert(oubli_adr);
         document.cde.Adresse1.focus();
         i="0";}

if (document.cde.Cp.value.length == 0 && i == "1")
        {alert(oubli_cp);
        document.cde.Cp.focus();
         i="0";}

if (document.cde.Ville.value.length == 0 && i == "1")
        {alert(oubli_ville);
        document.cde.Ville.focus();
         i="0";}
if (document.cde.telephone.value.length == 0 && i == "1")
        {alert(oubli_telephone);
        document.cde.telephone.focus();

         i="0";}
		 
if (document.cde.Pays.selectedIndex == 0 && i == "1") {
 alert(oubli_pays);
document.cde.Pays.focus();
 i="0";}

if (document.cde.trouve_port_transporteur.value=="false" && i == "1") {
  alert(port_pays);
  document.cde.Pays.focus();
 i="0";
}

if (document.cde.valide_cgv.checked==false && i == "1") {
  alert(oubli_valide_cgv);
  document.cde.valide_cgv.focus();
 i="0";
}

switch (type_paiement) {
  case 1 : lib_paiement=rglt_cheque;
  			break;
  case 2 : lib_paiement=rglt_cb;
  			break;
  case 3 : lib_paiement=rglt_areception;
  			break;
  case 4 : lib_paiement=rglt_ctrb;
  			break;
  case 5 : lib_paiement=rglt_vir_post;
  			break;
  case 6 : lib_paiement=rglt_vir_bank;
  			break;
  case 7 : lib_paiement=rglt_mdt_post;
  			break;
}

//if (i=="1") document.cde.submit();
if (i=="1") {
if (!confirm(montant_achat+" : \t"+document.cde.TotalAchat.value+" "+devise+"\r\n\r\n"+montant_duport+" : \t"+document.cde.Port_TTC.value+" "+devise+"\r\n\r\n"+montant_ctrbt+" : "+document.cde.Total_mnt_ctrbt.value+" "+devise+"\r\n\r\n"+montant_totalcde+" : \t"+document.cde.HTotal_cde.value+" "+devise+"\r\n\r\n"+reglement_par+" : \t"+lib_paiement+"\r\n\r\n"+confirm_cde)) return(false);
}
if (i=="1") {
   sauve_cookie();
   return(true);
}
else
return(false);
}


var pathname=location.pathname;
var myDomain=pathname.substring(0,pathname.lastIndexOf('/'))+'/';
var date_exp=new Date();
date_exp.setTime(date_exp.getTime()+(365*24*3600*1000));

function sauve_cookie(){
SetCookie('_Emailperso',document.cde.Emailperso.value,date_exp,myDomain);
SetCookie('_Societe',document.cde.Societe.value,date_exp,myDomain);
SetCookie('_Nom',document.cde.Nom.value,date_exp,myDomain);
SetCookie('_Prenom',document.cde.Prenom.value,date_exp,myDomain);
SetCookie('_Adresse1',document.cde.Adresse1.value,date_exp,myDomain);
SetCookie('_Adresse2',document.cde.Adresse2.value,date_exp,myDomain);
SetCookie('_Cp',document.cde.Cp.value,date_exp,myDomain);
SetCookie('_Ville',document.cde.Ville.value,date_exp,myDomain);
SetCookie('_telephone',document.cde.telephone.value,date_exp,myDomain);
SetCookie('_liv_societe',document.cde.liv_societe.value,date_exp,myDomain);
SetCookie('_liv_nom',document.cde.liv_nom.value,date_exp,myDomain);
SetCookie('_liv_prenom',document.cde.liv_prenom.value,date_exp,myDomain);
SetCookie('_liv_adr1',document.cde.liv_adr1.value,date_exp,myDomain);
SetCookie('_liv_adr2',document.cde.liv_adr2.value,date_exp,myDomain);
SetCookie('_liv_cp',document.cde.liv_cp.value,date_exp,myDomain);
SetCookie('_liv_ville',document.cde.liv_ville.value,date_exp,myDomain);
}





function SetCookie(name,value) {
 var argv=SetCookie.arguments;
 var argc=SetCookie.arguments.length;
 var expires=(argc>2) ? argv[2]:null;
 var path=(argc>3) ? argv[3]:null;
 var domain=(argc>4) ? argv[4]:null;
 var secure=(argc>5) ? argv[5]:false;

 document.cookie=name+"="+escape(value)+
          ((expires==null) ? "":("; expires="+expires.toGMTString()))+
          ((path==null) ? "":("; path="+path))+
          ((domain==null) ? "":("; domain="+domain))+
          ((secure==null) ? "; secure":"")

}

function disp(txt)  {
  document.write(txt);
}

function sto(valeur,nom){

if (nom!=""){
  if (valeur!=""){
    SetCookie("_"+nom,valeur,date_exp,myDomain);
  }
}

}


