var map;
var bounds = new GLatLngBounds();

function loadMap(lat,lng) {
	if (GBrowserIsCompatible()) {
        	map = new GMap2( document.getElementById("map") );
                map.addControl( new GLargeMapControl() );
                map.addControl( new GMapTypeControl() );
                map.setCenter( new GLatLng(lat,lng) );
        }
}

function addMarker( img , html, zoom, lat, lng ) {
	var icon = new GIcon(G_DEFAULT_ICON , img);
        icon.iconAnchor = new GLatLng(17,17);
        icon.infoWindowAnchor = new GLatLng(17,17);

        var point = new GLatLng(lat,lng);
        var marker = new GMarker( point , icon );

	if ( html != "" ) {
        	GEvent.addListener(marker, "click", function() {
                	marker.openInfoWindowHtml(html);
                });
        } else {
	       icon.iconSize = new GSize(35,35);
               marker = new GMarker( point , icon );
        }

        bounds.extend( point );

       	if ( zoom > 0 ) {
		map.setZoom(zoom);
        } else {
        	map.setZoom(map.getBoundsZoomLevel(bounds));
        }
        
	map.setCenter( bounds.getCenter() );
        map.addOverlay(marker);
}

