﻿function showLocation(ele, latitude, longitude, description, locationID, locationIndex, pushpin, imgLocation, city, state, phone, hours, menu, message) {

    document.getElementById('LocationID').value = locationID;
    document.getElementById('LocationIndex').value = locationIndex;
    document.getElementById('divSelected').innerHTML = description;
    document.getElementById('divLocationImage').innerHTML = "<img src='" + imgLocation + "' alt='Location' />";
    document.getElementById('spnCityState').innerHTML = city + ", " + state;
    document.getElementById('spnPhone').innerHTML = phone;
    document.getElementById('divHours').innerHTML = hours;
    document.getElementById('lnkMenu').href = menu;
    document.getElementById('lnkMenu').innerHTML = "<span><span>View Menus</span></span>";
    document.getElementById('pMessage').innerHTML = message;
   
    if (typeof (pushPin) != "undefined" && pushpin != "") {
        var icon = new GIcon(G_DEFAULT_ICON);
        icon.image = pushPin;
        icon.iconSize = new GSize(36, 28);
        icon.iconAnchor = new GPoint(18, 14);
        icon.infoWindowAnchor = new GPoint(18, 14);
    }
    else {
        var icon = new GIcon(G_DEFAULT_ICON);
    }

    var point = new GLatLng(latitude, longitude);
    var marker = new GMarker(point, icon);
    GEvent.addListener(marker, 'click',
        function() {
            marker.openInfoWindowHtml(description);
        }
    );
    map.addOverlay(marker);
    marker.openInfoWindowHtml(description);
    map.setCenter(new GLatLng(latitude, longitude), 13);

    if (ele.id != undefined) {
        $(".selectedLocation").each(function(item) { $(this).removeClass("selectedLocation"); });
        $(ele).addClass("selectedLocation");
    }
}