//    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('Dieser Artikel wurde Ihrem Warenkorb zugegeben, mit der von Ihnen gew\u00fcnschten Menge. \n\nSie k\u00f6nnen jederzeit den Inhalt Ihres Warenkorbes kontrollieren, indem Sie auf "Bestellung" klicken. \n\nIhre Bestellung wird nicht ohne Ihre Zustimmung weggesandt.')
}

function addto (form) { //add to cart but stay on the same 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];
// check to see if you are using <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){ //add to cart and go to a new page
addto(form)
location.href=page;
}

function setform(form,page){
var formname=form;
formname.method='GET';
formname.action=page;
}
