var openImage = false; // default wert für scroller.js var itemcount = Math.ceil((itemcount == null) ? 0 : itemcount); var currentitem = (GET('item') == 'undefined') ? 0 : GET('item'); var previousitem = currentitem; var defaultspeed = 600; var offset = (offset != null) ? offset : 0; var continous = (continous == null) ? true : continous // var itemcount is found within xhtml-template $("#arrow-next, .next").mousedown(function() { startScrolling("next"); }); $("#arrow-prev").mousedown(function() { startScrolling("prev"); }); $("#arrow-prev, #arrow-next, .next").mouseleave(function() { stopScrolling(); }); $("#arrow-prev, #arrow-next, .next").mouseup(function() { stopScrolling(); }); function startScrolling(direction) { scrollToItem(direction); timer = setTimeout("startScrolling('"+direction+"')", speed + 50); } function stopScrolling() { clearTimeout(timer); } function scrollToItem(direction) { previousitem = currentitem; // next item if (direction == 'next') { $("#arrow-prev").show(); // prevent "overscrolling" if (currentitem > (itemcount-2)) { if (continous) { currentitem = 0; } else { currentitem = (itemcount-1); } } else { currentitem++; $("#arrow-next").show(); } } // previous item if (direction == 'prev') { $("#arrow-next").show(); // prevent "underscrolling" if (currentitem < 1) { if (continous) { currentitem = (itemcount-1); } else { currentitem = 0; } } else { currentitem--; $("#arrow-prev").show(); } } // first item if (direction == 'first') { $("#arrow-next").show(); $("#arrow-prev").hide(); currentitem = 0; } // now scroll! doScrolling(); return false; } function doScrolling(speedoverwrite) { if (speedoverwrite != null) { speed = speedoverwrite; } else { speed = defaultspeed; } // farbigen Rahmen ein/ausblenden $("#items li:eq("+(currentitem)+") .border-selected").fadeIn(); if (previousitem != currentitem) { $("#items li:eq("+previousitem+") .border-selected").fadeOut(); } // scrollen und Produktinfo austauschen $("#scroller").stop().scrollTo( $("#items > li:eq("+currentitem+")"), speed, { offset:offset, onAfter: function() { $("#item-info").html($("#items > li:eq("+currentitem+") .info").html()); $("#items > li:eq("+currentitem+") .detailarea") .hide() .addClass("blink") .fadeIn(350) .delay(350) .fadeOut(350, function() { $(this).removeClass("blink"); $(this).css("display", "block"); }); refreshCufon(); } } ); // TODO: GoogleAnalytics aufrufen } // init if (currentitem > 0) { $("#arrow-prev").show(); } if (currentitem == (itemcount-1)) { $("#arrow-next").hide(); } if (itemcount < 2) { $("#arrow-next").hide(); $("#arrow-prev").hide(); } doScrolling(50);