/* ------------------------------------ Globalni funkce ---------------------------------------*/

Cufon.replace('h1, #left-sidebar strong.header, .justFinished h2, .inspirative h2');

$(function(){
	$("#logos li a img").css("display","none");
});
$(window).load(function(){
	var imgHeights = new Array();
	
	$("#logos a img").each(function (i) {
	i = i+1;	
	imgHeights["image"+i]=$(this).height();
	$(this).parent("a").css({height: imgHeights["image"+i]})
	$("#logos li a img").css("display","block");
	});
});
$(function(){
	$("#logos img").hover(function() {
		$(this).css("left","-176px");
	}, function () {
		$(this).css("left","0px");
	});
});
$(function(){
	$(".finishedBlock").hover(function() {
		$(this).css("background","#f1f1f1");
	}, function () {
		$(this).css("background","#fff");
	});
	$(".article").hover(function() {
		$(this).css("background","#f1f1f1");
	}, function () {
		$(this).css("background","#fff");
	});
	$("table tr").hover(function() {
		$(this).find("td").css("background","#f7f7f7");
	}, function () {
		$(this).find("td").css("background","#fff");
	});
});

/* ------------------------------------ menu - přebarvování ---------------------------------------*/
// deklarace globálního pole, které obsahuje delky jednotlivých prvku
// spanLengths["item<poradové cislo>"] = delka v px
var spanLengths = new Array();
var maxwidth = 143;

$(function(){
	$("ul#menu li a span").each(function (i) {
		i = i+1; // zvýšení poradového čísla o "1"
		$(this).addClass("item"+i); // pridá trídu item + poradové císlo
                $(this).css({width: $(this).width()+1+"px"}); // Mac FF fix
		spanLengths["item"+i]=$(this).width(); // delka aktualního prvku
		if ($(this).width() >= maxwidth) {
			spanLengths["item"+i]=$(this).width()-15;
			$(this).css({width: spanLengths["item"+i]});
			}
    });
});


$(function(){	   
	$("ul#menu li a").hover(function() {
	  $(this).find("span").stop().animate({width: maxwidth + "px"},170);
	}, function() {
	  $(this).find("span").stop()
	  .animate({width: spanLengths[$(this).find("span").attr('class')]+"px"},600); //vrací puvodní délku třídy
	});
});


/* ------------------------------------ náhodné hlavičky + text ---------------------------------------*/
$ (function () {
	$("#pic img").each(function (i) {
		i = i+1;
		$(this).addClass("pic"+i); 
	});
	$("#carousel p").each(function (i) {
		i = i+1;
		$(this).addClass("textblock"+i);
	});
})

/*$(function(){
	$(".typewriter1").typewriter(); return false;
});*/
$(document).ready(function(){
	$('#pic').cycle({ 
		speed:  'slow', 
		timeout: 7000
	});
});




