/**
 * @author mitho
 */
jQuery.noConflict();
(function($){

    // Scrollable Horizontal ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    jQuery.easing.flubberHor = function(x, t, b, c, d){
        var s = 1.70158;
        if ((t /= d / 2) < 1) 
            return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
        return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
    }
    
    jQuery.cyt_scrollableHor = function(el, circ){
        var el;
        if (el != 'undefined' && el != null && el != '') {
            el = el;
        }
        else {
            el = ".cyt_hor_scrollable";
        }
        $(el).scrollable({
            vertical: false,
            mousewheel: false,
            next: '.cyt_hor_next',
            prev: '.cyt_hor_prev',
            disabledClass: 'cyt_hor_disabled',
            circular: circ
        });
    }
    
    // Tooltip ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    jQuery.cyt_tooltip = function(toolTipBox, tipClass, effect, position){
        var toolTipBox;
        var tipClass;
        var effect;
        var position;
        
        $.tools.tooltip.addEffect("bouncy", function(done){
            this.getTip().animate({
                top: '+=15'
            }, 500, 'bouncy', done).show();
        }, function(done){
            this.getTip().animate({
                top: '-=15'
            }, 500, 'bouncy', function(){
                $(this).hide();
                done.call();
            });
        });
        
        if (toolTipBox == "" || toolTipBox == null || toolTipBox == 'undefined') {
            toolTipBox = '#cyt_tooltipbox img[title]';
        }
        else {
            toolTipBox = toolTipBox;
        }
        
        if (tipClass == "" || tipClass == null || tipClass == 'undefined') {
            tipClass = 'cyt_tooltip';
        }
        else {
            tipClass = tipClass;
        }
        
        if (effect == "" || effect == null || effect == 'undefined') {
            effect = 'slide';
        }
        else {
            effect = effect;
        }
        
        if (position == "" || position == null || position == 'undefined') {
            position = 'top center';
        }
        else {
            position = position;
        }
        
        $(toolTipBox).tooltip({
            tipClass: tipClass,
            effect: effect,
            position: position
        });
    }
    
    // Box Slider ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    jQuery.cyt_boxSlider = function(el, circ, navi, autoScroll, interval){
        var el;
        var navi;
        var autoScroll;
        var interval;
        var navi;
        
        if (el != 'undefined' && el != null && el != '') {
        	el = el;
        }
        else {
        	el = ".cyt_boxslider";
        }
        
        if (navi != 'undefined' && navi != null && navi != '') {
            navi = navi;
        }
        else {
            navi = ".cyt_box_navigation";
        }
        
        if (autoScroll != 'undefined' && autoScroll != null && autoScroll != '') {
            autoScroll = autoScroll;
        }
        else {
            autoScroll = false;
        }
        
        if (interval != 'undefined' && interval != null && interval != '') {
            interval = interval;
        }
        else {
            interval = 3000;
        }
        
        $(el).scrollable({
            vertical: false,
            mousewheel: false,
            next: '.cyt_boxSlider_next',
            prev: '.cyt_boxSlider_prev',
            disabledClass: 'cyt_boxSlider_disabled',
            circular: circ
        }).navigator({
            navi: navi,
            naviItem: 'a',
            activeClass: 'cyt_boxslider_current',
            history: false
        }).autoscroll({
            autoplay: autoScroll,
            interval: interval
        });
        var api = $(el).data("scrollable");
        api.seekTo(0);
    }
    
})(jQuery);


