$(document).ready(function() {  

	// otevreni odkazu do noveho okna	
	// $("a.nw").attr("title", "Tento odkaz se otevře do nového okna");
	$('a.nw').click( function() {
	    window.open( $(this).attr('href') );
	    return false;
	});
	
	//menu
  	$("#navigation").ndMenu();
  	//validace formu
  	$("#contact form").ndFormValidator({autoSizeAlert: "false"});
  	$("#registrace").ndFormValidator({autoSizeAlert: "true"});

	// rotace novinek
	$("#news ul").rotator({ms: 3500});
	$("#allwords").focus();

	// zebrovita tabulka
	$("#links li:last").addClass("last");
	$("#links li").each(function(i){
		if( i % 2 == 0 ){  }
		if( i % 2 != 0 ){ $(this).addClass("odd"); }
	});
	
	// zebrovita tabulka
	$("#news li").each(function(i){
		if( i % 2 == 0 ){  }
		if( i % 2 != 0 ){ $(this).addClass("odd"); }
	});	
	
	// bloky u kontaktu
	$("#contactBlocks .block").hide();	
	$("#contactBlocks h3 a").click(function() {
		var href = $(this).attr("href");		
		
		$("#contactBlocks").find(href).show(1);
		$("#contactBlocks .block").hide();
		
		return false;
	});
	
	// hover nad kontaktni tabulkou
	$("#contactBlocks #pracovnici tr").hover(
	function() {
		$(this).addClass("hover");
	},
	function() {
		$(this).removeClass("hover");
	});
	
	// dokumenty ke stazeni
	$(".fileList li ul").hide();	
	$(".fileList li").click(function(){		
		$(".fileList li ul").hide();
		$(this).children("ul").toggle();
	});

	// rozbaleni vetve podle #	
	var urlHash = location.hash;
	$(".fileList a.section").each(function(){
		var thisHref = $(this).attr("href");
						
		if( thisHref == urlHash ){
			$(this).parent().children("ul").show();
		}
	});		
	
	// -------------------
	
	$("#neprehlednete .text table").hide();
	$("#neprehlednete .text table:first").show();
	
	var timer = 0;
	var index = 0;
	var max = $("#neprehlednete .text table").size();
	
	timer = setInterval(function(){									
		if(index < max){ index++; }
		else{ index=1; }
		
		$("#neprehlednete .text table").hide();
		$("#neprehlednete .text table").eq(index-1).show();			
		
	}, 3000);	
	
	// -------------------
	
	$("a.fancybox").fancybox({type:"image"});
			
});

