function js_generate_map(url)
{
	newwindow = window.open(url,'generatemap','height=700,width=720,titlebar=0,toolbar=0,scrollbars=1,location=0,directories=0,statusbar=0,menubar=0,resizable=1');
	if (window.focus) {newwindow.focus()}
}


var map = null;

function initialize()
{
	if (GBrowserIsCompatible())
	{
		map = new GMap2(document.getElementById("mapDiv"));
		var apLatitude = document.getElementById('hidAirportLatitude').value
		var apLongitude = document.getElementById('hidAirportLongitude').value
		var imageUrl = document.getElementById('systempath').value;

		var center = new GLatLng(apLatitude,apLongitude);
		map.setCenter(center, 13);
		
		// Create our "tiny" marker icon
		var blueIcon = new GIcon(G_DEFAULT_ICON);
		blueIcon.iconSize  = new GSize(20, 20);
		blueIcon.shadow = "";
		blueIcon.image = imageUrl+"images/icons/airport.png";
		// Set up our GMarkerOptions object
		markerOptions = { icon:blueIcon };

		var marker = new GMarker(center, markerOptions);
		map.addOverlay(marker);

		var parkinglotcount = document.getElementById("parkingcnt").value;
		if(parkinglotcount > 0)
		{
			for (var intCount = 0; intCount < parkinglotcount; intCount++)
			{
				var pl_latitude = document.getElementById('hiddenLat_'+intCount).value
				var pl_longitude = document.getElementById('hiddenLang_'+intCount).value
				var point = new GLatLng(pl_latitude,pl_longitude);
				map.addOverlay(createMarker(point, intCount));
			}
		}
		
	}
	
}

var map1 = null;

function parkinginit()
{
	if (GBrowserIsCompatible())
	{
		map1 = new GMap2(document.getElementById("parkingMapDiv"));
		var parkinglotcount = document.getElementById("parkingcnt").value;
		var plLatitude = document.getElementById('hiddenPlotLat').value;
		var plLongitude = document.getElementById('hiddenPlotLon').value;
		var imageUrl = document.getElementById('systempath').value;

		var center = new GLatLng(plLatitude,plLongitude);

		map1.addOverlay(createMarker(center, parkinglotcount));
		
		var apLatitude = document.getElementById('hidAirportLatitude').value
		var apLongitude = document.getElementById('hidAirportLongitude').value
		var point = new GLatLng(apLatitude,apLongitude);
		map1.setCenter(point, 12);

		var airportIcon = new GIcon(G_DEFAULT_ICON);
		airportIcon.iconSize  = new GSize(20, 20);
		airportIcon.shadow = "";
		airportIcon.image = imageUrl+"images/icons/airport.png";
		
		

		// Set up our GMarkerOptions object
		markerOptions = { icon:airportIcon };

		var marker = new GMarker(point, markerOptions);
		map1.addOverlay(marker);
	}
	
}

function createMarker(point, index) 
{
	// Create a base icon for all of our markers that specifies the
	// shadow, icon dimensions, etc.
	var imageUrl = document.getElementById('systempath').value;

	var baseIcon = new GIcon(G_DEFAULT_ICON);
	baseIcon.shadow = imageUrl+"images/icons/shadow50.png";
	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.shadowSize = new GSize(37, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);


	// Create a lettered icon for this point using our icon class
	var letteredIcon = new GIcon(baseIcon);
	letteredIcon.image = imageUrl+"images/icons/marker" + index + ".png";

	// Set up our GMarkerOptions object
	markerOptions = { icon:letteredIcon };
	var marker = new GMarker(point, markerOptions);

	return marker;
}

