var route;

var Route = Class.create();
Route.prototype = {
	initialize: function(){
		this.map = new GMap2($('map'));
		this.map.addControl(new GLargeMapControl());
		this.map.addControl(new GMapTypeControl());
		
		this.gdir = new GDirections(this.map, $('directions'));
		
		point = new GLatLng(51.786533,4.618378);
		this.map.setCenter(point, 10);
		this.map.addOverlay(new GMarker(point));
	},
	
	opensearch: function(){
		new Effect.Fade('links', {duration: 0.5});
		
		window.setTimeout(function(){
			new Effect.Appear('search', {duration: 0.5});
		}, 600);
	},
	
	closesearch: function(){
		new Effect.Fade('search', {duration: 0.5});
		
		window.setTimeout(function(){
			new Effect.Appear('links', {duration: 0.5});
		}, 600);
	},
	
	plan: function(latitude, longitude) {
		if($('contactform').style.display == ''){
			$('contactform').style.display = 'none';
		}
		
		$('planner').style.display = '';

		this.gdir.load('from: ' + latitude + ', ' + longitude + ' to: 51.786533,4.618378');
	
		window.setTimeout(function(){
			new Effect.ScrollTo('map');
		}, 500);
	}
}

function showcontactform(){
	if($('contactform').style.display == 'none'){
		new Effect.Fade('planner', {duration: 0.8});
		
		window.setTimeout(function(){
			new Effect.Appear('contactform', {duration: 0.8});
		}, 900);
	}
}