function MMStation(json){ 
	
	var latLng = new GLatLng(json.departure.point.lat, json.departure.point.lng);
	
	this.listeners = new Array();
	this.stationMarker = this.InitializeStationMarker(latLng);
	this.infoWindowHtml = null;
	
	// show stationlabel only for ÖPNV
	var type = json.transportation.type;
	var shortname = json.transportation.shortname;
	if(type == 0 || type == 1 || type == 3 || type == 5)
	{
		this.stationLabelMarker = this.InitializeStationLabelMarker(latLng, type, shortname);				
		
		switch(type)
		{
			case 0: var typeIcon = "dateien/transportation/rbahn.gif"; break;
			case 1: var typeIcon = "dateien/transportation/sbahn.gif"; break;
			case 3: var typeIcon = "dateien/transportation/ubahn.gif"; break;
			case 5: var typeIcon = "dateien/transportation/bus.gif"; break;
		}
		
		this.infoWindowHtml = ''
			+'<div style="font-size:10pt;font-family:arial, sans-serif;">'
				+'<table border="0">'
				+'<tr>'
					+'<td rowspan="4" valign="top"><img src="'+ typeIcon +'"></td>'
					+'<td colspan="3"><b>'+ json.transportation.name +'</b> Richtung '+ json.departure.destination +'</td>'
				+'</tr>'
				+'<tr>'
					+'<td width="70">'+ json.departure.time.hour +':'+ json.departure.time.minute +' Uhr</td>'
					+'<td width="20">ab</td>'
					+'<td>'+ json.departure.station +'</td>'
				+'</tr>'
				+'<tr>'
					+'<td width="70">'+ json.arrival.time.hour +':'+ json.arrival.time.minute +' Uhr</td>'
					+'<td width="20">an</td>'
					+'<td>'+ json.arrival.station +'</td>'
				+'</tr>'
				+'<tr>'
					+'<td colspan="3" align="left"><img src="dateien/pdf.gif">&nbsp;<a href="'+ json.departure.timetable +'" target="_blank">Fahrplan</a></td>'
				+'</tr>'				
				+'</table>'
			+'</div>';
		
		
		
	}
	else
	{
		this.stationLabelMarker = null;
	}
	
	this.map = null;
}
MMStation.prototype = new GOverlay();

/**
 * Called by the map after the overlay is added to the map using GMap2.addOverlay(). The overlay object 
 * can draw itself into the different panes of the map that can be obtained using GMap2.getPane().
 */
MMStation.prototype.initialize = function(map){
	this.map = map;
	this.map.addOverlay(this.stationMarker);
	
	if(this.stationLabelMarker)
	{
		this.map.addOverlay(this.stationLabelMarker);
		this.stationLabelMarker.bindInfoWindowHtml(this.infoWindowHtml);
	}
}


/**
 * Called by the map when the map display has changed. The argument force will be true if the zoom level or 
 * the pixel offset of the map view has changed, so that the pixel coordinates need to be recomputed.
 */
MMStation.prototype.redraw = function(force){
	this.stationMarker.redraw(force);
	if(this.stationLabelMarker)this.stationLabelMarker.redraw(force);
}


/**
 * Called by the map after the overlay is removed from the map using GMap2.removeOverlay() or GMap2.clearOverlays(). 
 * The overlay must remove itself from the map panes here.
 */
MMStation.prototype.remove = function(){
	
	for(var i=0; i<this.listeners.length; i++){
		GEvent.removeListener(this.listeners[i]);
	}
	
	this.map = null;
	this.stationMarker.remove();
	if(this.stationLabelMarker)this.stationLabelMarker.remove();
}


/**
 * Returns an uninitialized copy of itself that can be added to the map.
 */
MMStation.prototype.copy = function(map){
	return new MMStation();
}



// Static Member
MMStation.stationIcon = null;
MMStation.stationLabelIcons = new Array();

MMStation.prototype.InitializeStationMarker = function(point)
{
	if(!MMStation.stationIcon)
	{
		var icon = new GIcon(G_DEFAULT_ICON);	
		icon.image = "dateien/marker/station.png";
		icon.iconSize = new GSize(11,11);
		icon.iconAnchor = new GPoint(5,5);	
		icon.shadow = null;
		
		MMStation.stationIcon = icon;
	}
	      
	return new GMarker(point, { icon: MMStation.stationIcon, clickable:false });
}

MMStation.prototype.InitializeStationLabelMarker = function(point, type, text)
{
	if(!MMStation.stationLabelIcons[type + text])
	{
		//var icon = new GIcon(G_DEFAULT_ICON);		
		var url = MMRegistry.urlPortal +"functions/GoogleMaps/";
				
		switch(type)
		{
			case 0: //R-Bahn
				var iconUrl = url +"GMarker.php?type=1&txt="+ text;
				break;
				
			case 1: //S-Bahn
				var iconUrl = url +"GMarker.php?type=2&txt="+ text;
				break;
						
			case 3: //Stadtbahn
				var iconUrl = url +"GMarker.php?type=3&txt="+ text;
				break;
				
			
			case 5: //Bus
				var iconUrl = url +"GMarker.php?type=4&txt="+ text;
				break;
				
			default: return false;
				var iconUrl = url +"GMarker.php?type=0&txt=";
				break;
		}
		
		var icon = new GIcon({image: iconUrl});
		icon.iconSize = new GSize(60,34);
		icon.iconAnchor = new GPoint(0,34);
		
		icon.infoWindowAnchor =  new GPoint(30,1);
		
		icon.shadow = null;
		//icon.shadow =  "img/flag_shadow.png";
		//icon.shadowSize = new GSize(44,29);
		
		MMStation.stationLabelIcons[type + text] = icon;
	}
	
	return new GMarker(point, { icon: MMStation.stationLabelIcons[type + text], clickable:true});	
}

