// vim: set et ts=4 sw=4 fdm=marker:
// +----------------------------------------------------------------------+
// | Google Maps API 2.0 With Javascrip                                   |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2006 Studiomeg, Inc.                            |
// | All rights reserved.                                                 |
// +----------------------------------------------------------------------+
// | gmapManager.js is a Utility functions for Google Maps API                   |
// | This LICENSE is in the BSD license style.                            |
// +----------------------------------------------------------------------+
// | Author: Yoshiki Shigekawa                                            |
// +----------------------------------------------------------------------+

if(typeof gm == "undefined") gm = new Object();
if(typeof gm.catalase == "undefined") gm.catalase = new Object();
if(typeof gm.catalase.Util == "undefined") gm.catalase.Util = new Object();

gm.catalase.GmapManager = function(id)
{
    this._id = id;
    this._targetElement = document.getElementById(id);
    
    this._gmap = new GMap2(this._targetElement);
}

gm.catalase.GmapManager.prototype.initialize = function(id)
{
    if (!GBrowserIsCompatible()) {
        return false;
    }
    
    this._gmap =new GMap2(this._targetElement);
}

gm.catalase.GmapManager.prototype.addControl = function()
{
    this._gmap.addControl(new GLargeMapControl());
}

gm.catalase.GmapManager.prototype.addInfoWindow = function(latitude, longitude, text)
{
    var point = new GPoint(longitude, latitude);
    this._gmap.openInfoWindowHTML(point, text);
}

gm.catalase.GmapManager.prototype.addMarker = function(latitude, longitude)
{
    var point = new GPoint(longitude, latitude);
    var overlay = new GMarker(point);
    this._gmap.addOverlay(overlay);
}

gm.catalase.GmapManager.prototype.getLatLng = function()
{
    var point = this._gmap.getCenter();
    var LatLng = new Object();
    LatLng.x = point.x;
    LatLng.y = point.y;
    
    return LatLng;
}

gm.catalase.GmapManager.prototype.moveCenter = function(latitude, longitude, zoom)
{
    if (!zoom) {
        zoom = 15;
    }
    var latlng = new GLatLng(latitude, longitude);
    this._gmap.setCenter(latlng, zoom);
}


