var application;
var map;

var listingIconRed = new GIcon();
listingIconRed.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
listingIconRed.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
listingIconRed.iconSize = new GSize(12, 20);
listingIconRed.shadowSize = new GSize(22, 20);
listingIconRed.iconAnchor = new GPoint(6, 20);
listingIconRed.infoWindowAnchor = new GPoint(5, 1);

var listingIconBlue = new GIcon();
listingIconBlue.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
listingIconBlue.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
listingIconBlue.iconSize = new GSize(12, 20);
listingIconBlue.shadowSize = new GSize(22, 20);
listingIconBlue.iconAnchor = new GPoint(6, 20);
listingIconBlue.infoWindowAnchor = new GPoint(5, 1);

// Create a marker whose info window displays the listing picture and address
//function createRedMarker(point, div) {
function createRedMarker(point, html) {
	var icon = new GIcon(listingIconRed);
	var marker = new GMarker(point, icon);
	
	GEvent.addListener(marker, 'click', function() {
		//marker.openInfoWindow(div);
		marker.openInfoWindowHtml(html);
	});
	
	return marker;
}

// Create a marker whose info window displays the listing picture and address
//function createBlueMarker(point, div) {
function createBlueMarker(point, html) {
	var icon = new GIcon(listingIconBlue);
	var marker = new GMarker(point, icon);
	
	GEvent.addListener(marker, 'click', function() {
		//marker.openInfoWindow(div);
		marker.openInfoWindowHtml(html);
	});
	
	return marker;
}

function loadgoogle(latitude, longitude)
{
	if ( GBrowserIsCompatible() ) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl(new GSize(150,150)));
		var omap = document.getElementById("map_overview");
		var mapdiv = document.getElementById("map");
		omap.style.position = "relative";
		omap.style.right = "0px";
		omap.style.bottom = "8px";
		mapdiv.appendChild(omap); 
		map.setCenter(new GLatLng(latitude, longitude), 13);
	}
}