function Megvesz(term_id)
  {
   hiba = "";

   meret = document.getElementById('meret_'+term_id);
   szin  = document.getElementById('szin_'+term_id);
   darab = document.getElementById('darab_'+term_id);

   if(darab.value=="") {
       hiba += 'Nincs darabszám megadva!'+'\n';
   }

   if(hiba=="") {    $.post('kosarba_tesz.php',
                            {mode: 'betesz',
                               term_id: ''+term_id+'',
                               meret: ''+meret.options[meret.selectedIndex].value+'',
                               szin: ''+szin.options[szin.selectedIndex].value+'',
                               darab: ''+darab.value+''},
                            function(xml){alert('A terméket a kosárba raktuk!');}
                           );
                     meret.selectedIndex = 0;
                     szin.selectedIndex  = 0;
                     darab.value         = "";
   } else {          alert(hiba);
   }
  }
  
   function Confirm0(term_id,i)

  {

        if(confirm('Valóban ki akarod venni a terméket a kosárból?')) {

             Torol(i);

        }

  }


  function Blur(term_id,array_id_str)

  {

       darab = document.getElementById('darab_'+term_id);

       darab_h = document.getElementById('darab_h_'+term_id);

       if(darab.value=="") {

            darab.value = darab_h.value;

            UjraSzamolOsszeg(term_id);

       } else if(darab.value=="0") {

            if(confirm('Valóban ki akarod venni a terméket a kosárból?')) {

                 Torol(array_id_str);

            } else {

                 darab.value = darab_h.value;

                 if(darab.value=='0') {

                    document.getElementById('darab_'+term_id).value='1';

                    document.getElementById('darab_h_'+term_id).value='1';

                 }

                 UjraSzamolOsszeg(term_id);

            }

       }

       $.post('inline/kosarba_tesz.php',

                            {mode: 'modosit',

                              i: ''+array_id_str+'',

                              j: ''+document.getElementById('darab_'+term_id).value+''},

                            function(xml){}

       );

  }



  function Torol(array_id_str)

  {        if(!keres) {

                    keres = true;

                    document.getElementById('keres_'+array_id_str).innerHTML = 'Várjon...';

                    $.post('inline/kosarba_tesz.php',

                            {mode: 'torol',

                              array_id: ''+array_id_str+''},

                            function(xml){

                                 setTimeout('document.location.reload(false)',1);

                            }

                    );

            }

  }
