function createSimpleMarker(markers,markersHtml,geokindsIcons,geokind,point,name,htmlCode,flag)
{
    var icon = geokindsIcons[geokind];
    var marker = new GMarker(point, icon);
    marker.type = geokind;
    GEvent.addListener(marker, "click", function() {
		if(flag != 1)	{
        marker.openInfoWindowHtml('<span class="mapLocationName">' + name + '</span><br/>' + htmlCode);
		} else {
        marker.openInfoWindowHtml(htmlCode);
		}
    });
    markers.push(marker);
	if(flag != 1)   {
    markersHtml.push('<span class="mapLocationName">' + name + '</span><br/>' + htmlCode);
	} else {
    markersHtml.push(htmlCode);
	}
    return marker;
}

function adjustIterZoomFactor(map,mapBounds)
{
    map.setZoom((map.getBoundsZoomLevel(mapBounds))-1);
    var latitude = (mapBounds.getNorthEast().lat() + mapBounds.getSouthWest().lat()) /2;
    var longitude = (mapBounds.getNorthEast().lng() + mapBounds.getSouthWest().lng()) /2;
    map.setCenter(new GLatLng(latitude,longitude));
}

function adjustZoomFactor(map,mapBounds)
{
    map.setZoom(map.getBoundsZoomLevel(mapBounds));
    var latitude = (mapBounds.getNorthEast().lat() + mapBounds.getSouthWest().lat()) /2;
    var longitude = (mapBounds.getNorthEast().lng() + mapBounds.getSouthWest().lng()) /2;
    map.setCenter(new GLatLng(latitude,longitude));
}

function addGeokind(geokinds, geokindIcons, geokind, geokindDescription, iconUrl, iconSize, iconAnchor, infoWindowAnchor, iconShadowUrl, iconShadowSize)
{
    if (geokinds[geokind] == undefined)
    {
        var geokindIcon = new GIcon();
        geokinds[geokind] = geokindDescription;
        geokindIcon.image = iconUrl;
        geokindIcon.iconSize = iconSize;
        geokindIcon.iconAnchor = iconAnchor;
        geokindIcon.infoWindowAnchor = infoWindowAnchor;
        geokindIcon.shadow = iconShadowUrl;
        geokindIcon.shadowSize = iconShadowSize;
        geokindIcons[geokind] = geokindIcon;
    }
}

function toggleMarkerVisibility(map, markers, geokind, showGeokind)
{
   map.closeInfoWindow();
   if (showGeokind == false) 
   {
        for (var index=0;index < markers.length; index++) {
           if (markers[index].type == geokind)
           {
               map.removeOverlay(markers[index]);
           }
        }
   }
   else 
   {
        for (var index=0;index < markers.length; index++)
        {
           if (markers[index].type == geokind)
           {
               map.addOverlay(markers[index]);
           }
        }
   }
}
