$(document).ready(function() {
//Activate First Link
$(".rotaterNav a:first").addClass("active");
//width of Rotater Panel
var contentwidth = $(".rotaterPanel").width();
//Total number of Rotater Content
var totalcontent = $(".rotaterContent").size();
//Total width of all content area
var allcontentwidth = contentwidth * totalcontent;
//rotaterFrame to new size above
$(".rotaterFrame").css({'width' : allcontentwidth});
rotate = function(){
//Number of times we need to rotate
var slideid = $active.attr("rel") - 1;
//Set the distance which single content needs to slide
var slidedistance = slideid * contentwidth;
//Remove active class
$(".rotaterNav a").removeClass('active');
//Add Active Class
$active.addClass('active');
//Rotater Animation
$(".rotaterFrame").animate({
        left: -slidedistance
    }, 500 );
}; 
 
//Set Time for Rotation of slide
rotation = function(){
play = setInterval(function(){
//Next slide nav
$active = $('.rotaterNav a.active').next();
if ( $active.length === 0) {
//Move to first slide nav
$active = $('.rotaterNav a:first');
}
rotate();
//Timer speed 5 sec
}, 5000);
};
//Run rotation fuction
rotation();
$(".rotaterNav a").click(function() {
$active = $(this);
clearInterval(play);
rotate();
rotation();
return false;
});
});
