	   //<![CDATA[
//Allg. Deklarationen	
	var map = null;
	var geocoder = null;
	var markerArray = new Array();
	markerArray["hotels"] = new Array();
	markerArray["luxury"] = new Array();
	markerArray["middleclass"] = new Array();
	markerArray["lowbudget"] = new Array();
	markerArray["apartments"] = new Array();
	var userMarker = null;
	var currentType = "hotels";
	var mainPoint = null;
	var hotelTimer = null;
	var stars = new Array();
	stars.push("<img src='../_gfx/icons-google-maps/categories/apartment.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/1star.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/2star.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/3star.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/4star.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/5star.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/hostel.gif' border=0>");
	stars.push("<img src='../_gfx/icons-google-maps/categories/4star.gif' border=0>");
	var icontype = new Array();
	var overlayInstance = null;
	var lastMarkerLocation;
	var saved=[];

//Map init. load		
	function GMap_load()
	{
	  document.getElementById('GMapWindow').style.display= 'none';
		if (GBrowserIsCompatible()) 
		{
	    	map = new GMap2(document.getElementById("map"));
	    	map.addControl(new GLargeMapControl());
	    	map.addControl(new GMapTypeControl());
			  map.addControl(new GScaleControl());
			  map.addControl(new MDControl());
	    	GEvent.addListener(map, "load", function()
				{ 
					//Start der Map
					hotelTimer = setInterval("showHotels()",1000);
					var latlng = new GLatLng(41.381066, 2.173165);
				}
				);
			map.setCenter(new GLatLng(41.390, 2.169), 14);
		}
	}	

//Pos save
function MDControl() { }
MDControl.prototype = new GControl();
MDControl.prototype.initialize = function(map) {
var container = document.createElement("div");
var savepos= document.createElement("div");
savepos.title= "Save actual view and zoom level";
savepos.style.backgroundColor = "white"; 
savepos.style.color = "black"; 
savepos.style.backgroundColor = "white"; 
savepos.style.border = "1px solid black"; 
savepos.style.padding = "2px"; 
savepos.style.marginBottom = "4px"; 
savepos.style.textAlign = "center"; 
savepos.style.cursor = "pointer"; 
 
container.appendChild(savepos);
savepos.appendChild(document.createTextNode(" Save view "));
 GEvent.addDomListener(savepos, "click", function() {
  var center = map.getCenter(); var zoom = map.getZoom();
  saved.splice(0,2,center,zoom);
  alert("Saved position: "+center.toUrlValue()+"\nZoomlevel: "+zoom);
 });

var tosaved=document.createElement("div");
tosaved.title= "Back to saved view";
tosaved.style.backgroundColor = "white"; 
tosaved.style.color = "black"; 
tosaved.style.backgroundColor = "white"; 
tosaved.style.border = "1px solid black"; 
tosaved.style.padding = "2px"; 
tosaved.style.marginBottom = "4px"; 
tosaved.style.textAlign = "center"; 
tosaved.style.cursor = "pointer"; 

container.appendChild(tosaved);
tosaved.appendChild(document.createTextNode("Back to saved view"));
 GEvent.addDomListener(tosaved, "click", function() {
  if(saved.length > 0) { map.setZoom(saved[1]); map.panTo(saved[0]); }
 });
map.getContainer().appendChild(container);
return container;
}
MDControl.prototype.getDefaultPosition = function() {
 return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7,31));
}
	
//Funktionen showPlaceXYZ
	function showHotels()
// 0 latitude, 1 longitude, 2 name,	3 address, 4 stars, 5 tip, 6 preferred,	7 minrate, 8 hotel_url, 9 photo_url
	{
		window.status = "showHotels()";
		clearInterval(hotelTimer);

		for (i=0;i<hotelsData.length;i++)
		{
			// Show preferred hotels
			if (hotelsData[i][6] == 1)
			{
			addHotelMarker(
				hotelsData[i][0],
				hotelsData[i][1],
				hotelsData[i][2],
				hotelsData[i][3],
				hotelsData[i][4],
				hotelsData[i][5],
				hotelsData[i][6],
				hotelsData[i][7],
				hotelsData[i][8],
				hotelsData[i][9]
						  );
			}
		}
	}

	function showLuxury()
	{
		window.status = "showLuxury()";
		clearInterval(hotelTimer);

		for (i=0;i<hotelsData.length;i++)
		{
			// Show 4L(7)/5*
			if (hotelsData[i][4] == 7 || hotelsData[i][4] == 5)
			{
			addHotelMarker(
				hotelsData[i][0],
				hotelsData[i][1],
				hotelsData[i][2],
				hotelsData[i][3],
				hotelsData[i][4],
				hotelsData[i][5],
				hotelsData[i][6],
				hotelsData[i][7],
				hotelsData[i][8],
				hotelsData[i][9]
						  );
			}
		}
	}

	function showMiddleclass()
	{
		window.status = "showMiddleclass()";
		clearInterval(hotelTimer);

		for (i=0;i<hotelsData.length;i++)
		{
			// Show 3/4*
			if (hotelsData[i][4] == 3 || hotelsData[i][4] == 4)
			{
			addHotelMarker(
				hotelsData[i][0],
				hotelsData[i][1],
				hotelsData[i][2],
				hotelsData[i][3],
				hotelsData[i][4],
				hotelsData[i][5],
				hotelsData[i][6],
				hotelsData[i][7],
				hotelsData[i][8],
				hotelsData[i][9]
						  );
			}
		}
	}

	function showLowbudget()
	{
		window.status = "showLowbudget()";
		clearInterval(hotelTimer);

		for (i=0;i<hotelsData.length;i++)
		{
			// Show 1/2*/Hostels
			if (hotelsData[i][4] == 1 || hotelsData[i][4] == 2 || hotelsData[i][4] == 6)
			{
			addHotelMarker(
				hotelsData[i][0],
				hotelsData[i][1],
				hotelsData[i][2],
				hotelsData[i][3],
				hotelsData[i][4],
				hotelsData[i][5],
				hotelsData[i][6],
				hotelsData[i][7],
				hotelsData[i][8],
				hotelsData[i][9]
						  );
			}
		}
	}

	function showApartments()
	{
		window.status = "showApartments()";
		clearInterval(hotelTimer);

		for (i=0;i<hotelsData.length;i++)
		{
			// Show apartments
			if (hotelsData[i][4] == 0)
			{
			addHotelMarker(
				hotelsData[i][0],
				hotelsData[i][1],
				hotelsData[i][2],
				hotelsData[i][3],
				hotelsData[i][4],
				hotelsData[i][5],
				hotelsData[i][6],
				hotelsData[i][7],
				hotelsData[i][8],
				hotelsData[i][9]
						  );
			}
		}
	}

//Funktionen addXYZMarker	
	
	function addHotelMarker(latitude,longitude,name,address,hotel_class,tip,preferred,minrate,hotel_url,photo_url,desc)
	{
		var iconSize = new GSize(17,20);
		var iconAnchor = new GPoint(8,20);
		var shadowSize = new GSize(34,20);
		var customIcon = new GIcon(G_DEFAULT_ICON);
		customIcon.image = "../_gfx/icons-google-maps/marker-hotel-blue.png";
		
		customIcon.iconSize = iconSize;
		customIcon.iconAnchor = iconAnchor;
		customIcon.shadowSize = shadowSize;
		
		markerArray[currentType].push(new GMarker(new GLatLng(latitude,longitude),{title: name, icon:customIcon}));
		map.addOverlay(markerArray[currentType][markerArray[currentType].length-1]);		
		GEvent.addListener(markerArray[currentType][markerArray[currentType].length-1], "click", function()
		{ 
		map.openInfoWindowHtml(new GLatLng(latitude,longitude),"<div style='padding:15px 0px 0px 0px'><a onClick=\"javascript:closeMap();\" href='http://accomodation.barcelona.de/hotel/es/"+hotel_url+"?label=gmap_std_de' style='font-size:12px;' target='_blank'><img src='http://y.bstatic.com/images/hotel/square90/"+photo_url+"' border='0' width='90' height='90' align='left' style='margin-right:10px;'></a><a href='http://accomodation.barcelona.de/hotel/es/"+hotel_url+"?label=gmap_std_de' style='font-size:12px;' target='_blank'><b>"+name+"</b></a> "+stars[hotel_class]+"<br /><span style='font-size : 10px; font-style:italic; line-height: 15px;'>"+address+"</span><br /><span style='font-size:11px; font-weight:bold;line-height:30px;'>From "+Math.round(minrate)+" &euro; per room/night</span><br /><a href='http://accomodation.barcelona.de/hotel/es/"+hotel_url+"?label=gmap_std_de' target='_blank'>Hotel-Info and booking</a></div>");	
		}
		);
	}

//fkt Dropdownlist	
	function manageDropdown()
	{
		newType = "";
		newType = document.gmapForm.markerType.value;
		
		//Karte leeren		
		if (currentType != "" && currentType != "cleanmap" )
		{
		for (i=0;i<markerArray[currentType].length;i++)
		{
		markerArray[currentType][i].hide();
		}
	}
		
		currentType = newType;
		if ( currentType != "cleanmap" )
		{
			if (markerArray[currentType].length == 0)
			{
				if (currentType == "hotels")
				{
				showHotels();
				}

				else if (currentType == "luxury")
				{
				showLuxury();
				}
				else if (currentType == "middleclass")
				{
				showMiddleclass();
				}
				else if (currentType == "lowbudget")
				{
				showLowbudget();
				}
				else if (currentType == "apartments")
				{
				showApartments();
				}
			}
			else
			{
				for (i=0;i<markerArray[currentType].length;i++)
				{
				markerArray[currentType][i].show();
				}
			}
		}
	}

  //Load, clear mem
window.onload = GMap_load;
window.onunload = GUnload;
	//]]>
