function slideSwitch() {
    var $active = $('#head IMG.active');

    if ( $active.length == 0 ) $active = $('#head-slideIMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#head-slideIMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1800, function() {$active.removeClass('active last-active');});
        
}


function newscolor () {
$(".clanek-news").hover(function() {
$(this).addClass("clanek-news-h");
   },function(){
$(this).removeClass("clanek-news-h");
});
$(".clanek-news-c").hover(function() {
$(this).addClass("clanek-news-h");
   },function(){
$(this).removeClass("clanek-news-h");;
});
}

$(document).ready(function() {
setInterval("slideSwitch()", 10000);
$('#left').corner();
$('.ntxt').corner();
$('#bottom-menu').corner();
$('#bottom-menu2').corner();
$('#bottom-menu3').corner();
$('#bottom-menu3b').corner();
$('#bottom-menu3c').corner();
$('#bottom-menu4').corner();
$('.clanek-news').corner();
$('.clanek-newsb').corner();
$('.clanek-news-c').corner();
$('#nadpis').corner();
$('.nadpis').corner();
$('.ordertb2').corner();
$('fieldset').corner();


newscolor ();




var i=2;
$("#bottom-menu-click").click(function() {
$.get("getnews.php", {str:i}, function(returned_data)
         {
         $("#news").append(returned_data)
         $('.clanek-news').corner();
         newscolor();
         var lastli = $('.clanek-news:last').attr("name");
         if (lastli=="lastli") {
         $("#bottom-menu").css("visibility","hidden");
         }
x = "news_"+i;
$("#bottom-menu-click").attr("href",x)
});
i+=1;
return false;
});

var i=2;
$("#bottom-menu-click2").click(function() {
$.get("getarticles.php", {str:i}, function(returned_data)
         {
         $("#news").append(returned_data)
         $('.clanek-news-c').corner();
         newscolor();
         var lastli = $('.clanek-news-c:last').attr("name");
         if (lastli=="lastli") {
         $("#bottom-menu2").css("visibility","hidden");
         }
x = "clanky_"+i;
$("#bottom-menu-click2").attr("href",x)
});
i+=1;
return false;
});


$("#head-slide IMG").click(function(){
var title = $('#head-slide IMG.active').attr("src");
if (title == "http://kendama.cz/img/head1.jpg") loc="http://www.kendama.cz/kendama-obchod";
if (title == "http://kendama.cz/img/newozorasn.jpg") loc="http://www.kendama.cz/kendama-shop/ozora-kendama/";
if (title == "http://kendama.cz/img/affiliate-cs-banner") loc="http://www.kendama.cz/text/partnersky-program";
if (title == "http://kendama.cz/img/affiliate-en-banner") loc="http://www.kendama.cz/text/affiliate-program";
window.location.href=loc;
});

$(".itemx").find(".namex").animate({opacity: 0.7,});
$(".itemx").find(".namex-info").hide();

$(".itemx").hover(function() {
$(this).find(".namex").stop(true, true).animate({opacity: 1.0,});
$(this).find(".namex-info").stop(true, true).slideDown("slow");
;
},function(){
$(this).find(".namex").stop(true, true).animate({opacity: 0.7,});
$(this).find(".namex-info").stop(true, true).slideUp("slow");
});

$(".iteml").find(".namex").animate({opacity: 0.7,});
$(".iteml").find(".namex-info").hide();




$(".iteml").hover(function() {
$(this).find(".namex").stop(true, true).animate({opacity: 1.0,});
$(this).find(".namex-info").stop(true, true).slideDown("slow");
//var skladem = $(this).find('a.dokose').prev().prev().find('.skladem').text();
//alert (skladem);
;
},function(){
$(this).find(".namex").stop(true, true).animate({opacity: 0.7,});
$(this).find(".namex-info").stop(true, true).slideUp("slow");
});


var links = $("a");
var query = '?';
	for(var x = 0; x < links.length; x++) {
	if(links[x].href.indexOf('#disqus_thread') >= 0) {
		query += 'url' + x + '=' + encodeURIComponent(links[x].href) + '&';
	}
	}
$('body').append('<script charset=\"utf-8\" type=\"text/javascript\" src=\"http://disqus.com/forums/kendama/get_num_replies.js' + query + '\"></' + 'script>'); 

$("#showhide").click(function(){
$("#showhiderecom").toggle("slow");

});



});





        



