jQuery(function() {
	var $ = jQuery;
	
	$('.js-hide').hide();
	
	$('.js-show').css('visibility','visible').css('display','inline');
	
	$('#form_toggle').click(function(){
    $('#register_form').fadeIn('slow');
    if($('#box-no-results').attr('id')) {
      $('#box-no-results').hide();
      $('#registrer_condition').show();
      /*$('#registrer_condition').slideDown('slow');*/
      setTimeout(function(){
        $.scrollTo($('#register_form').prev(),800);  
      },100); 
    } else {
      setTimeout(function(){
        $.scrollTo($('#register_form'),800);  
      },100);
    }
    
    
    /*$('body').scrollTo($('#form_toggle button'));
    setTimeout(function(){
      $.scrollTo($('#register_form').prev(),800);  
    },100);
    window.scrollBy(0,50);*/
    return false;
  })
  
  $('#search_toggle').click(function(){
    $('#search_form').fadeIn('slow');
      $.scrollTo($('#search_form'),800);
    return false;
  })
  
  $('#search_toggle2').click(function(){
    $('#search_form').fadeIn('slow');
      $.scrollTo($('#search_form'),800);
    return false;
  })
  
  $('#approove_checkbox').click(function(){
    /*setTimeout(function(){*/
      toggleButtonLabel('#approove_checkbox','#toggle_button','uložit a odeslat','uložit')
    /*},500)*/
  })
  
  function toggleButtonLabel(path_checkbox,path_label,on_label,off_label) {
    /*alert($(path_label).text());*/
    if($(path_checkbox).is(':checked')) {
      $(path_label).text(on_label);
    } else {
      $(path_label).text(off_label);
    }
  }
});