1/* DOKUWIKI:include_once jquery.scrollTo.min.js */
2
3var showCarouselItem = 0;
4var showCarouselDelai = JSINFO['carousel']['delai'];
5var showCarouselMax = jQuery ('div.showSamples div.slide ul li').length;
6var showCarouselTimeout;
7
8function showCarouselLeft () {
9    if (showCarouselItem < 1)
10	return;
11    showCarouselItem--;
12    showCarouselMove ();
13}
14
15function showCarouselRight () {
16    if (showCarouselItem >= showCarouselMax)
17	return;
18    showCarouselItem++;
19    showCarouselMove ();
20}
21
22function showCarouselMove () {
23    jQuery ("div.showSamples div.navi a img.leftside").each (function () {
24	this.style.display = (showCarouselItem > 0) ? "" : "none";
25    });
26    var showCarouselMax = jQuery ('div.showSamples div.slide ul li').length;
27    jQuery ("div.showSamples div.navi a img.rightside").each (function () {
28	this.style.display = (showCarouselItem < (showCarouselMax-1)) ? "" : "none";
29    });
30    jQuery ("div.showSamples div.slide").scrollTo ('li:eq('+showCarouselItem+')', 1000);
31}
32
33function showCarousel () {
34    showCarouselItem = 0;
35    showCarouselMove ();
36    showCarouselTimeout = setTimeout ("showCarouselNext ()", showCarouselDelai);
37}
38
39function showCarouselNext () {
40    clearTimeout (showCarouselTimeout);
41    if (showCarouselMax)
42	showCarouselItem = (showCarouselItem+1) % (jQuery ('div.showSamples div.slide ul li').length);
43    showCarouselMove ();
44    showCarouselTimeout = setTimeout ("showCarouselNext ()", showCarouselDelai);
45}
46
47jQuery (showCarousel ());
48