// begin module scrollpanes
if(typeof(initModuleScrollpanes) == 'undefined')
{

    function initModuleScrollpanes(module, options){

        options = options || {};
        var idx = -1;
        return $(module).each(function(){
            idx++;
            $module = $(this);
            opts = $.isArray(options) ? (options.length > idx ? options[idx] : options[options.length-1]) : options;
            
            $module.find('.scroll-pane').each(function(){
                $(this).removeClass('displayNone');
                $(this).jScrollPane(merge({
                    showArrows: true, 
                    scrollbarWidth: 17
                }, opts));
                
                $pane = $(this).closest('.jScrollPaneContainer');
                if($pane.prevAll('.jScrollPaneContainer').length){
                    $pane.addClass('displayNone');
                }
            });
            

            $module.find('.tabs li a').click(function(){
                mod = $(this).closest('.module');
                var idx = $(this).closest('li').prevAll('li').length;
                //alert($module.find('.jScrollPaneContainer').length);
                try {
                    if(options.googleID){
                        gaTrack(options.googleID, "clickTab_" + idx);
                    } 
                } catch(e) {}
                mod.find('.jScrollPaneContainer').addClass('displayNone').eq(idx).removeClass('displayNone');
                return false;
            });

        });
    }
    
}
// end module scrollpanes 
