 //    Copyright (C) 1998   Zhong Yang  oops@beida.com V1.2
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                  

// Sources libres optimisés par Guy Capra, Créatique 1999 (www.creatique.com)
//
// Vous pouvez réutiliser ce code sous les termes de la licence GPL (Général Public Licence).
// En d'autres termes, vous pouvez l'utiliser personnellement et/ou commercialement 
// à la condition de transmettre aussi les droits d'accès et de modification aux sources,
// et de ne rien enlever ou modifier à l'entête (le présent texte).

function Inscrit(){
alert('Cet article a bien \u00e9t\u00e9 inscrit dans votre panier avec la quantit\u00e9 indiqu\u00e9e. \n\nVous pouvez voir votre commande : \n En cliquant sur le bouton "Votre  panier" \n\n Pour modifier la quantit\u00e9:\n Dans votre panier enlever la ligne a modifier et refa\u00eetes votre commande \n\n Imprimez votre bon de commande.\n\nEnvoyez votre bon de commande accompagn\u00e9 de votre r\u00e9glement \340  \n l adresse suivante :  \n\n NOUVLHAIRDIFF.\n 33 rue des bains.\n 76200 DIEPPE')
}

function addto (form) { //ajoutez au chariot, mais le séjour sur la même page 
  var entry=form;
  var a=0;
  boundry = new Array(entry.elements.length);
  boundry[0]=0;
   for(x=1;x<entry.elements.length;x++){
	if(entry.elements[0].name==entry.elements[x].name)
         {
           a++;
           boundry[a]=x;
         }
   }   

j=0;
for(i=0;i<=a;i++) {
  j=boundry[i];
// vérifiez si vous utilisez <select>
if(isNaN(entry.elements[j+1].length)){
     var description=entry.elements[j+1].value;
  } else {
     var opindex=entry.elements[j+1].selectedIndex;
     var description=entry.elements[j+1].options[opindex].text;
  }
  var ind=j+2;
  while(entry.elements[ind].name==entry.elements[ind-1].name)
  {
     opindex=entry.elements[ind].selectedIndex;
     description = description+" "+entry.elements[ind].options[opindex].text;
     ind++;
  }
  store_name=entry.elements[ind].value;
  product_name=entry.elements[ind].name;
  quantity=entry.elements[j].value;
  price=entry.elements[j+1].name;

  var num=parseInt(entry.elements[j].value)
  if(!isNaN(num) && num>=0 )
  {
  document.cookie ="crea"+store_name+"+"+description
+ "+" + product_name + "=" + quantity +
"+" + document.referrer  +"+"+ price + 
"; path=/"+"";
   }       
 }
 Inscrit()
}

function  addtocart(form,page){ //ajouter au panier et aller vers une nouvelle page
addto(form)
location.href=page;
}

function setform(form,page){
var formname=form;
formname.method='GET';
formname.action=page;
}
