/************************************************************************
 * 		Erstellung der Sidebar für die Google Map						*
 * 		C 2008 by René Lange & Thomas Müller & Steve Rohrlack @ mindbox	*
 ***********************************************************************/

var TourMapFunctions = AbstractTabContent.extend({
	tour : new DcTour(),
	legendText: 'You can use any entry from the map in your tour.',
	
	// Konstruktor
	initialize : function(tour){
		this.container = new Element('div',{'id':'tourMapSidebar'});
		this.tour = tour;
	},
	
	
	// alee Inhalte erstellen
	build : function(mainDiv){

		if (mainDiv != null) {
			this.container = mainDiv;
		} 

		this.container.adopt(this.buildCalculateButton());
		this.container.adopt(this.buildPrintButton());
		this.container.adopt(this.buildLegend());
		this.container.adopt(new Clearer());
		return this.container;
	},
	
	
	// redraw der Map
	buildCalculateButton: function(){
		var tmpEl = new Element('div',{'class': 'calculateTour tpBtn'}).adopt(new Element('a',{ 'id':'tpDrawMap', 'href':'#'}).set('text','Calculate tour'));
		return tmpEl;
	},
	
	
	// der Druckbutton
	buildPrintButton: function(){
		var tmpEl = new Element('div',{'class': 'printTour tpBtn'}).adopt(new Element('a', {'id': 'tpPrint', 'href':'#'}).set('text','Print tour details'));
		return tmpEl;
	},
	
	
	// Erstellt die Legende
	buildLegend : function() {		
		var tmpEl = new Element('div',{'class':'accEl legend'});
		tmpElSubH5 = new Element('h5',{'class':'accToggler', 'id': 'accEl_key'});
		tmpElSubDiv = new Element('div',{'class':'accContent'});
		
		var legendTextNode = new Element('p').set('text', this.legendText);
		
		var legendItems = new Array({'id':'gmOptionsRestaurant','title':'Restaurants'},{'id':'gmOptionsHotel','title':'Accommodation'},{'id':'gmOptionsSight','title':'Sights'},{'id':'gmOptionsInfo','title':'Service'},{'id':'gmOptionsCarpark','title':'Incoming'});
		var legendList = new Element('ul');
		
		legendItems.each(function(el){
			legendList.adopt(new Element('li').adopt(new Element('a',{'href':'#','id':el.id,'title': 'Show all ' + el.title}).setText(el.title).setStyle('background-image','url(/templates/img/tourplanner/icon.legend.'+el.id+'_inactive.gif)')));
		});
		
		tmpElSubDiv.adopt(legendTextNode);
		tmpElSubDiv.adopt(legendList);
		
		tmpElSubDiv.adopt(new Clearer());
		tmpElSub3 = new Element('span');
		tmpElSub3.set('text','Key');
		tmpElSubH5.adopt(tmpElSub3);
		tmpEl.adopt(tmpElSubH5);
		tmpEl.adopt(tmpElSubDiv);
		
		return tmpEl;
	}
});