var event_map = null;
var marker = null;

var baseIcon = new GIcon();
baseIcon.iconSize=new GSize(32,32);
baseIcon.iconAnchor=new GPoint(16,32);
baseIcon.infoWindowAnchor=new GPoint(5,1);

var customIcon = new GIcon();
customIcon.iconSize=new GSize(32,37);
customIcon.iconAnchor=new GPoint(16,37);
customIcon.infoWindowAnchor=new GPoint(5,1);

var blueIcon = (new GIcon(baseIcon, "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png", null, ""));
var greenIcon = (new GIcon(baseIcon, "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png", null, ""));
var redIcon = (new GIcon(baseIcon, "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png", null, ""));

var customIcons = [];
  	customIcons["blue"] = blueIcon;
  	customIcons["green"] = greenIcon;
  	customIcons["red"] = redIcon;
 	
//---------------------------------------------------------------------
function LoadEventMap() {
    if (GBrowserIsCompatible()) {
        event_map = new GMap2(document.getElementById("item_map"), {draggableCursor:"default"});
        event_map.setMapType(G_NORMAL_MAP);
        		        
        //event_map.addControl(new GMapTypeControl());
        //event_map.addControl(new GLargeMapControl());
		
		//event_map.setCenter(new GLatLng(50.76, 25.35), 13);
		event_map.setCenter(main_pos, 13);
		
		var customUI = event_map.getDefaultUI();
		// Remove MapType.G_HYBRID_MAP
		customUI.maptypes.hybrid = false;
		event_map.setUI(customUI);
		
		if (item_map_location != "") {
			var s = item_map_location.split(',')
			var lat = parseFloat(s[0]);
			var lng = parseFloat(s[1]);
			
			if (marker_icon != "") {
				marker = new GMarker(new GLatLng(lat, lng), {icon: new GIcon(customIcon, "/appmedia/imgs/markers/" + marker_icon, null, ""), draggable: false});
			}
			else {
				marker = new GMarker(new GLatLng(lat, lng), {icon:customIcons["blue"], draggable: false});
			}
			
			event_map.setCenter(new GLatLng(lat, lng), 14);
			event_map.addOverlay(marker);
		}
	}
}
