$(document).ready(function(){
	$(".submenu ").hide();

	$("a.popup").each(function (i) {
		this.onclick=function() { return !window.open(this.href); }
	});
	
	$(".menu li").hover(function() {
		$(this).children(".submenu").show('fast');
		$(this).children("a").addClass('akt');
	},function() {
		$(this).children(".submenu").hide('fast');
    $(this).children("a").removeClass('akt');  
	});
	
	$(".news > div:odd").css("float","right");
	
	$(".cls").hover(function (){
		id=$(this).attr("id");
		if (id=="rrgb") { y=-65; }
		if (id=="rggb") { y=-130; }
		if (id=="rgbb") { y=-195; }
		$(this).parents("div.rgb").css("background-position","0px "+y+"px");
	},function (){
		$(this).parents("div.rgb").css("background-position","0px 0px");
	});
	
	$(".vlastni_obsah p:first").css("color","#464cd6");
	$(".vlastni_obsah p:first").css("font-weight","bold");
	n=4;
	$("div.galnahled div").each(function (i){
		j=i+1;
		if (j==n) {
			$(this).css("margin-right","0");
			n=n+4;
		}
	});
	
	$("ul.seznam li > span").css({
		paddingLeft: '12px',
		paddingRight: '12px',
		paddingTop: '0px',
		paddingBottom: '0px',
		display: 'block',
		position: 'absolute',
		left: '0px',
		top: '0px',
		zIndex: '9',
		width: '60px',
		height: '23px',
		lineHeight: '23px',
		color: '#0a1190'
	});
	
	/*$("ul.seznam li:first span,ul.seznam li:first a").css({
		backgroundColor: '#c4c9ff',
		fontWeight: 'bold'
	});*/
	
	$(".rgb ul li a").hover(function () {
		$(this).textShadow();
	},function () {
		$(this).textShadowRemove();
	});

/****************** Pridani tridy externalLink externim odkazum *********************************/	
 
	$(document).ready(function() {
    $('.obal1 a').filter(function() {
    return this.hostname && this.hostname.split(":")[0] !== location.hostname.split(":")[0];
    }).addClass('externalLink');
  });
  
/***************************************************/
	
	$(".datum").datepicker($.datepicker.regional["cz"]);
		
	/* fce banner */
	
	$(window).load(function () {
		
		var obj=$(".flash");
		var wui=obj.width();
		var hui=obj.height();
		var zindexuj=$(".bb");
		var cache=$(".bb img");
		var d=cache.length;
		
		zindexuj.hide();
		
		var i=x=0;
		var e,wx,hy;
		var int=setInterval(function() {
			if (x==0) {
				e=d-(i+1);
				obj.children("span").css("z-index",1);
				obj.children("div").css("z-index",1);
				zindexuj.eq(e).css("z-index",d);
				zindexuj.eq(e).next().css("z-index",(d*10));
				objev(e);
				wx=((cache.eq(e).width())-wui);
				hy=((cache.eq(e).height())-hui);
			}
			x+=2;
			y=Math.ceil(hy-((Math.cos(x*Math.PI/(Math.floor(wx/2)))*Math.floor(hy/2))+Math.floor(hy/2)));
			zindexuj.eq(e).css("left",(x*(-1))+"px");
			zindexuj.eq(e).css("top",(y*(-1))+"px");
			if (x>=wx) {
				zmiz(e);
				i=(i==(d-1))?0:i+1;
				x=0;
			}
		},35);
		
		function zmiz(e) {
			zindexuj.eq(e).fadeOut('slow');
			zindexuj.eq(e).next().fadeOut('slow');
		}
		
		function objev(e) {
			zindexuj.eq(e).fadeIn('slow');
			zindexuj.eq(e).next().fadeIn('slow');
		}
	
	});
		
});
