﻿function googleMaps_setCenter(point, zoom) { map.setCenter(point, zoom); }

function googleMaps_setCenterLatLng(lat, lng, zoom) {
    map.setCenter(new GLatLng(lat, lng), zoom);
}

function googleMaps_panTo(lat, lng) { map.panTo(new GLatLng(lat, lng)); }
function googleMaps_addOverlay(o) { map.addOverlay(o); }
function googleMaps_delOverlay(o) { map.removeOverlay(o); }
function googleMaps_clearOverlays() { map.clearOverlays(); }
function googleMaps_getCenter() { return map.getCenter(); }
function googleMaps_getZoom() { return map.getZoom(); }
function googleMaps_getBounds() { return map.getBounds(); }
function googleMaps_checkResize() { map.checkResize(); }

var icons_base = new GIcon(G_DEFAULT_ICON);
icons_base.shadow = 'img/marker_shadow.png';
icons_base.shadowSize = new GSize(36, 29);
icons_base.iconSize = new GSize(25, 29);
icons_base.iconAnchor = new GPoint(12, 29);
var single_icon = new GIcon(icons_base, 'img/single_marker.gif');
var condominium_icon = new GIcon(icons_base, 'img/condominium_marker.gif');
var farm_icon = new GIcon(icons_base, 'img/farm_marker.gif');
var land_icon = new GIcon(icons_base, 'img/land_marker.gif');
var townhouse_icon = new GIcon(icons_base, 'img/townhouse_marker.gif');
var mobile_icon = new GIcon(icons_base, 'img/mobile_marker.gif');
var all_icon = new GIcon(icons_base, 'img/all_marker.gif');

function addMarker(i, p) {
    var m = new GMarker(p, i);
    GEvent.addListener(m, "click", showMarkerInfo);
    googleMaps_addOverlay(m);
    return m;
}

function fixMinWidthForIE() {
    try {
        if (!document.body.currentStyle) { return } //IE only
    } catch (e) { return; }
    var elems = document.getElementsByTagName("*");
    for (e = 0; e < elems.length; e++) {
        var eCurStyle = elems[e].currentStyle;
        var l_minWidth = (eCurStyle.minWidth) ? eCurStyle.minWidth : eCurStyle.getAttribute("min-width"); //IE7 : IE6
        if (l_minWidth && l_minWidth != 'auto') {
            var shim = document.createElement("DIV");
            shim.style.cssText = 'margin:0 !important; padding:0 !important; border:0 !important; line-height:0 !important; height:0 !important; BACKGROUND:RED;';
            shim.style.width = l_minWidth;
            shim.appendChild(document.createElement("&nbsp;"));
            if (elems[e].canHaveChildren) {
                elems[e].appendChild(shim);
            } else {
                //??
            }
        }
    }
}
