$(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready (a little sooner that page load)
  $('.slickbox').hide();
  $('#podrslick').hide();
  $('div[id^=detd]').hide();
  
 // shows and hides and toggles the slickbox on click  
  $('.slick').click(function() {
	var $this = $(this);
	if( $this.is('.slick') ) {
		$('.slickbox').slideDown('slow');
		$(this).removeClass('slick');
              $(this).addClass('slickup');
              $(this).addClass('vybrat3a');
              $(this).removeClass('vybrat3');
		$('.obor').addClass('obor2');
		$('.obor').removeClass('obor');
		$('.vybrat4').addClass('vybrat5');
		$('.vybrat4').removeClass('vybrat4');
	} else {
		$(this).removeClass('slickup');
              $(this).addClass('slick');
              $(this).addClass('vybrat3');
              $(this).removeClass('vybrat3a');
		$('.slickbox').slideUp('slow');
		$('.obor2').addClass('obor');
		$('.obor2').removeClass('obor2');
		$('.vybrat5').addClass('vybrat4');
		$('.vybrat5').removeClass('vybrat5');

	}
	$(this).text($(this).text() == 'Zobrazit vsechny obory' ? 'Skryt vsechny obory' : 'Zobrazit vsechny obory');
    return false;
  });

  $('.slick2').click(function() {
	var $this = $(this);
	if( $this.is('.vybrat2') ) {
		$('#podrslick').slideDown('slow');
              $(this).addClass('vybrat2a');
              $(this).removeClass('vybrat2');
	} else {
		$('#podrslick').slideUp('slow');
              $(this).addClass('vybrat2');
              $(this).removeClass('vybrat2a');

	}
	$(this).text($(this).text() == 'Zobrazit podrobnosti' ? 'Skryt podrobnosti' : 'Zobrazit podrobnosti');
    return false;
  });



$('div[id^=oc]').click(function() {
	var $this = $(this);
	var x = $this.attr("id");
	$('#rules' + x).slideToggle(400);
	var z = $('#obor' + x).attr("className");
	if (z=="obor") {
		$('#obor' + x).removeClass('obor');
		$('#obor' + x).addClass('obor2');
		$(this).addClass('vybrat5');
		$(this).removeClass('vybrat4');

	} else {
		$('#obor' + x).removeClass('obor2');
		$('#obor' + x).addClass('obor');
		$(this).addClass('vybrat4');
		$(this).removeClass('vybrat5');
	}


	return false;
});

$('a[id^=d]').click(function() {
	var $this = $(this);
	var x = $this.attr("id");
	$('#det' + x).slideToggle(400);

	return false;
});
$('div[id^=td]').click(function() {
	var $this = $(this);
	var x = $this.attr("id");
	$('#de' + x).slideToggle(400);

	return false;
});


});