

function init_map() {
//    if (GBrowserIsCompatible()) {
//	    var $open = "mapPanel";
//	    var options = { path: '/', expires: 365 };
//	    $.cookie($open, 'true', options);
//        pics = data.properties;
//        map = new GMap2(document.getElementById('map_canvas'));
//        var latlng = new GLatLng(maplat, maplng);
//        map.setMapType(G_PHYSICAL_MAP);
//        map.setCenter(latlng, mapzoom);
//        map.addControl(new customControls());
//        var icon = new GIcon(G_DEFAULT_ICON);
//	    icon.iconSize = new GSize(23, 30);
//	    icon.iconAnchor = new GPoint(12,32);
//	    icon.infoWindowAnchor = new GPoint(7,34);
//	    icon.image = "/img/buttons/pointer-single.png";
//        icon.shadow = null;
//        var type = 1;
//        function createMarker(point) {
//            var marker = new GMarker(point, { icon: icon });
//            var fn = markerClickFn(pics[0], latlng, marker);
//            GEvent.addListener(marker, "click", fn);
//            return marker;
//        }
//        var marker = createMarker(latlng);
//        map.addOverlay(marker);
//    }

    var mapoptions;

    mapoptions = $.extend({
        scrollwheel: false,
        streetViewControl: false
    }, options);


    var $open = "mapPanel";
    var options = { path: '/', expires: 365 };
    $.cookie($open, 'true', options);
    pics = data.properties;

    map = new google.maps.Map(document.getElementById("map_canvas"), mapoptions);
    map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
    map.setCenter(new google.maps.LatLng(maplat, maplng));
    map.setZoom(mapzoom);
    var latlng = new google.maps.LatLng(pics[0].latitude, pics[0].longitude);
    var theopts = { position: latlng, icon: "/img/buttons/pointer-single.png" };
    var marker = new google.maps.Marker(theopts);    
    var fn = markerClickFn(pics[0], latlng, marker);
    google.maps.event.addListener(marker, "click", fn);
    marker.setMap(map);

}

function markerClickFn(pic, latlng, marker) {
    return function () {
        var title = pic.servicecode;
        var nights = pic.nights;
        var contentString;
        var request = null;
        $(".infoBox").hide();
        $(".mapInfoList").hide();

        var myOptions = {
            content: "Loading..."
            , alignBottom: true
            , closeBoxMargin: "5px 8px 2px 2px"
            , pixelOffset: new google.maps.Size(-140, -10)
            , boxClass: "mapInfoList"
            , closeBoxURL: "/img/buttons/mapInfo-close.png"
        };

        var ib = new InfoBox(myOptions);
        ib.open(map, marker);

        map.panTo(marker.getPosition());
        
        request = jQuery.ajax({
            type: "GET",
            url: "/propinfocontent.aspx?data=" + title + ":" + nights,
            cache: false,
            success: function (html) {
                ib.setContent(html);
                $("#mapInfoList_contents .inner").css("padding-bottom", "0");
                $("#mapInfoList_l").addClass("singlePropHeight");
                $("#mapInfoList_r").addClass("singlePropHeight");
                $("#mapInfoList_bl").addClass("singlePropTop");
                $("#mapInfoList_br").addClass("singlePropTop");
                $("#mapInfoList_b").addClass("singlePropTop");
                $("#mapInfoList_contents").addClass("singlePropHeightInner");
                $("#mapInfoList_beak").addClass("singlePropBeak");
            }
        });
    }
}
