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

    
    
    //Accordian ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    jQuery.tools.tabs.addEffect("slide", function(i, done){
        this.getPanes().slideUp().css({});//backgroundColor: "#FF6600"
        this.getPanes().eq(i).slideDown(function(){
            $(this).css({
                backgroundColor: 'transparent'
            });
            done.call();
        });
    });
    
    jQuery.cyt_accordian = function(accordianId, startIndex, eventHandler){
    
        var accordianIdSet;
		
        if (accordianId != 'undefined' && accordianId != null && accordianId != '') {
            accordianIdSet = accordianId;
        }
        else {
            accordianIdSet = ".cyt_accordion";
        }
        
        $(accordianIdSet).tabs(accordianIdSet + " div.cyt_pane", {
            tabs: 'h2',
            effect: 'slide',
            initialIndex: startIndex,
            event: eventHandler
        });
    }
    
    
    // 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
        });
    }
    
    
    
    // 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);


