function GoogleMapObject() {
    this.$element = null;
    this.elementID = null;
    this.map = null;
    this.mapOptions = null;

    this.addLayerKML = function(urlIn, clickEventIn) {
        var k = new google.maps.KmlLayer(urlIn, {
            map: this.map,
            preserveViewport: true,
            suppressInfoWindows: true
        });

        google.maps.event.addListener(k, "click", clickEventIn);
    }

    this.addMarker = function(latitudeIn, longitudeIn, titleIn, clickEventIn) {
        var m = new google.maps.Marker({
            position: new google.maps.LatLng(latitudeIn, longitudeIn),
            map: this.map,
            title: titleIn
        });

        google.maps.event.addListener(m, "click", clickEventIn);
    }
}

function initMap(elementIDIn, centerLatIn, centerLonIn, zoomIn) {
    var map = new GoogleMapObject();
    map.elementID = elementIDIn;
    map.$element = $("#" + map.elementID);

    map.mapOptions = {
        center: new google.maps.LatLng(centerLatIn, centerLonIn),
        disableDefaultUI: true,
        disableDoubleClickZoom: true,
        draggable: true,
        keyboardShortcuts: false,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        scrollwheel: false,
        zoom: zoomIn
    };

    map.map = new google.maps.Map(document.getElementById(map.elementID), map.mapOptions);
    return map;
}
