$(function() {
	var map = new GMap2($("#map").get(0));
	map.setUIToDefault();
	
	var markers = [];
	var maplinks = $(".maplink a");
	maplinks.each(function(i) {
		var arr = $(this).attr("rel").split(",");
		markers[i] = new GMarker(new GLatLng(arr[0], arr[1]));
		map.addOverlay(markers[i]);
		GEvent.addListener(markers[i], "click", function() {
			markers[i].openInfoWindowHtml(maphtml[i]);
		});
	}).click(function() {
		var arr = $(this).attr("rel").split(",");
		var ind = maplinks.index($(this));
		map.setCenter(new GLatLng(arr[0], arr[1]), parseInt(arr[2]));
		markers[ind].openInfoWindowHtml(maphtml[ind]);
		maplinks.removeClass("unvis");
		$(this).addClass("unvis");
		return false;
	});
	
	$(".maplink a:eq(0)").click();
	
	$(window).unload(function() { GUnload(); });
});