﻿// LAST CHANGE 01.10.2010  Author: VOELZ
// Copyright by Fortuna Werbeagentur GmbH 2009

// JavaScript Document for timelineconfiguration

var timelineConfig = { 
	timelineConstructor: function (div, eventSource) { 
		div.style.height="455px";
		div.style.fontSize = "9pt";
		
		var theme = Timeline.ClassicTheme.create();
		theme.event.track.height = 12;
		theme.event.track.gap = 2; 
		theme.event.label.width = 250; 
		theme.event.bubble.width = 360;
		
		var date;
		if (window.location.search != ""){ 
			
			var datumstring = window.location.search;
			if (datumstring.length <= 8){			
				var cDate;
				switch (datumstring.length) {
					case 7: cDate="0"+datumstring.substr(4);
					
								   break;
				 
					case 6: cDate="00"+datumstring.substr(4);
					
									 break;
				 
					case 5: cDate="000"+datumstring.substr(4);
					
									 break;
				 
					default:cDate=""+datumstring.substr(4); 
				  }
					  
				date="" +Timeline.DateTime.parseIso8601DateTime(cDate);		
			}else{
			
				var cYear="" +datumstring.substr(10,14);
				var cMonth="" +datumstring.substr(7,2);
				var cDay="" +datumstring.substr(4,2);
			
				var cDate="" + cYear + "-" + cMonth + "-" + cDay;		
				date="" +Timeline.DateTime.parseIso8601DateTime(cDate);
			}
		}else date="" +Timeline.DateTime.parseIso8601DateTime("1840");
		
		
		var bandInfos = [
			Timeline.createBandInfo({
			width: "86%",
			intervalUnit: Timeline.DateTime.YEAR,
			intervalPixels: 160,
			eventSource: eventSource,
			theme:theme,
			date: date
			}),
			
			Timeline.createBandInfo({
			width: "14%",
			intervalUnit: Timeline.DateTime.DECADE,
			intervalPixels: 40,
			eventSource: eventSource,
			overview: true,
			theme: theme, 
			date: date
			})		
		];
		
		bandInfos[1].syncWith = 0;
		bandInfos[1].highlight = true;
		
		// PROTOTYPE - Farbhinterlegung f�r Zeitabschnitte
        bandInfos[1].decorators = [                   
		new Timeline.SpanHighlightDecorator({
				startDate:  new Date(100, 0, 1),
				endDate:    new Date(1260, 0, 1),
				startLabel: "Vor- und Fruehgeschichte",
				endLabel:   "",
				color:      "#99973d",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1260, 0, 1),
				endDate:    new Date(1353, 0, 1),
				startLabel: "Henneberger Stadtverwaltung Coburg",
				endLabel:   "",
				color:      "#ccc814",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1353, 0, 1),
				endDate:    new Date(1524, 0, 1),
				startLabel: "Wettiner Stadtverwaltung Coburg",
				endLabel:   "",
				color:      "#ffc600",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1524, 0, 1),
				endDate:    new Date(1596, 0, 1),
				startLabel: "Coburg im Zeichen der Reformation",
				endLabel:   "",
				color:      "#4a7f4f",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1596, 0, 1),
				endDate:    new Date(1918, 0, 1),
				startLabel: "Residenzstad Coburg",
				endLabel:   "",
				color:      "#1489cc",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1918, 0, 1),
				endDate:    new Date(1945, 0, 1),
				startLabel: "Bayerisch Kreisstadt",
				endLabel:   "",
				color:      "#fffa0d",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1945, 0, 1),
				endDate:    new Date(1990, 0, 1),
				startLabel: "Grenzlandstadt",
				endLabel:   "",
				color:      "#806300",
				opacity:    35,
				theme:      theme
			}),
			new Timeline.SpanHighlightDecorator({
				startDate:  new Date(1990, 0, 1),
				endDate:    new Date(2200, 0, 1),
				startLabel: "Schnittstelle Bay. / Th&uuml;.",
				endLabel:   "",
				color:      "#ff970d",
				opacity:    35,
				theme:      theme
			})
		];
		
		tl = Timeline.create(div, bandInfos, Timeline.HORIZONTAL);
		
		return tl;
	}

}

// Funktion f�r den Quickjump in die Jahrhunderte
function centerTimeline(date) {
		tl.getBand(0).setCenterVisibleDate(Timeline.DateTime.parseGregorianDateTime(date));	
}

