// JavaScript Document
jQuery(function() {
	// =======================================
	// Переключалка картинок
	
	// Preload images
	jQuery(".post-block > .thumbnails").find("a").each(function(){
			jQuery("<img>").attr("src", this.href);
		});
		
	jQuery(".post-block > .thumbnails").find("a").click(function(){			
			jQuery(this).parents(".post-block").find(".stuff-img > div > img").attr("src", this.href);
			jQuery(this).parents(".post-block").find(".thumbnails > a").removeAttr("class");
			jQuery(this).attr("class", "active");
                        //var id = $(this).parent().attr("id");
                        var next = $(this).next();
                        if (next.length) {
                            next.addClass("next");
                        } else {
                            $(this).parent().children().first().addClass("next");
                        }

			return false;
		});

        $(".stuff-image-next").click(function(){
            $("#thumbs_"+$(this).attr("id")+" .next").click();
        });
});
