function kaufen(bestellnummer,feld_bestellnummer,feld_bestellmenge,kommisionsfeld,root,keinwarenkorbrefresh) {

  if(feld_bestellnummer!="") {
    var bestellnummer=document.kaufformular[feld_bestellnummer].value;
  }

  var bestellmenge = document.kaufformular[feld_bestellmenge].value;
  var url = root + "artikel_kaufen.php?bestellnummer=" + bestellnummer+ "&bestellmenge=" + bestellmenge+ "&keinwarenkorbrefresh=" + keinwarenkorbrefresh;

  if (kommisionsfeld==1) {
    var cheight = 160
  } else {
    var cheight = 80
    url = url + "&kaufen=1";
  }

  var cleft = screen.width/2-100;
  var ctop = screen.height/2-100;

  var cWindow = window.open(url,"kaufen","left="+cleft+", top="+ctop+", height="+cheight+", width=320, dependent=yes, resizable=no, scrollbars=no");
  if (!cWindow.opener) cWindow.opener = self;
  if (cWindow.focus != null) cWindow.focus();

}

function popup(dokument,parameter,breite,hoehe,popupname,drucken) {

  if (!breite) breite = 800;
  if (!hoehe) hoehe = 700;
  if (!popupname) popupname = "PopUp";
  if (!drucken) drucken=0;

  breite2 = breite/2;
  hoehe2 = hoehe/2;

  var links  = screen.width/2-breite2;
  var rechts = screen.height/2-hoehe2;
  var url    = root + "popup.php?dokument="+dokument+"&drucken="+drucken+"&parameter="+parameter+"&breite="+breite+"&hoehe="+hoehe+"&links="+links+"&rechts="+rechts;

  var cWindow = window.open(url,popupname,"left="+links+", top="+rechts+", height="+hoehe+", width="+breite+", dependent=yes, resizable=yes, scrollbars=yes");
  if (!cWindow.opener) cWindow.opener = self;
  if (cWindow.focus != null) cWindow.focus();

}


function ConfirmAction(theLink,Message)
{
    if (Message == '' || typeof(window.opera) != 'undefined') {
      return true;
    }

    var is_confirmed = confirm(Message);
    if (is_confirmed) {
      if ( typeof(theLink.href) != 'undefined' ) {
        theLink.href ;
      } else if ( typeof(theLink.form) != 'undefined' ) {
        theLink.form.action ;
      }
    }

    return is_confirmed;
}

function ConfirmBestellStatus(theLink,Auftragsnummer)
{
    var meldung = ConfirmActionBestellstatus.replace(/auftragsnummer/g, Auftragsnummer);

    if (ConfirmActionBestellstatus  == '' || typeof(window.opera) != 'undefined') {
      return true;
    }

    var is_confirmed = confirm(meldung);
    if (is_confirmed) {
      if ( typeof(theLink.href) != 'undefined' ) {
        theLink.href ;
      } else if ( typeof(theLink.form) != 'undefined' ) {
        theLink.form.action ;
      }
    }

    return is_confirmed;
}

function OnEdit() {
  IstEdit=1;
}

function IstEditiert() {

  if (IstEdit==1) {
    IstEdit=0;
    alert (EditMsg);
    return false;
  } else {
    return true;
  }

}

function ShowValue(Objekt)
{
  var breite = 320;
  var hoehe = 280;

  var breite2 = breite/2;
  var hoehe2 = hoehe/2;

  var links  = screen.width/2-breite2;
  var rechts = screen.height/2-hoehe2;
  
  var url    = root + "popup.php?dokument=clipboard.php&parameter="+Objekt.value+"&breite="+breite+"&hoehe="+hoehe+"&links="+links+"&rechts="+rechts;

  var cWindow = window.open(url,"Zwischenablage","left="+links+", top="+rechts+", height="+hoehe+", width="+breite+", dependent=yes, resizable=yes, scrollbars=yes");
  if (!cWindow.opener) cWindow.opener = self;
  if (cWindow.focus != null) cWindow.focus();

}