$(document).ready(function() {
	
	$(".odpoved h3 a").live("click",function(){
		var obal = $(this).closest(".odpoved");
		obal.find("div").slideDown();
		
		var ot = obal.find("h3 a").text();
		obal.find("h3")
			.empty()
			.text(ot);
		return false;
	});
	
	$(".odpoved:not(:first)").each(function(){
		var ot = $(this).find("h3").text();
		$(this).find("h3")
			.empty()
			.html("<a href=''>"+ot+"</a>")
			
		
		$(this).find("div").hide();
	});
	
	
	$("#nh_otazky a").click(function(){
		var o = $(this).attr("rel");
		$(this).closest("ul").find("a").removeClass("act");
		$("#nh_flash .nh_act_prvek").removeClass("act");
		$("#nh_odpoved")
			.find(".odpoved")
				.hide()
			.end()
			.find(".o_"+o+"").fadeIn();
		$("#nh_flash .nh_act_prvek[rel="+o+"]").addClass("act");
		
		$(this).addClass("act");
		
		return false;
	});
	
	$("#nh_flash .nh_act_prvek").each(function(){
		var rel = $(this).attr("rel");
		var text = $("#nh_right").find("div.title_o_"+rel).text();
		
		$(this).attr("title",text);
	})
	.click(function() {
		var rel = $(this).attr("rel");
		$("#nh_otazky").find("a[rel="+rel+"]").click();
		
	});
	
	/*var txt_time = 3000;
	var counter = 1;
	var txt_span = $("#nh_bublina span");
	var txt_rotator = function() {
		if(counter > 0 && (counter % (txt_span.length) == 0)) counter = 0;
		
		txt_span.fadeOut("normal",function(){
		      
				txt_span.text(txt[counter-1]).fadeIn()}
		);
		setTimeout(txt_rotator,txt_time);
		counter++;
		
	}
	
	setTimeout(txt_rotator,txt_time/2);*/
	
});
