$(document).ready(function() {
	$(".submenu div div").animate({'opacity':0}, 1);	
	$(".submenu").css({"height":0,"padding":0});
	$(".haveSubmenu").click(function(){
		showSubmenu(this.id);
		return false;
	});
	
	var actSub = 0;
	
	function showSubmenu(elId){
		if(actSub != 0)$("#s-" + actSub).animate({"opacity":0}).css({'z-index':0,'display':'none'});
		$(".submenu").animate({"height":30,"padding-top":18});
		$("#s-" + elId).animate({"opacity":1}).css({'z-index':1,'display':'block'});
		actSub = elId;
	}
		
	$(".submenu a").each(function(){
		if($(this).attr("class") == "act")showSubmenu($(this).parent().attr("id").replace("s-",""));
	});
		
	$(".guideline a div").hide();
	$(".guideline a").mouseenter(function(){ 
		$(".guideline a div").hide();
		$("#" + this.id + " div").show(150);		
	}).mouseleave(function(){
		$(".guideline a div").hide(150);
	});

	
	
	$(".guidlineContent").slideUp(0);
	
	$(".guideline a").click(function(event){
/* 		event.stopImmediatePropagation(); */
		
		showContent(this.id);
/* 		return false;		 */
	});
	


	
	var lastH3=null;
	$('#acc1 h3').next().hide();
	$('#acc1 h3').click(function(){
		if(lastH3)$(lastH3).removeClass("act")
			.animate({"padding-top":3,"padding-bottom":0})
			.next()
			.slideUp();
		$(this)
			.addClass("act")
			.animate({"padding-top":10,"padding-bottom":3})
			.next()
			.slideDown();
		lastH3=this;
	})
	
	
	/* dekorace tabulky */
	
	$("#right table tr td").addClass("solid").addClass("dotted");
	
	var i=0;
	$("#right table").each(function(){
		$(this).addClass("a"+i);
		i++;
	});

	$("#right table").each(function(){

		if($("."+$(this).attr("class")+" tr").length > 2){
			$("."+$(this).attr("class")+" tr:even").addClass("even");
		};

	});
/* 	$("#right table tr:even").addClass("even"); */
	
	$("#right table tr td:last-child").addClass("noBorderRight");
	$("#right table tr:last td").addClass("noBorderBottom");
	$("#right table tr td:first-child").addClass("aLeft");
/* 	$("#right table tr td:last-child").css({"width":70}); */



	/* novinky */
	var refreshIntervalId = setInterval("$('.arrNRight').click();",5000);	
	

	$(".slideshow").each(function(){
		
		var items=$(this).children(".item").hide().css({'position':'absolute'});
		items.first().show();
		var index=0;
		if(items.length == 1 || items.length < 1){
			$(this).children(".arrNLeft").hide();
			$(this).children(".arrNRight").hide();
		};


		$(this).children(".arrNLeft").click(function(){
			$(items[index]).stop().hide(1).addClass("hide");
			index--;
			if (index<0) index=items.length-1;
			$(items[index]).stop().fadeIn(/*400,1*/).css('overflow','visible').removeClass("hide");
			clearInterval(refreshIntervalId);
			refreshIntervalId = setInterval('$(".arrNRight").click();',5000);	
		});
		$(this).children(".arrNRight").click(function(){
			$(items[index]).stop().hide(1).addClass("hide");
			index++;
			if (index>items.length-1) index=0;
			$(items[index]).stop().fadeIn(/*400,1*/).css('overflow','visible').removeClass("hide");
			clearInterval(refreshIntervalId);
			refreshIntervalId = setInterval('$(".arrNRight").click();',5000);	
		});
		
		
	}).css({'height':'280px'});
	
		
	
	
	$(".zoomI").zoomimage({
		border: 20,
		centered: true,
		hideSource: false
	});

});



