var marker = new Array();

pointLocation = new Array(
	new GPoint(-72.675177,41.766159) // Hartford
	,new GPoint(-72.591633,42.102894) // Springfield
	);
	
startLocation = new GPoint(-72.6331,41.9345265);

location_description = new Array(
	'<strong>Hartford Office</strong>' //  Hartford
	,'<strong>Springfield Office</strong>' //  Springfield
	);

directions = new Array(
	'100 Pearl Street, Hartford, CT 06103' //  Hartford
	,'1500 Main Street, Springfield, MA 01115' // Springfield
	);

var popupDirections = ''+
	'<form action="http://maps.google.com/maps" method="get" style="width:300px;margin:0;margin-top:.5em;margin-bottom:.5em;" target="_blank">'+
		'<fieldset style="padding:4px;border:1px solid #91A6CB;text-align:center;">'+
			'<input type="hidden" name="daddr" id="daddr" value="*daddr*" />'+
			'<input type="hidden" name="hl" value="en" />'+
			'<legend>Get directions from</legend>'+
			'<input type="text" name="saddr" style="width:240px;margin:0;" value="Starting Location" /> '+
			'<input type="submit" value="Go" />'+
		'</fieldset>'+
	'</form>';


function zoomTo(item){
	map.centerAndZoom(pointLocation[item],2);
	showInfo(item);
}

var map = new Object();
function buildMap(){
	map = new GMap(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.centerAndZoom(startLocation, 7);
	
	for (i=0;i<pointLocation.length;i++){
			marker[i] = new GMarker(pointLocation[i]);
			eval("GEvent.addListener(marker[i], \"click\", function(){showInfo("+i+");})");
			map.addOverlay(marker[i]);	
	}
	
	//showInfo(0);
}
window.onload.actions.push(buildMap);


function showInfo(id){
	marker[id].openInfoWindowHtml('<div class="map_popup_message">'+location_description[id]+(popupDirections.replace('*daddr*',directions[id]))+'</div>');
}
