<!-- glob BasketItem -->
<!-- (c) Copyright 2004 GS Software -->
<!-- 27jan2004 -->
function BasketItem(Item,ID,NumberPrices, Prices, FromQuants, ToQuants, Quantity, Textin, Attribut1, Attribut2, Attribut3, productvatrate,weight,VariantDescription){
  this.Item = Item;
  this.ID = ID;
  this.NumberPrices = NumberPrices;
  this.Prices = Prices;
  this.FromQuants = FromQuants;
  this.ToQuants = ToQuants;

  this.Quantity=Quantity;
  this.Textin=Textin;
  this.Attribut1=Attribut1;
  this.Attribut2=Attribut2;
  this.Attribut3=Attribut3;
  this.productvatrate=productvatrate;
  this.weight=weight;
  this.VariantDescription=VariantDescription;
}

theBasket = [new BasketItem("","","","","","","","","","","","","","")];
var co="";
var cur=0;
var cur2=0;
var startmod = 0;
var tellpath="";
var tellpath2="";

function OrderFormular(formname,formcontent)
{
this.formname = formname;
this.formcontent = formcontent;
}

theOrderFormular = [new OrderFormular("","")];
GesamtWarenwert=0;
mypaymentnr=0
mypaymentvalue=""
mypaymenttext=""
zahlart = 0
myshipmentnr=0
myshipmentvalue=""
myshipmenttext=""


function buyItem(variant, ID, newQuantity , textin, Attribut1, Attribut2, Attribut3, productvatrate,weight){
  newItem = variant.ProductShortName;//unescape(newItem);
  var index=-1;
  if (! Attribut1) {Attribut1=""};
  if (! Attribut2) {Attribut2=""};
  if (! Attribut3) {Attribut3=""};
  if (! textin)    {textin=""};
  arrayPrices = new Array();
  arrayFromQuants = new Array();
  arrayToQuants = new Array();
  NumberPrices = variant.numberPrices;
  myVariantDescr = unescape(variant.VariantDescr);
  for(var ipr = 0 ; ipr<variant.numberPrices; ipr = ipr+1){
    arrayPrices[ipr] = variant.scPr[ipr+1].price;
    arrayFromQuants[ipr] = variant.scPr[ipr+1].fromQuant;
    arrayToQuants[ipr] = variant.scPr[ipr+1].toQuant;
  }

  Prices = arrayPrices.join(":");
  FromQuants = arrayFromQuants.join(":");
  ToQuants = arrayToQuants.join(":");
  if (!( (parseFloat(newQuantity) == parseInt(newQuantity) )&&( parseInt(newQuantity) > 0) ) || isNaN(newQuantity))
    alert(Loc_Integer);
  else {
    if(Attribut1.substr(Attribut1.length-1,1)=='?')
      alert(Loc_Please+ Attribut1.substr(0,Attribut1.length-1)+Loc_Select);
    else {
      if(Attribut2.substr(Attribut2.length-1,1)=='?')
        alert(Loc_Please+ Attribut2.substr(0,Attribut2.length-1)+Loc_Select);
      else {
        if(Attribut3.substr(Attribut3.length-1,1)=='?')
          alert(Loc_Please+ Attribut3.substr(0,Attribut3.length-1)+Loc_Select);
        else {
          if(confirm(newQuantity+' x '+newItem+' in den Warenkorb legen?')){
            for (var i=1; i<= theBasket.length-1; i++){
              if ((theBasket[i].Item==newItem)&&(theBasket[i].Attribut1==Attribut1)&&(theBasket[i].Attribut2==Attribut2)&&(theBasket[i].Attribut3==Attribut3)&&(theBasket[i].Textin==textin))
              {
                if (window.confirm(Loc_Add))
                  if((parseInt(theBasket[i].Quantity)+parseInt(newQuantity)) > 9999) {
                    alert("Die maximale Bestellmenge ist 9999!");
                    theBasket[i].Quantity = 9999;
                  } else
                    theBasket[i].Quantity=parseInt(theBasket[i].Quantity)+parseInt(newQuantity);
                else
                  if (parseInt(newQuantity) > 9999){
                    alert("Die maximale Bestellmenge ist 9999!");
                    newQuantity = '9999';
                  } else
                    theBasket[i].Quantity=newQuantity;

                theBasket[i].Textin=textin;
                index=i;
              }
            }

            if (index<0){
              if (parseInt(newQuantity) > 9999){
                alert("Die maximale Bestellmenge ist 9999!");
                newQuantity = '9999';
              }
              var neuItem=new BasketItem(newItem,ID,NumberPrices,Prices,FromQuants,ToQuants,newQuantity,textin, Attribut1, Attribut2, Attribut3, productvatrate, weight, myVariantDescr);
              theBasket=theBasket.concat([neuItem]);
            }
/*            top.Hauptframe.location.reload(); */
/*            top.NewsFrame.location.reload();*/
            top.SetNews("","1");
            top.showItemsneu();
            top.basketframe.location = "permbasket.htm";
          }
        }
      }
    }
  }
}

function resetShoppingBasket(){
  theBasket=theBasket.slice(0,1);
  GesamtWarenwert=0;
  mypaymentnr=0
  mypaymentvalue=""
  mypaymenttext=""
  zahlart = 0
  myshipmentnr=0
  myshipmentvalue=""
  myshipmenttext=""
}

