var leer = 0;

var korb = parent.korb.substring(0, parent.korb.length-3);
if (korb != null) items = korb.split('###');
for (i in items) items[i] = items[i].split('|');


function runden(wert) {
  k = (Math.round(100 * (wert + 0.00001)) / 100 + 0.001) + '';	
  k = k.substring(0, k.indexOf('.') + 3);
  return k;
}

		 
function rechnen() {
  zsumme = runden(parseFloat(items[i][2]))*runden(parseFloat(items[i][3]));
  gesamtpreis += runden(parseFloat(items[i][2]))*runden(parseFloat(items[i][3]));
  ergebnis = runden(zsumme);
  return ergebnis;
}


function gesamt() {
  gesamtpreis = runden(gesamtpreis);
  return gesamtpreis
}


function iad(name,nummer,preis,menge,ur) {
  var t = '';
  if (parent.sprache == 'd'){
    t = 'Möchten Sie '+menge+' x '+name+' in Warenkorb ablegen ?';
  }
  else{
    t='Do you want to put '+menge+' x '+name+' to the basket ?';
  }
  if (confirm(t)){
    parent.korb += name+'|'+nummer+'|'+preis+'|'+menge+'|'+ur+'###';
  }
}

function del_me(cnt) {
  var t = '';
  if (parent.sprache == 'd'){
    t = 'Wollen Sie diesen Artikel löschen ?';
  }
  else{
    t='Do you want to delete this item ?'
  }
  if (confirm(t)) {
    var del = '';
    korb = parent.korb.substring(0, parent.korb.length-3);
    if (korb != null){
      items = korb.split('###');
    }
    for (i in items) {
      if (i != cnt){
       del += items[i] +'###';
      }
    }
    parent.korb = del;
    self.location = 'warenkorb.htm';
  }
}


function updaten() {
  var upd = '';
  var tmp = '';
  for (i in items) {
    upd += eval('document.forms[0].menge'+i+'.value')+'~';
  }
  upd = upd.substring(0, upd.length-1);
  upd = upd.split('~');
  for (i in items) {
    items[i][3] = upd[i];
    tmp += items[i][0]+ '|' +items[i][1]+ '|' +items[i][2]+ '|' +items[i][3]+ '###';
  }
  parent.korb = tmp;
  self.location = 'warenkorb.htm';
}

function wkloeschen(){
  if (confirm('Möchten Sie diesen Artikel wirklich löschen?')){
      parent.korb = ''; self.location='warenkorb.htm';
  }
}

function bestellen(){
  if (parent.korb != ''){
      parent.frames[4].location = 'bestellen.htm';
  }
  else{
    alert('\nEs sind keine Artikel im Warenkorb.\nThere are no items in the basket.');
  }

}


function wahl(sp) {
  if (sp   ==   '0'){
    parent.sprache = 'd'
  }
  if (sp   ==   '1'){
    parent.sprache = 'e'
  }
  if (sp   ==   '2'){
    parent.sprache = 'f'
  }
  parent.frames[4].location=parent.frames[4].location.href;
  parent.frames[4].location.reload();
}



function nn(a) {
  if (a == 'D'){
    window.open ('post.htm', 'newWin', 'scrollbars=yes,status=yes,width=400,height=300,resizable=yes');
  }
  else{
    window.open ('postint.htm', 'newWin', 'scrollbars=yes,status=yes,width=400,height=300,resizable=yes')
  }
}

function dpd(a) {
  if (a == 'D'){
    window.open ('dpd.htm', 'newWin', 'scrollbars=yes,status=yes,width=400,height=300,resizable=yes');
  }
  else{
    window.open ('postint.htm', 'newWin', 'scrollbars=yes,status=yes,width=400,height=300,resizable=yes')
  }
}
