$(document).ready(function() {
	// Showing optional parts of form
	$('.show-hidden').hide();
	$('.show-radio').change(function() {
	  if ($(this).val() == 'ano') {
	    $(this).parents('tr').next('.show-hidden:hidden').fadeIn();
		} else {
	    $(this).parents('tr').next('.show-hidden:visible').fadeOut();
		}
	});
	$('.show-trigger').click(function() {
	  if ($(this).attr('checked') != false) {
	    set = $(this).nextUntil(':input');
	    set.not('label').fadeIn();
		} else {
	    set = $(this).nextUntil(':input');
	    set.not('label').fadeOut();
		}
	});

	// Sliding box Akce
	var akceStav = 1;
	$("#akce:not(:animated) a").mouseover(function() {
		$("#akce.nohover .in").stop(true).animate({"top": "0px"}, 'slow');
		$("#akce").addClass('hover');
		$("#akce").removeClass('nohover');
	});
  $("#akce a").mouseout(function() {
		$("#akce.hover .in").stop(true).animate({"top": "-100px"}, "slow");
		$("#akce").addClass('nohover');
		$("#akce").removeClass('hover');
	});

	// Showing Akce box on homepage for 2 seconds
	setTimeout(function() {
		$(".hp #akce.hover div.in").animate({"top": "-=100px"}, "slow");
		$(".hp #akce").addClass('nohover');
		$(".hp #akce").removeClass('hover');
	}, 2000);

	// Webkit Font Fix
	if ($.browser.webkit) {
	  $("h1, #main .decorated-inner a .span").css({
			'font-size': '110%'
		});
		$("h1").css({
			'font-size': '250%'
		});
	}

	// Floating tooltips
	$('.block_with_bg span.tooltip').each(function() {
	  $(this).addClass('canceled');
		$(this).parent().append('<span class="extra-tooltip" title="' + $(this).attr('title') + '"></span>');
	});
	$('.block_with_bg span.tooltip').tooltip({
	  extraClass: "hidden"
	});
	$('#main .tooltip').tooltip({
	  top: -15,
		left: 5,
		track: true
	});
	$('#main .extra-tooltip').tooltip({
	  top: -15,
		left: 5,
		track: true
	});

	// Fancybox
	$('#col-a a.fancy:has(img)').fancybox({
	  padding: 2,
	  overlayOpacity: 0.8,
	  overlayColor: "#000000",
	  titleShow: false
	});
	
	// Sliding format
  $('#easy-slide.dynamic:not(.default-opened):not(.static) h2, .slide-menu-head:not(.default-opened)').nextUntil('.slide-menu-head, .slide-menu-end').hide();
  $('#easy-slide.dynamic:not(.static) h2, .slide-menu-head').css('cursor', 'pointer');

  $('.slide-menu-head').click(function(){
    $('.slide-menu-head:not(.persist)').nextUntil('.slide-menu-head, .slide-menu-end').hide();
		$('.slide-menu-head:not(.persist)').removeClass('show');
		$(this).nextUntil('.slide-menu-head, .slide-menu-end').toggle();
		$(this).addClass('show');
	});
	
	// IE7+ Text Shadow Fix
	$("#ie h1, #ie #main .decorated, #ie #main .decorated-inner a .span").textShadow({
	  x: "1px",
	  y: "0px",
	  radius: "3px",
	  color: "#000000",
	  opacity: "50"
	});
	
	
	// Extra
  $('#easy-slide.dynamic:not(.static) h2').click(function() {
    $('#easy-slide.dynamic:not(.persist) h2').nextUntil('#easy-slide h2').hide();
		$('#easy-slide.dynamic:not(.persist) h2').removeClass('show');
		$(this).nextUntil('#easy-slide.dynamic h2').toggle();
		$(this).addClass('show');
	});
  $('#easy-slide:not(.static) h2').click(function() {
    $('#easy-slide:not(.persist) h2').nextUntil('#easy-slide h2').hide();
		$('#easy-slide:not(.persist) h2').removeClass('show');
		$(this).nextUntil('#easy-slide h2').toggle();
		$(this).addClass('show');
	});
	
	// Form
	//$(':not(.primarily).fd-15').parent().hide();
	//$('.primarily.fd-14').parent().show();
	var changeOptionList = function() {
		if ($('#form-fd-9 option:selected').index() == 1) {
		  $('.fd-15').show();
		  $('.fd-14').hide();
		} else {
		  $('.fd-14').show();
		  $('.fd-15').hide();
		}
	};
	changeOptionList();
	
	$('#form-fd-9').change(changeOptionList);
	
	//
	if(getId('hppopup')) showHpPopup();
});
/**/

