var winMap = {};
winMap.MapShow = function(width, height, g_point, api_key, marker)
{
    var scroll = "no";
    var top=0, left=0;
    if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
    if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
    if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
    width = Math.min(width, screen.width-10);
    height = Math.min(height, screen.height-28);
    var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
    wnd.document.write('<html><head>'+"\n"+
        '<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />'+"\n"+
        '<title>Карта</title>'+"\n"+
        '<script type="text/javascript" src="http://www.google.com/jsapi?key='+api_key+'"></script>'+"\n"+
        '<script type="text/javascript">'+"\n"+
        '   google.load("maps", "2", {"callback" : mapsLoaded});'+"\n"+
        '   function mapsLoaded() {'+"\n"+
        '       var map = new google.maps.Map2(document.getElementById("map"));'+"\n"+
        '       var point = new google.maps.LatLng('+g_point+');'+"\n"+
        '       var marker = new google.maps.Marker(point);'+"\n"+
        '       google.maps.Event.addListener(marker, "click", function() {'+"\n"+
        '           marker.openInfoWindowHtml("'+marker+'");'+"\n"+
        '       });'+"\n"+
        '       map.addOverlay(marker);'+"\n"+
        '       map.addControl(new google.maps.LargeMapControl());'+"\n"+
        '       map.setCenter(point, 16);'+"\n"+
        '   }'+"\n"+
        '   function loadMaps() {'+"\n"+
        '       google.load("maps", "2", {"callback" : mapsLoaded, "language" : "ru"});'+"\n"+
        '   }'+"\n"+
        '   google.setOnLoadCallback(loadMaps);'+"\n"+
        '</script></head><body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onunload="GUnload()">'+"\n"+
        '<div style="width: '+width+'px; height: '+height+'px;" id="map">Загрузка карты...</div>'+"\n"+
        '</body></html>'+"\n"
    );
    wnd.document.close();
    if(navigator.appName == "Microsoft Internet Explorer") wnd.document.location.reload(true);
}

