	var map;
	var gdir;
	var geocoder = null;
	var addressMarker;
	var addrFrom = null;

	function initialize(ulica, mesto) {
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("map_canvas"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.addControl(new GScaleControl());
			map.addControl(new GOverviewMapControl());
			gdir = new GDirections(map, document.getElementById("directions"));
			GEvent.addListener(gdir, "error", handleErrors, "");

			setDirections(ulica, mesto, "95 Slovenčeva Ulica, Ljubljana 1000, Slovenia", "sl_SI");
			
			var map = new GMap2(document.getElementById("map"));
	  		map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.addControl(new GScaleControl());
			map.addControl(new GOverviewMapControl());
	        map.setCenter(new GLatLng(46.085064,14.507232), 12);

			var infoTabs = [
	  		new GInfoWindowTab("Tab #1", "<strong>noviSplet.com</strong>, Atribut d.o.o.<br>izdelava spletnih strani<br>Slovenčeva 95<br>1000 Ljubljana<br><br>Tel.: +01 565 32 61")];

			var marker = new GMarker(map.getCenter());
			GEvent.addListener(marker, "click", function() {
			  marker.openInfoWindowTabsHtml(infoTabs);
			});
			map.addOverlay(marker);
			marker.openInfoWindowTabsHtml(infoTabs);
		}
	}

	function setDirections(fromAddress, fromCity, toAddress, locale) {
		locale = 'sl_SI';
		toAddress = '95 Slovenčeva Ulica, Ljubljana 1000, Slovenia';
		if (fromAddress || fromCity) {
			fromAddress += ' ' + fromCity + ', Slovenia';
			addrFrom = fromAddress;
			document.getElementById("gdirection").style.display = 'block';
			document.getElementById("gdirection-tr").style.display = 'block';
			document.getElementById("gmap").style.display = 'none';
		}
		else {
			document.getElementById("gdirection").style.display = 'none';
			document.getElementById("gmap").style.display = 'block';
		}
			
		gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
	}

	function handleErrors(){
		if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS && addrFrom != null) {
			document.getElementById("gdirection").style.display = 'none';
			document.getElementById("gmap").style.display = 'block';
			
			//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: " + gdir.getStatus().code);
			alert("Vnesli ste napačno lokacijo. Preverite ali imena ne vsebujejo zatipkanih besed.\nNapaka: " + gdir.getStatus().code);
		}
		else if (gdir.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: " + gdir.getStatus().code);
		else if (gdir.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: " + gdir.getStatus().code);
		else if (gdir.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: " + gdir.getStatus().code);
		else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
			alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
		//else alert("An unknown error occurred.");
}