﻿function rotationPresentation() {
    // this function just need an ul li structure
    // with ul class="rotator"  in it.
    var delay = 1;
    var current = $(".rotator .currentRotatorElements");
    
    
    $(".rotator li").hide();
        if (!current.is("li")) {
            $(".rotator li:first").addClass("currentRotatorElement");
            current = $(".rotator .currentRotatorElement");
        }
        current.fadeIn("slow"); ;
        current.removeClass("currentRotatorElement");
        if (current.next().is("li")) {
            current.next().addClass("currentRotatorElement");
        }
        else {
            $(".rotator li:first").addClass("currentRotatorElement");
        }
        setTimeout("rotationPresentation();", delay);
        } 



     function splinter(container, elem) {
    
         var items = $(container+" "+elem);
         var first = $(container + " " + elem + ":first");
         var parent = $(container + " " + elem).parent();
        
         // fade out the first item
         var tmp = $(first).clone();
         $(first).animate({ opacity: 0 }, 1200,
         // then (by callback function) transfer it to the end of the pile
         function() {
             $(tmp).appendTo(parent);
             // pull up the list
             
             $(first).slideUp(1000, function() { $(first).remove(); });

         });

        // dummy pause effect -> then calls itself
         $("#dummy").animate({ opacity: 1 }, 1000, function() { splinter(container, elem); });
        
     
     }
      

