var marker = null;

/**
 * Affiche le marqueur d'un restaurant
 */
function showResto(restoId,restoLat,restoLng,icone,min,max) {

    var point = new GLatLng(restoLat, restoLng);
    var minifiche = 'minifiche';
    var miniheight = 170;
    var noclick = false;

    if (icone=='default') {
        marker[restoId] = new GMarker( point , {
            icon:pdjIcon
        });
    }
    if (icone=='default_sm') {
        marker[restoId] = new GMarker( point , {
            icon:pdjIcon_sm
        });
        minifiche = 'minifiche_sm';
        miniheight = 120;
        noclick = true;
    }
    if (icone=='grey') {
        marker[restoId] = new GMarker( point , {
            icon:idrIcon
        });
    }
    if (icone=='grey_sm') {
        marker[restoId] = new GMarker( point , {
            icon:idrIcon_sm
        });
        minifiche = 'minifiche_sm';
        miniheight = 120;
        noclick = true;
    }

    GEvent.addListener(marker[restoId], 'mouseover', function(){
        actual_resto = restoId;
        marker[restoId].openExtInfoWindow(
            map,
            "idresto_window",
            "Chargement ...",
            {
                beakOffset: 3,
                ajaxUrl: "/ajax/"+minifiche+"/"+restoId+"/",
                contentHeight : miniheight
            }
            );
    });

    if (!noclick) {
        GEvent.addListener(marker[restoId], 'click', function() {
            showDetail(restoId)
        });

    }
    map.addOverlay(marker[restoId]);

}


function showDetail(restoId) {
    marker[restoId].openExtInfoWindow(
        map,
        "idresto_window2",
        "Chargement ...",
        {
            beakOffset: 3,
            ajaxUrl: "/ajax/detail/"+restoId,
            contentHeight : 320,
            ajaxCallback : RestoTabs
        }
        );
    GEvent.clearListeners(marker[restoId], 'mouseout');
}
