
function fontsize( size){
  var center = $('center');
  center.removeClass('normal');
  center.removeClass('medium');
  center.removeClass('big');
  center.addClass(size);
  Cookie.write('fontsize',size);
  $$('#fontsize a').removeClass('active');
  $('fs_'+size).addClass('active');
  }
  
/*--------------------------------------------------------------------------------------------------------------------------------*/

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 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();
      });
    }
});

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

function show_products(key,cat1,cat2){
  $('dol_name_list').getElements('div').addClass('hide');
  if (key) $('dol_name_'+key).removeClass('hide');
  $('dol_prods_list').getElements('div').addClass('hide');
  if ( cat2 ){
    cat2 = $('dol_prods_'+cat2);
    if ( cat2 ) cat2.removeClass('hide');
    }
  if ( cat1 ){
    cat1 = $('dol_prods_'+cat1);    
    if ( cat1 ) {
      cat1.removeClass('hide');
      cat1.getElement('span').setStyle('display', cat2 ? 'block' : 'none' );
      }
    }
  }

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

function pulse( element , _start , _stop ) {
  var myFx = new Fx.Tween( $(element) , { 'duration' : 'long' } );
  myFx.start('opacity', _start , _stop ).chain(function(){  
    if ( _stop == 1 )
      pulse(element,1,0.5);
    else
      pulse(element,0.5,1);
    });
};

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

window.addEvent('domready', function() {
  var ludzik_pulse = $('ludzik_pulse');
  if ( ludzik_pulse ){
    if ( !Browser.Engine.trident )
      pulse ( ludzik_pulse , 1 , 0.5 );
    /*
    ludzik_pulse.getElements('img').each(function(el){ 
      pulse( el , 1 , 0.5 );
      });    
    */
    }
});

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