
         var map = null;
         var LA = new VELatLong(28.4325,-13.9719444);
	 var icon_url = '../images/pin.gif';
	 var zoom = 9;
                  
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap(LA, 14, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
	    map.SetZoomLevel(zoom);

	    // zoom to cursor and center
            map.SetMouseWheelZoomToCenter(true);

	   map.AttachEvent("onendzoom",EndZoomHandler);

	    //GetHotels();
	    GetCity();
        }

	function EndZoomHandler(e)
	{                  

			map.Clear();
			if( map.GetZoomLevel() > zoom )
			{
				//Pins anzeigen
				GetHotels();
			}
			else
			{
				GetCity();
			}
	}

	function GetCity()
	{
		SetCityPin("Antigua",28.420844002560923, -14.013361930847173);
		SetCityPin("La Oliva", 28.7294444, -13.8747222);
		SetCityPin("Pajara",28.34980532526969, -14.109464809298513);
		SetCityPin("Tuineje",28.326775208115553, -14.048914611339585);
	}

	function SetCityPin(id,la,lo)
	{
		var cityPin = new VEPushpin(id,
   			new VELatLong(la,lo), icon_url, '', '');
            	map.AddPushpin(cityPin);
	}


	function SetHotelPosition(id,title,text,img,la,lo)
	{
		//image gegen dummy tauschen falls nicht vorhanden
		if(img == null || img == '') img = 'http://www.holidaa.de/graphics/images/black/hotelpic_dummy.jpg';

		var url_link = '<a href=\"' + GetBookingUrl(id) + '\">zum Buchen hier klicken</a>';
		var myText = '<table border=\"0\"><tr><td>' + text + '</td><td align=\"right\"><img src=\"' + img + '"\" width=\"100\"></td></tr></table>' + url_link;

            	var pushpin = new VEPushpin(id,
   			new VELatLong(la,lo), icon_url, title, myText);
            	map.AddPushpin(pushpin);

		var element = document.getElementById(id);
		element.onclick=HandleEventPinClick;

	} 

	function HandleEventPinClick(e) 
 	{
	 	var obj_id = window.event.srcElement.id.split("_", 1);

		var obj_url = GetBookingUrl(obj_id);
	
		if(obj_url != null)
		{
			document.location.href = obj_url;
		}

  	}

	function GetBookingUrl(obj_id)
	{
		var obj_url = null;
		if( obj_id  == 677728 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=3fEPdCkvUSo";
		if( obj_id  == 677719 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=b5bN07ir3lg";
		if( obj_id  == 677718 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=3fyUqmtHAu0";
		if( obj_id  == 677722 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=sVWhsZoSLEc";
		if( obj_id  == 677712 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=YCztBA56C90";
		if( obj_id  == 677742 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=nd6IhGFM9JY";
		if( obj_id  == 677741 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/fuerteventura_buchen.htm?hotelid=rCgptIElPRI";
		if( obj_id  == 145074 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=PELltpZ6x8s";
		if( obj_id  == 341086 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=luvHb3TnLwc";
		if( obj_id  == 323895 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=-gFkdp7v64s";
		if( obj_id  == 671838 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=nYOIqOHWLUk";
		if( obj_id  == 615669 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=2s/7z2Ylc7s";
		if( obj_id  == 674776 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=DTqHdFcXDy8";
		if( obj_id  == 293252 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=-wxMsZUYNwE";
		if( obj_id  == 680569 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=mBm4Z//6qeg";
		if( obj_id  == 680575 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=RrsPuCIw/do";
		if( obj_id  == 427654 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=wDnLsut4oP8";
		if( obj_id  == 427649 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=NSOUJzvnEgI";
		if( obj_id  == 638096 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=NGIoHHXfsL8";
		if( obj_id  == 672599 ) obj_url = "http://www.urlaubsunterkunft-kanaren.de/fuerteventura/gomera_buchen.htm?hotelid=lQwUMnqjNIM";
		return obj_url;
	}
	
    	function GetHotels()
    	{

		SetHotelPosition('677728','Objekt 677728',
					'Antigua<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677728_1.jpg',
					 28.4325,
					-13.9719444
					);

		SetHotelPosition('677719','Objekt 677719',
					'Antigua<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/6777191_1.jpg',
					 28.4211111,
					-14.0130556
					);

		SetHotelPosition('677718','Objekt 677718',
					'Antigua<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677718_3.jpg',
					 28.2780556,
					-13.9808333
					);

		SetHotelPosition('677722','Objekt 677722',
					'La Oliva<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677722_4.jpg',
					 28.7294444,
					-13.8747222
					);

		SetHotelPosition('677712','Objekt 677712',
					'Pajara<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677712_1.jpg',
					 28.3511111,
					-14.1077778
					);

		SetHotelPosition('677742','Objekt 677742',
					'Pajara<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677742_1.jpg',
					 28.34527781,
					-14.1005556
					);

		SetHotelPosition('677741','Objekt 677741',
					'Tuineje<br/>Fuerteventura',
					'http://www.holidaa.de/hotel/img/hotelpic/small/bilder_toural/677741_8.jpg',
					 28.3261111,
					-14.0483333
					);

		SetHotelPosition('145074','Melia Gorriones',
					'Playa Barca<br/>Pajara',
					'http://www.holidaa.de/hotel/img/hotelpic/mini/holidaa_peg/145074_2.jpg',
					 28.137331,
					-14.244400

					);

		SetHotelPosition('341086','BlueBay Palace Fuerteventura',
					'Avenida Grandes Playas 12<br/>Corralejo',
					'',
					 28.732744,
					-13.867158
					);

		SetHotelPosition('323895','Barcelo Club El Castillo',
					'Caleta De Fuste<br/>Antigua (Fuerteventura)',
					'',
					 28.393983,
					-13.855381
					);

		SetHotelPosition('671838','Occidental Grand Fuerteventura',
					'Urbanizacion Esquinzo Butihondo<br/>Morro Jable',
					'',
					 28.049403,
					-14.332522
					);

		SetHotelPosition('615669','Castillo Beach Apartamentos',
					'Caleta de Fuste - C/ Virgen de la Caridad del Cobre s/n<br/>Antigua (Fuerteventura)',
					'',
					 28.399344,
					-13.869653
					);

		SetHotelPosition('674776','Palace Puerto Rosario',
					'Avenida Ruperto Gonzalez Negrin 9<br/>Puerto del Rosario',
					'',
					 28.499203,
					-13.856417
					);

		SetHotelPosition('293252','Sol Jandia Mar Apartments',
					'Avenida de Jandia s/n<br/>Morro Jable',
					'',
					 28.049458,
					-14.343517
					);


		SetHotelPosition('680569','Hotel Elba Carlota',
					'Fuerteventura Golf Resort, Carretera de Jandia, km 11<br/>Antigua (Fuerteventura)',
					'',
					 28,3755556,
					-13,9197222
					);

		SetHotelPosition('680575','Sheraton Fuerteventura Beach, Golf & Spa Resort Canary Isle',
					'Urb. Fuerteventura Golf Resort, Carretera FV-2, km 11<br/>Antigua (Fuerteventura)',
					'',
					 28,4233333,
					-14,0144444
					);


		SetHotelPosition('427654','Castillo de Elba',
					'Urb. Nuevo Horizonte <br/>Antigua (Fuerteventura)',
					'',
					 28.413811,
					-13.855319
					);

		SetHotelPosition('427649','Hotel Castillo de Antigua',
					'Urbanización El Castillo<br/>Antigua (Fuerteventura)',
					'',
					 28.399619,
					-13.853000
					);

		SetHotelPosition('638096','Hotel Elba Palace Golf',
					'Fuerteventura Golf Resort<br/>Antigua (Fuerteventura)',
					'',
					 28.389003,
					-13.875172
					);

		SetHotelPosition('672599','Hotel Elba Sara',
					'Carretera de Jandia, km. 11<br/>Antigua (Fuerteventura)',
					'',
					 28.384292,
					-13.865475
					);

      }

