
function offers(){
	
$(".offers-select li:first").addClass("current");

//Get size of the image, how many images there are, then determin the size of the image reel.
var fwidth = $("#inner-offers").width();
var sum = $("#offers-roll div").size();
var totWidth = fwidth * sum;


//Adjust the image reel to its new size
$("#offers-roll").css({'width' : totWidth});

//Paging  and Slider Function
ruota = function(){
    var n = Math.floor($now.attr("title")) - 1; //Get number of times to slide
	//alert(n);
    var reelPosition = n * fwidth; //Determines the distance the image reel needs to slide
	//alert(reelPosition);
    $(".offers-select li").removeClass('current').addClass('normal'); //Remove all active class
    $now.removeClass('normal').addClass('current'); //Add active class (the $active is declared in the rotateSwitch function)

    //Slider Animation
    $("#offers-roll")/*.animate({opacity:0},600)*/
							.animate({left: -reelPosition}, 600 )
							/*.animate({opacity:1},600);*/

}; 

//Rotation  and Timing Event
ruotaSwitch = function(){
    playOff = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
        $now = $('.offers-select li.current').next(); //Move to the next paging
        if ( $now.length === 0) { //If paging reaches the end...
            $now = $('.offers-select li:first'); //go back to first
        }
        ruota(); //Trigger the paging and slider function
    }, 5000); //Timer speed in milliseconds (7 seconds)
};

ruotaSwitch(); //Run function on launch


//On Hover
$("#offers-roll div").hover(function() {
    clearInterval(playOff); //Stop the rotation
}, function() {
    ruotaSwitch(); //Resume rotation timer
});	

//On Click
$(".offers-select li").click(function() {
    $now = $(this); //Activate the clicked paging
    //Reset Timer
    clearInterval(playOff); //Stop the rotation
    ruota(); //Trigger rotation immediately
    ruotaSwitch(); // Resume rotation timer
    return false; //Prevent browser jump to link anchor
});
}
