window.addEvent("domready", function() {
    var slideshowCarousel = new iCarousel("slideshow_content", {
        idPrevious: "slideshow_previous",
        idNext: "slideshow_next",
        idToggle: "undefined",
        item: {
            klass: "slideshow_item",
            size: ($("thumb4")?376:300)
        },
        animation: {
            type: "scroll",
            duration: 500,
            amount: 1,
			direction: "top"
/*
			, rotate: {
				type: "auto",
				interval: 5000
			}
//*/
        }
    });
	
    $("thumb0").addEvent("mouseover", function(event){new Event(event).stop();slideshowCarousel.goTo(0);ssToggleActive(0)});
    $("thumb1").addEvent("mouseover", function(event){new Event(event).stop();slideshowCarousel.goTo(1);ssToggleActive(1)});
    $("thumb2").addEvent("mouseover", function(event){new Event(event).stop();slideshowCarousel.goTo(2);ssToggleActive(2)});
    $("thumb3").addEvent("mouseover", function(event){new Event(event).stop();slideshowCarousel.goTo(3);ssToggleActive(3)});
    if($("thumb4")){ // for big slideshow
		$("thumb4").addEvent("mouseover", function(event){new Event(event).stop();slideshowCarousel.goTo(4);ssToggleActive(4)});
	}
});

function ssToggleActive(thumbID)
{
	var id = "thumb";
	for(i=0;i<5;i++)
	{
		id = "thumb"+i;
		if($(id))
		{
			$(id).removeClass("active");
		}
	}
	id = "thumb"+thumbID;
	$(id).addClass("active");
}
