	
	var hvDirections;
	var latlon_hv;
	var map;
	var isMap	= 1;
	
	function mapInit() {
		if (GBrowserIsCompatible()) {
		
			// inicializalas
			map = new GMap2(document.getElementById("map_canvas"));
			// hotelv lat-lon beálíltás
			latlon_hv	= new GLatLng(47.254045913263454, 16.938482522964478);
			// bekapcsolja a gombokat
			map.setUIToDefault();
			
			// marker felhelyezese
			var hvIcon = new GIcon(G_DEFAULT_ICON);
			hvIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			hvIcon.iconSize = new GSize(30, 20);
	// 		hvIcon.shadowSize = new GSize(37, 34);
	// 		hvIcon.iconAnchor = new GPoint(9, 34);
	// 		hvIcon.infoWindowAnchor = new GPoint(9, 2);
			
			// http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png
			hvIcon.image	= "http://www.hotel-viktoria.hu/uj/img1/96.jpg";
			// Set up our GMarkerOptions object
			markerOptions	= { icon:hvIcon };
			var hvMarker	= new GMarker(latlon_hv, markerOptions);
			// kattintas az ikonra
			GEvent.addListener(hvMarker, "click", function() {
				hvMarker.openInfoWindowHtml('<b>Hotel-Viktória</b><br>Útvonal innen:<input type="text" id="directionFrom"><input type="button" onClick="setDirection()" value="Ok">');
			});
			map.addOverlay(hvMarker);
			
			// terkep igazitasa
			map.setCenter( latlon_hv, 15);
// 			map.openInfoWindow(map.getCenter(),	document.createTextNode("Hello, world"));
			hvMarker.openInfoWindowHtml('<b>Hotel-Viktória</b><br>Útvonal innen:<input type="text" id="directionFrom"><input type="button" onClick="setDirection()" value="Ok">');
			
			// utvonaltervezes a beirt cimhez
			hvDirectionsPanel = document.getElementById("map_route");
			hvDirections = new GDirections(map, hvDirectionsPanel);
			GEvent.addListener(hvDirections, "load", onGDirectionsLoad);
			GEvent.addListener(hvDirections, "error", handleDirErrors);
		
		}
		
	}

	function setDirection(){
		hvDirections.load( 'from:'+document.getElementById('directionFrom').value + ' to:Sárvár ', { "locale": 'hu_HU' } ) ;
	}

    function handleDirErrors(){
		if (hvDirections.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
			alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + hvDirections.getStatus().code);
		else if (hvDirections.getStatus().code == G_GEO_SERVER_ERROR)
			alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + hvDirections.getStatus().code);
		else if (hvDirections.getStatus().code == G_GEO_MISSING_QUERY)
			alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + hvDirections.getStatus().code);
	//   else if (hvDirections.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + hvDirections.getStatus().code);
		else if (hvDirections.getStatus().code == G_GEO_BAD_KEY)
			alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + hvDirections.getStatus().code);
		else if (hvDirections.getStatus().code == G_GEO_BAD_REQUEST)
			alert("A directions request could not be successfully parsed.\n Error code: " + hvDirections.getStatus().code);
		else alert("An unknown error occurred.");
	}



	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
// 	  alert(hvDirections.getStatus().code);
	  
	}

	
	
	
	
	
	
	
