var presentationCycle = {

    /*
    * Presentation Cycle - a jQuery Cycle extension
    * Author:  Gaya Kessler
    * URL:     http://www.gayadesign.com
    * Date:	03-11-09
    * Customized by: Vidros Socratis
    */

    //slide options
    slideTimeout: 5000,
    containerId: "preWrapper",

    //cycle options
    cycleFx: 'fade',
    cycleSpeed: 600,

    //variables this script need
    itemCount: 0,
    currentItem: 0,
    disableAnimation: false,

    init: function () {

        presentationCycle.itemCount = $('#' + presentationCycle.containerId).children().length;

        var totalWidth = $('#' + presentationCycle.containerId).innerWidth() - presentationCycle.barDisplacement;
        var fillWidth = Math.floor((totalWidth) / (presentationCycle.itemCount - 1));

        $('#' + presentationCycle.containerId).cycle({
            fx: presentationCycle.cycleFx,
            speed: presentationCycle.cycleSpeed,
            timeout: presentationCycle.slideTimeout,
            before: function (currSlideElement, nextSlideElement) { presentationCycle.beforeSlide(currSlideElement, nextSlideElement); }
        });
    },

    beforeSlide: function (currSlideElement, nextSlideElement) {
        if (presentationCycle.currentItem == 0) {
            presentationCycle.currentItem = 1;
        } else {
            presentationCycle.currentItem = (presentationCycle.itemCount - ($(nextSlideElement).nextAll().length)) + 2;
        }
        presentationCycle.animateProcess();
    },

    animateProcess: function () {
        var startWidth = (presentationCycle.itemBarWidth * (presentationCycle.currentItem - 1));
        if (presentationCycle.currentItem != presentationCycle.itemCount) {
            var newWidth = (presentationCycle.itemBarWidth * (presentationCycle.currentItem));
        };
    }
}
