// JavaScript Document
			Timeline.FilteredEventSource = function(baseEventSource, match) {
            this._baseEventSource = baseEventSource;
            this._match = match;
            
            this._events = new SimileAjax.EventIndex();
            this._listeners = [];
            
            var self = this;
            this._eventListener = {
            onAddMany: function() { self._onAddMany(); },   
			// removed console.log("here"); from within the {}. It came before the self._ 
            onClear: function() { self._onClear(); }
            }
            this._baseEventSource.addListener(this._eventListener);
            
            if (this._baseEventSource.getCount() > 0) {
            this._onAddMany();
            }
            };
            
            Timeline.FilteredEventSource.prototype.addListener = function(listener) {
            this._listeners.push(listener);
            };
            
            Timeline.FilteredEventSource.prototype.removeListener = function(listener) {
            for (var i = 0; i < this._listeners.length; i++) {
            if (this._listeners[i] == listener) {
            this._listeners.splice(i, 1);
            break;
            }
            }
            };
            
            Timeline.FilteredEventSource.prototype.getEvent = function(id) {
            return this._events.getEvent(id);
            };
            
            Timeline.FilteredEventSource.prototype.getEventIterator = function(startDate, endDate) {
            return this._events.getIterator(startDate, endDate);
            };
            
            Timeline.FilteredEventSource.prototype.getEventReverseIterator = function(startDate, endDate) {
            return this._events.getReverseIterator(startDate, endDate);
            };
            
            Timeline.FilteredEventSource.prototype.getAllEventIterator = function() {
            return this._events.getAllIterator();
            };
            
            Timeline.FilteredEventSource.prototype.getCount = function() {
            return this._events.getCount();
            };
            
            Timeline.FilteredEventSource.prototype.getEarliestDate = function() {
            return this._events.getEarliestDate();
            };
            
            Timeline.FilteredEventSource.prototype.getLatestDate = function() {
            return this._events.getLatestDate();
            };
            
            Timeline.FilteredEventSource.prototype._fire = function(handlerName, args) {
            for (var i = 0; i < this._listeners.length; i++) {
            var listener = this._listeners[i];
            if (handlerName in listener) {
            try {
            listener[handlerName].apply(listener, args);
            } catch (e) {
            SimileAjax.Debug.exception(e);
            }
            }
            }
            };
            
            Timeline.FilteredEventSource.prototype._onAddMany = function() {
            this._events.removeAll();
            
            var i = this._baseEventSource.getAllEventIterator();
            while (i.hasNext()) {
            var evt = i.next();
            if (this._match(evt)) {
            this._events.add(evt);
            }
            }
            
            this._fire("onAddMany", []);
            };
            
            Timeline.FilteredEventSource.prototype._onClear = function() {
            this._events.removeAll();
            this._fire("onClear", []);
            };

			//call filtered event source script and create a function to split the file based on the value of "timeline" 
            function constructFilteredEventSource(baseEventSource, database, propertyID, matchValue) {
            return new Timeline.FilteredEventSource(
            baseEventSource,
            function(evt) {
            return database.getObject(evt.getID(), propertyID) == matchValue;
                    }
                 );
            }
			//create a function that wraps the timeline specs to be called later as ex:timelineConstructor 
            function myTimelineConstructor(div, eventSource) {
			//define themes to be used by TL
            var theme = Timeline.ClassicTheme.create();
 			theme.event.bubble.width = 320; 
			theme.event.bubble.height = 180; 
			theme.event.track.height = 18;
			<!-- set a default date for centering timeline -->
            var d = Timeline.DateTime.parseGregorianDateTime("1910")
			//create the bands
            var bandInfos = [
            Timeline.createBandInfo({
            width:          "18%", 
            intervalUnit:   Timeline.DateTime.DECADE, 
            intervalPixels: 200,
            eventSource:    constructFilteredEventSource(eventSource, window.database, "timeline", 1),
            date:           d
            }),
			
            Timeline.createBandInfo({
            width:          "40%", 
            intervalUnit:   Timeline.DateTime.DECADE, 
            intervalPixels: 200,
            eventSource:    constructFilteredEventSource(eventSource, window.database, "timeline", 2),
            date:           d
            }),
            Timeline.createBandInfo({
            width:          "42%", 
            intervalUnit:   Timeline.DateTime.DECADE, 
            intervalPixels: 200,
            eventSource:    constructFilteredEventSource(eventSource, window.database, "timeline", 3),
            date:           d,
			theme: 			theme
            })
			];

			bandInfos[0].syncWith = 1;
			//bandInfos[0].highlight = true;
			//bandInfos[1].highlight = true;
			bandInfos[2].syncWith = 1;
			//bandInfos[2].highlight = true;
			
            div.style.fontSize = "10.5pt";
            div.style.height = "550px";

			bandInfos[0].decorators = [
			
			new Timeline.SpanHighlightDecorator({
			startDate:  "1890",
			endDate:	"1890",
			startLabel:	"MBL Directors",
			endLabel:	""
			})
			];
			
			bandInfos[2].decorators = [
			new Timeline.SpanHighlightDecorator({
			startDate:  "1920",
			endDate:	"1920",
			startLabel:	"Nobel Laureates Affiliated with the MBL",
			endLabel:	""
			})
			];
            
            return Timeline.create(div, bandInfos, Timeline.HORIZONTAL);
            }