﻿// JScript File

var cnter = 1;

this.rotateElements = function(){

    // define the pause for each property (in milliseconds) 
    var pause = 5000;
    
    // get a count of each < li> item to loop through
    var length = $("#ulFeatured li").length; 
    var temp = -1;       

    this.show = function(){
        // restart the loop
        if(cnter > length)
            cnter = 1;
       
        ran = cnter;
       
        $("#ulFeatured li").hide(); // hide the current item
         // now show the next, speed in ms
        $("#ulFeatured li:nth-child(" + ran + ")").fadeIn(1250); 

        cnter++;
    };
   
    show(); 

    // if there is only one item then don't start the rotation
    if(length > 1) 
        setInterval(show,pause);
};

// And this kicks off the 'show', will run after the DOM is loaded
$(document).ready(function(){    
    rotateElements();
});


