// load a google map

function mapInit(id, lat,lon) 
{
    var gmap = new GMap2(document.getElementById("map_" + id)); 
    gmap.setCenter(new GLatLng(lat, lon), 15);
    gmap.addOverlay(new GMarker(new GLatLng(lat, lon)));
    gmap.addControl(new GSmallMapControl());
}
function toggleMap(id, p_lat,p_lon) 
{
    var map_holder = document.getElementById("map_holder_"+id);
    var map_arrow = document.getElementById("map_arrow_"+id);
    var map_holder_jq = $("#map_holder_"+id);
    if (map_holder_jq.css("display")=="none") {
        map_arrow.src = "/images/gen/arrow_or_dwn.gif";
        map_holder_jq.slideDown("slow",function() {
            mapInit(id, p_lat,p_lon);
        });
    } else {
        map_arrow.src = "/images/gen/arrow_or_right.gif"
        map_holder.firstChild.removeChild(map_holder.firstChild.firstChild);
        var d = document.createElement('div');
        d.id='map_'+id;
        d.style.width='410px';
        d.style.height='260px';
        map_holder.firstChild.appendChild(d);
        map_holder_jq.slideUp("slow");
    }
}

