var tl;


function onLoad() {
  var eventSource = new Timeline.DefaultEventSource(0);
  var theme = Timeline.ClassicTheme.create();
  theme.event.bubble.width = 350;
  theme.event.bubble.height = 300;

  var bandInfos = [
    Timeline.createBandInfo({
                              eventSource:    eventSource,
                              date:           "0001",
                              width:          "80%",
                              intervalUnit:   Timeline.DateTime.YEAR,
                              intervalPixels: 50 ,
                              theme:          theme,
                              layout:         'original'
                            }),
    Timeline.createBandInfo({
                              eventSource:    eventSource,
                              date:           "0001",
                              width:          "20%",
                              intervalUnit:   Timeline.DateTime.MILLENNIUM,
                              intervalPixels: 5000,
                              theme:          theme,
                              layout:         'original'
                            })
  ];
  tl = Timeline.create(document.getElementById("my-timeline"),
                       bandInfos,
                       Timeline.HORIZONTAL);

 bandInfos[0].syncWith = 0;
 bandInfos[0].highlight = true;

tl.loadJSON("results-7.js?"+ (new Date().getTime()), function(json, url) {
              eventSource.loadJSON(json, url);
            });

}

var resizeTimerID = null;

function onResize() {
  if (resizeTimerID == null) {
    resizeTimerID = window.setTimeout(function() {
                                        resizeTimerID = null;
                                        tl.layout();
                                      }, 500);
  }
}

