
	  var vCarousel;
	  var interaction = 0;
     
	 //set up carosell
	  function runTest() {
		if ($('vertical_carousel')) {	
        vCarousel = new UI.Carousel("vertical_carousel", {direction: "vertical"});	
		  if (userscroll > 0){
	        interactiontest();
			}else{
		  setTimeout('interactiontest();', delay);	
		  }
		}
      }
	  //testif users has rolled over the carosell
	    Event.observe($("vertical_carousel"), 'mouseover', function() {
		 interaction = 1;
		   //  alert(interaction);
		});
      //scroll controll logic
	  function interactiontest(){
	  	 currentpoz = vCarousel.currentIndex();
		 maxscroll =  vCarousel.elements.length-2;
		// alert('current'+ currentpoz +' maxscroll'+ maxscroll);
	   if (interaction == 0){
	    if (userscroll > 0){
	        vCarousel.scrollTo(userscroll);
			}else if(maxscroll <= currentpoz){
		     vCarousel.scrollTo(0);autoscroll();
		    }else{
			autoscroll();
			}
	      }
	   }
	 //auto scroll if user has not interacted with carosell
	  function autoscroll() {
	 	 currentpoz = vCarousel.currentIndex();
		 maxscroll =  vCarousel.elements.length-2;
		 vCarousel.scrollTo(currentpoz+2);
		 setTimeout('interactiontest();', delay);
	  }
	  
	   Event.observe(window, "load", runTest);
			
			