new Namespace("at.bildungswerk.routeplaner.toggleMap");
at.bildungswerk.routeplaner.toggleMap = Class.create({

	initialize : function (handle, map)
	{
		this.handle = handle;
		this.map = map;

		
		
		this.text1 = this.handle.getElementsByTagName('span')[0];
		this.text2 = this.handle.getElementsByTagName('span')[1];
		
		this.mapHeight = map.getHeight() + 20;
		this.statusOpened = false;
		
		this.map.setStyle({
			height: 0+'px',
			display: 'block'
		});
		
		//document.getElementById('map').style.display = 'none';
		
		this.handle.observe("click", this.showMap.bind(this));
		
	},
	
	showMap : function ()
	{
		if(this.statusOpened) {
			ex = new Animator({transition: Animator.makeEaseIn(2),duration: 500});
			ex.addSubject(new NumericalStyleSubject($(this.map), 'height', this.mapHeight, 0));
			ex.play();
			

			
			//document.getElementById('map').style.display = 'none';
			
			this.text2.style.display = 'none';
			this.text1.style.display = 'block';
			this.statusOpened = false;
		} else {
			ex = new Animator({transition: Animator.makeEaseIn(2),duration: 500});
			ex.addSubject(new NumericalStyleSubject($(this.map), 'height', 0, this.mapHeight));
			ex.play();
			
			

			
			//document.getElementById('map').style.display = 'block';
			
			this.text1.style.display = 'none';
			this.text2.style.display = 'block';
			this.statusOpened = true;
		}
	}
	
});



