{"size": 1397, "ext": "js", "max_stars_repo_path": "Demos/carousel.js", "max_stars_repo_name": "tbela99/carousel", "max_stars_repo_stars_event_min_datetime": "2015-08-11T05:16:18.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-29T22:48:01.000Z", "max_issues_repo_path": "Demos/carousel.js", "max_issues_repo_name": "tbela99/carousel", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Demos/carousel.js", "max_forks_repo_name": "tbela99/carousel", "max_forks_repo_forks_event_min_datetime": "2015-08-11T05:16:25.000Z", "max_forks_repo_forks_event_max_datetime": "2016-12-20T07:00:29.000Z"}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 19.1369863014, "max_line_length": 95, "alphanum_fraction": 0.5218324982}

function init (options) {
	
		var duration = 300,
		
			div = document.getElement('div.tabs');
			links = div.getElements('a'),
			toggle =  document.id('toggle'),
			carousel = new Carousel(Object.append({
			
						activeClass: 'selected',
						container: 'slide',
						scroll: 1,
						distance: 1,
						circular: true,
						autostart: true,
						current: 3,
						previous: links.shift(),
						next: links.pop(),
						tabs: links,
						toggle: toggle,
						/* mode: 'horizontal', */
						fx: {
						
							duration: duration
						}
					}, 
					
					options
				)
			),
			removed = 0;
			
		toggle.addEvent('click', function () { this.set('text', carousel.active ? 'Stop' : 'Play')});
		
		function change() {
		
			var panel = this.retrieve('panel');
			
			if(this.checked) {
				
				if(!panel) {
				
					if(carousel.running) {
					
						carousel.addEvent('complete:once', change.bind(this));
						return
					}
					
					panel = carousel.remove(Math.max(0, this.value - removed));
					
					if(panel) {
					
						this.store('panel', panel);
						removed++;
					}
					
					this.checked = !!panel
				}
				
			} else {
			
				if(panel) {
				
					this.eliminate('panel');
					removed--;
					carousel.add(panel.panel, panel.tab.inject(div.getFirst(), 'after'), this.value)
				}
			}
		}
		
		$$('input.remove').addEvents({click: change, change: change})
	}