var map;
var geocoder;


window.onload = function () {
	load();
	showAddress('4601 Hollins Ferry Rd, 21227', 'SSS Showroom');
}

function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		geocoder = new GClientGeocoder();
		map.setCenter(new GLatLng(37.4419, -122.1419), 13);
	}
}

function showAddress(address, pophtml) {
	geocoder.getLatLng(address, function(point) {
		if (!point) {
			alert(address + " not found");
		} else {
			map.setCenter(point, 13);
			var marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml('<small>'+pophtml+'</small>');
		}
	});
}

function maplink() {

	return this.click(function(){return false;});
}

$(document).ready(function(){
	$('a[@rel*=map]').click(function(){
		showAddress(this.getAttribute('href').substring(4), this.getAttribute('title'));
		return false;
	});
	
});