var dsk_b = {
  frm: "frm",
  afl: 'afl',
  dtxt: "d_txt",
  dtxt2: "d_txt2",
  itemCount: 0,
  wkb: 0,
  frmc: 0,
  prsb: 0,
  Start: function() {

  },
  AddItem: function() {
   if(this.prsb==1) {
    wk.add_b(this.frm,this.afl);
    this.prsb=0;
    this.frm="frm";
    this.afl="afl";
    new Effect.Fade("prsb",{duration:0.7});
    this.Update("price");
   }
  },
  Update: function(id,val) {
   switch(id) {
    case "dtxt":
     new Ajax.Updater(this.dtxt2,'index.php', {
                       method:'post',
                       evalScripts: true,
                       postBody:'smp=103&id='+dsk_b.frm+'&afl='+dsk_b.afl,
                       onCreate:function(resp)   {dsk.incLoading();},
                       onFailure:function(resp) {
                        alert('Fehler: '+resp.statusText);
                       },
                       onException:function(resp,exeption) {
                        alert('Ausnahme: '+exeption);
                       },
                       onComplete:function(resp,val) {
                        new Effect.BlindDown(dsk_b.dtxt2,{duration:1,delay:1});
                        var tmp = dsk_b.dtxt;
                        dsk_b.dtxt = dsk_b.dtxt2;
                        dsk_b.dtxt2=tmp;
                        dsk.decLoading();
                       }
     });
     break;
    case "price":
     new Ajax.Updater('dropzone','index.php', {
                       method:'post',
                       evalScripts: true,
                       postBody:'smp=101&id='+dsk_b.frm+'&frm='+dsk_b.frm+'&afl='+dsk_b.afl,
                       onCreate:function(resp)   {dsk.incLoading();},
                       onFailure:function(resp) {
                        alert('Fehler: '+resp.statusText);
                       },
                       onComplete:function(resp) {dsk.decLoading();},
                       onException:function(resp,exeption) {
                        alert('Ausnahme: '+exeption);
                       }
     });
     break;
   }
  },
  UpdatePrice: function() {
   if(this.frmc) {
    this.frmc=0;
    new Effect.BlindUp(this.dtxt,{duration:1});
    this.Update("dtxt");
   }

   if(this.frm!='frm' && this.afl!="afl" && this.prsb==0) {
     this.prsb=1;
     new Effect.Appear("prsb",{duration:1.5});
   }
  },
  blendIn: function() {
   $("container_basic").style.display="block";
   $("prsb").style.display="none";
   new Effect.BlindUp("d_txt2",{duration:0});
   new Effect.Grow("a5",{duration:0.7,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("lang",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a6",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a7",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a8",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a500",{duration:0.7,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a1000",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a1500",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Grow("a2000",{duration:0.7,delay:0.2,direction: 'top-left',opacityTransition:Effect.Transitions.linear});
   new Effect.Appear("1st",{duration:0.5,delay:0.6});
   new Effect.Appear("2nd",{duration:0.5,delay:1.1});
   new Effect.Pulsate("1st",{duration:1.5,delay:1.5});
   new Effect.Pulsate("2nd",{duration:1.5,delay:3.0});

   new Draggable('a5', {revert:true,ghosting:true});
   new Draggable('lang', {revert:true,ghosting:true});
   new Draggable('a6', {revert:true,ghosting:true});
   new Draggable('a7', {revert:true,ghosting:true});
   new Draggable('a8', {revert:true,ghosting:true});
   new Draggable('a500', {revert:true,ghosting:true});
   new Draggable('a1000', {revert:true,ghosting:true});
   new Draggable('a1500', {revert:true,ghosting:true});
   new Draggable('a2000', {revert:true,ghosting:true});

   Droppables.add('dropzone', {
    hoverclass:'dropzone_h',
    onDrop:function(element, dropon, event) {
     new Ajax.Updater('dropzone','index.php', {
      method:'post',
      evalScripts: true,
      postBody:'smp=101&id='+encodeURIComponent(element.id)+'&frm='+dsk_b.frm+'&afl='+dsk_b.afl,
      onCreate:function(resp)   {dsk.incLoading();},
      onFailure:function(resp)  {alert('Fehler: '+resp.statusText);},
      onComplete:function(resp) {dsk.decLoading();},
      onException:function(resp,exeption) {alert('Ausnahme: '+exeption);}
     });
    }
   });
  }
};
