SimpleGMap = function(id, lat, lng, zoom, xx, yy)  
{  
    if(!id) return; else this.id = id;  
    (!!lat)?this.lat=lat:this.lat=xx;  
    (!!lng)?this.lng=lng:this.lng=yy;  
    (!!zoom)?this.zoom=zoom:this.zoom=15;  
      
    this.map;  
    this.mapControl = new GLargeMapControl();  
    this.mapScale = true;  
    this.mapType = true;  
    this.mapOverview = true;  
    this.markers = [];  
      
    this.onLoad(this, "createMap");
}  
//  
// public function  
//  
SimpleGMap.prototype.addMarker = function(lat, lng, label)  
{  
    var obj = { lat:   lat,  
                lng:   lng,  
                label: label  
                }  
    this.markers.push(obj);  
}  
SimpleGMap.prototype.addMapControl = function(type)  
{  
    if(type=="L") this.mapControl = new GLargeMapControl();  
    else if(type=="S") this.mapControl = new GSmallMapControl();  
    else this.mapControl = false;  
}  
SimpleGMap.prototype.addScale = function(b)  
{  
    this.mapScale = b;  
}  
SimpleGMap.prototype.addType = function(b)  
{  
    this.mapType = b;  
}  
SimpleGMap.prototype.addOverview = function(b)  
{  
    this.mapOverview = b;  
}  
//  
// private function  
//  
SimpleGMap.prototype.onLoad = function(scope, func)  
{  
    if(window.addEventListener) window.addEventListener('load', function(e){ scope[func](e); }, false);  
    else if(window.attachEvent) window.attachEvent('onload', function(e){ scope[func](e); });  
}  
SimpleGMap.prototype.createMap = function()  
{  
    if(GBrowserIsCompatible())  
    {  
        this.map = new GMap2(document.getElementById(this.id));  
        if(this.mapControl) this.map.addControl(this.mapControl);  
        if(this.mapScale) this.map.addControl(new GScaleControl());  
        if(this.mapType) this.map.addControl(new GMapTypeControl());  
        if(this.mapOverview) this.map.addControl(new GOverviewMapControl());  
        this.map.setCenter(new GLatLng(this.lat, this.lng), this.zoom);   
    }  
      
    var len = this.markers.length;  
    var bounds = new GLatLngBounds();  
    for(var i=0; i<len; i++)  
    {  
        var m = this.markers[i];  
        var marker = this.createMarker(m.lat, m.lng, m.label);  
        this.map.addOverlay(marker);  
        bounds.extend(new GLatLng(m.lat, m.lng));  
    }  
    if(len>1) this.map.setCenter(bounds.getCenter(), this.map.getBoundsZoomLevel(bounds));  
}  
SimpleGMap.prototype.createMarker = function(lat, lng, label)  
{  
    var marker = new GMarker(new GLatLng(lat, lng));  
    GEvent.addListener(marker, "click", function() {  
        marker.openInfoWindowHtml(label);  
    });  
    return marker;  
}     
