//<!--
var gdir;
function initialize(companyLat, companyLng, zoom, name, description, setMarker, markerInfoWidth)
{
	if(GBrowserIsCompatible())
	{
		var zoom = ( zoom ? eval(zoom) : 6);
		var companyLat = ((companyLat && companyLat!='') ? companyLat : 53.778422);
		var companyLng = ((companyLng && companyLng!='') ? companyLng : 20.4801193);
		
		map = new GMap2(document.getElementById("CompanyMap"),{mapTypes: [G_NORMAL_MAP,G_HYBRID_MAP,G_SATELLITE_MAP] });
		map.setCenter(new GLatLng(52.2319, 19.01), zoom);
		
		// === create a GDirections Object ===
	      gdir=new GDirections(map, document.getElementById("directions"));

	      // === Array for decoding the failure codes ===
	      var reasons=[];
	      reasons[G_GEO_SUCCESS]            = "Success";
	      reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
	      reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
	      reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
	      reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
	      reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
	      reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";
	      reasons[G_GEO_BAD_REQUEST]        = "A directions request could not be successfully parsed.";
	      reasons[G_GEO_MISSING_QUERY]      = "No query was specified in the input.";
	      reasons[G_GEO_UNKNOWN_DIRECTIONS] = "The GDirections object could not compute directions between the points.";

	      // === catch Directions errors ===
	      GEvent.addListener(gdir, "error", function() {
	        var code = gdir.getStatus().code;
	        var reason="Code "+code;
	        if (reasons[code]) {
	          reason = reasons[code]
	        } 

	        alert("Failed to obtain directions, "+reason);
	      });
		
		//map.addControl(new GLargeMapControl()); //old scroll
		map.setUIToDefault(); //new scroll
		
		var typeMap = map.getMapTypes();
		typeMap[0].getName= function() { return "Mapa";}
		typeMap[1].getName = function() { return "Satelita";}
		typeMap[2].getName = function() { return "Hybryda";}
		
		map.addControl(new GMapTypeControl());
		//map.addControl(new GOverviewMapControl());
		map.addControl(new GScaleControl());
		
		

		

		
		if (setMarker==true) addGMMarker( companyLat, companyLng , false, name, description, false, true, markerInfoWidth);
		
		
	}
}
//-->
