function menu (obj){
  var li = $(obj).getParent();
  var ul = li.getElement('ul');  
  ul.toggleClass('hide');  
  if ( li.hasClass('active' ) )
    li.removeClass('active')
  else if ( !ul.hasClass('hide') ) 
    li.addClass('active');
  }

/*--------------------------------------------------------------------------------------------------------------------------------*/
  
function swich_order_row ( obj ){
  var obj = $(obj);
  var className = obj.get('name') ;
  if( className ){
    if ( obj.get('value') )
      $$('.'+className).removeClass('hide');
    else
      $$('.'+className).addClass('hide');
    }
  }   

/*--------------------------------------------------------------------------------------------------------------------------------*/

function basket_list(obj){
  obj = $(obj);
  var href = obj.get('href');
  var quantity = obj.getPrevious('input').get('value');
  //href = href + quantity + '&return='+window.location.pathname+window.location.search;
  href = href + quantity + '&return='+window.location.href.replace("http://"+window.location.host,'');
  window.location.href = href;
  return false;
  }

/*--------------------------------------------------------------------------------------------------------------------------------*/
  
function add_comment(sub){
  var comment_form = $('comment_form');
  new Element('input',{'name':'sub','value':sub,'type':'hidden'}).inject(comment_form);
  comment_form.submit();  
  }

function show_comment_form(obj){
//console.log ( $('comment_form') );
  $('comment_form').removeClass('hide');
  obj.setStyle('display','none'); 
  }

function add_subproduct ( pid ){
  window.location.href = 'Order/Basket.html?add_product['+pid+']='+$('quantity_'+pid).get('value');  
  }
  
window.addEvent('domready', function() {
  var dodajdokoszyka = $('dodajdokoszyka') ;  
  if ( dodajdokoszyka ){
    dodajdokoszyka.addEvent('click',function(e){
      new Event(e).stop();
      $('order_add_form').submit();
      });
    }
});

