var gmap = new Object();

gmap.addEvent = function(elmnt, evType, fn, useCapture){
	if(elmnt.addEventListener){
		elmnt.addEventListener(evType, fn, useCapture);
		return true;
	} else if(elmnt.attachEvent){
		var r = elmnt.attachEvent('on'+evType, fn);
		return r;
	} else {
		elmnt['on'+evType] = fn;
		return true;
	}
};

gmap.showAddress = function(){
	gmap.marker.openInfoWindowHtml('<div class="gmap"><h3>Davenport Dryer</h3><img src="../style/img/logo_gmap.gif" alt="Davenport Dryer"/><div>301 Second Street<br/>Rock Island, IL 61201<br/>309-786-1500</div></div>');
};

gmap.init = function(){
	if(GBrowserIsCompatible()){
		gmap.map = new GMap2(document.getElementById("map"));
		gmap.map.setCenter(new GLatLng(41.505401, -90.591068), 15);
		gmap.marker = new GMarker(new GLatLng(41.505401, -90.595068));
		GEvent.addListener(gmap.marker, "click", gmap.showAddress);
		gmap.map.addOverlay(gmap.marker);
		gmap.showAddress();
	}
};

gmap.uninit = function(){
	GUnload();
};

gmap.addEvent(window, 'load', gmap.init, false);
gmap.addEvent(window, 'unload', gmap.uninit, false);