function Megvesz(term_id)

  {

   hiba = "";



   meret = document.getElementById('meret_'+term_id);;

   szin  = document.getElementById('szin_'+term_id);;

   darab = document.getElementById('darab_'+term_id);;

   cikkszam = document.getElementById('cikkszam_'+term_id);



   if(darab.value=="") {

       hiba += 'Nincs darabszám megadva!'+'\n';

   }



   if(hiba=="") {    $.post('kosarba_tesz.php',

                            {mode: 'betesz',

                               cikkszam: ''+cikkszam.value+'',

                               term_id: ''+term_id+'',

                               meret: ''+meret.options[meret.selectedIndex].value+'',

                               szin: ''+szin.options[szin.selectedIndex].value+'',

                               darab: ''+darab.value+''},

                            function(xml){alert('The product is in the basket!');}

                           );

                     meret.selectedIndex = 0;

                     szin.selectedIndex  = 0;

                     darab.value         = "";

   } else {          alert(hiba);

   }

  }
  
  
  
   function Confirm0(term_id,i)

  {

        if(confirm('Would you really like to get the product out of the basket?')) {

             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('Would you really like to get the product out of the basket?')) {

                 Torol(array_id_str);

            } else {

                 darab.value = darab_h.value;

                 UjraSzamolOsszeg(term_id);

            }

       }

  }



  function Torol(array_id_str)

  {        if(!keres) {

                    keres = true;

                    document.getElementById('keres_'+array_id_str).innerHTML = 'Wait...';

                    $.post('inline/kosarba_tesz.php',

                            {mode: 'torol',

                              array_id: ''+array_id_str+''},

                            function(xml){

                                 setTimeout('document.location.reload(false)',1);

                            }

                    );

            }

  }


