
function $save(id){
  if ( $(id) ) $(id).submit();
  return false;
  }

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

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 menudiv (obj){
  var Parent = $(obj).getParent().getParent();
  var DivBody = Parent.getElement('div.mod_body');
  var DivName = Parent.getElement('div.mod_name');
  DivBody.toggleClass('hide');
  if ( DivName.hasClass('active' ) )
    DivName.removeClass('active')
  else
    DivName.addClass('active');
  }

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

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

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

function clear_input( input ){
  var input = $(input);
  if ( input ){
    input.addEvent('focus',function(){  if ( input.get('title') == input.get('value') ) input.set('value',''); });
    input.addEvent('blur',function(){ if ( input.get('value') == '' ) input.set('value', input.get('title') ); });
    }
  }

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

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){
  $('comment_form').removeClass('hide');
  obj.setStyle('display','none');
  }

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

window.addEvent('domready', function() {
  var dodajdokoszyka = $('dodajdokoszyka') ;
  if ( dodajdokoszyka ){
    dodajdokoszyka.addEvent('click',function(e){
      new Event(e).stop();
      $('order_add_form').submit();
      });
    }
});

