$(document).ready(function(){
    $("#menu a").hover(function(){
        $(this).animate({
            paddingTop: 0,
			paddingBottom: 10
        }, 100);
    }, function(){
        $(this).animate({
            paddingTop: 10,
			paddingBottom: 0
        }, 300);
    });
	var switchtime=600;
	if ($("#top2").index()>= 0) {
		var str = $("#top2 img").attr('src');
		if (str.indexOf('1')>0) var pic=1;
		if (str.indexOf('2')>0) var pic=2;
		if (str.indexOf('3')>0) var pic=3;
		if (str.indexOf('4')>0) var pic=4;
		if (str.indexOf('5')>0) var pic=5;
		if (str.indexOf('6')>0) var pic=6;
		if (str.indexOf('7')>0) var pic=7;
		if (str.indexOf('8')>0) var pic=8;
		if (str.indexOf('9')>0) var pic=9;
		if (pic != 9) {
			if ($("#top2 img").remove()) {
				var znak = ['', 'a', 'b', 'c'];
				for (site = 1; site <= 3; ++site) {
					$("#top2").append('<img src="http://villadolcevita.pl/presentation/images/pic' + pic + znak[site] + '.jpg" alt="Villa Dolce Vita">');
					$("#top2 img").hide();
					$("#top2 img").first().show().addClass("show");
				}
				setInterval("topshow(" + switchtime + ", '2', '2')", 5000);
			}
		}
	}
	

});

	function topshow(switchtime, switchtype, numofimg){
    var site=$("#top" + switchtype + " .show").index();
	if (site == numofimg) {
        $("#top" + switchtype + " img").last().fadeOut(switchtime).removeClass("show");
        setTimeout(function(){
            $("#top" + switchtype + " img").first().fadeIn(switchtime).addClass("show");
        }, 10);
    }
    else {
        $("#top" + switchtype + " img").eq(site).fadeOut(switchtime).removeClass("show");
        $("#top" + switchtype + " img").eq((site+1)).fadeIn(switchtime).addClass("show");
        
    }
    
}

