function initMenu()
{
  $('#menu div ul').hide();
  $('#menu h2').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('#menu div ul')) && (checkElement.is(':visible'))) {
		$('ul.db').removeClass('db').css('display','block').siblings('h2').removeClass('selected');
		$('#menu ul:visible').slideUp('normal').siblings('h2').removeClass('selected');
      	return false;
      }
      if((checkElement.is('#menu div ul')) && (!checkElement.is(':visible'))) {
		$('ul.db').removeClass('db').css('display','block').siblings('h2').removeClass('selected');
        $('#menu ul:visible').slideUp('normal').siblings('h2').removeClass('selected');
        checkElement.slideDown('normal').siblings('h2').addClass('selected');
        return false;
        }
      }
    );
  }

$(function(){
													 
	initMenu();
	
	var path = location.pathname.substring(1);
  	if ( path ) {
    	$('#menu div ul li a[href$="' + path + '"]').attr('class', 'selected').parents('ul').css('display','block');
	}
	
	$("a[rel=fancybox], a[rel=clearbox]").fancybox({ 'zoomSpeedIn': 1000, 'zoomSpeedOut': 0, 'enableEscapeButton': true, 'overlayShow': true, 'hideOnContentClick': false, 'autoScale': true, 'centerOnScroll': true, 'titlePosition': 'inside', 'titleShow': false, 'overlayColor': '#0687AD' });
	
	$('#otazky ul').cycle({ 
    	fx: 'scrollUp', 
		speed: 1200, 
    	timeout: 10000 
	});
	
});

Cufon.replace('.cuf, .cufon, h1:not(".nocufon"), h2:not(".nocufon"), h3:not(".nocufon"), h4:not(".nocufon"), h5:not(".nocufon")', {
     hover: true
});
