function KGoogleMap(lhtmlid,lcenter_lat,lcenter_long,lzoom,lwidth,lheight){
  this.ok=GBrowserIsCompatible();
  this.center_lat=lcenter_lat;
  this.center_long=lcenter_long;
  this.zoom=lzoom;
  this.htmlid=lhtmlid;
  this.icons=new Array();
  this.markers=new Array();

  this.setIcon=KGM_DefineIcon;
  this.addMarker=KGM_DefineMarker;
  this.recenter=KGM_RecenterMap;
  this.custom_center=KGM_CustomCenterMap;
  this.reset=KGM_TotalReset;
  this.removeTypeControls=KGM_RemoveTypeControls;
  
  this.map=new GMap2(document.getElementById(lhtmlid),{size:new GSize(lwidth,lheight)});
  this.centerpoint=new GLatLng(lcenter_lat,lcenter_long);
  this.map.setCenter(this.centerpoint,lzoom);
  
  this.map_control = new GMapTypeControl();
  this.map.addControl(this.map_control);
  this.map.addControl(new GLargeMapControl());  
}
function KGM_RecenterMap(){
  if(this.ok){this.map.setCenter(this.centerpoint,this.zoom);}
}
function KGM_CustomCenterMap(newlat,newlong,newzoom){
  if(this.ok){
    var point=new GLatLng(newlat,newlong);
    this.map.setCenter(point,newzoom);
  }
}
function KGM_TotalReset(){
  if(this.ok){
    this.recenter();
    for(var i=0;i<this.markers.length;i++){
      this.map.removeOverlay(this.markers[i]);
    }
    this.markers=new Array();
  }
}
function KGM_DefineIcon(icon_id,icon_width,icon_height,icon_img){
  if(this.ok){
    this.icons[icon_id]=new GIcon(G_DEFAULT_ICON,icon_img);
    this.icons[icon_id].iconSize = new GSize(icon_width,icon_height);
  }
}
function KGM_DefineMarker(icon_id,pos_lat,pos_long,html){
  if(this.ok){
    var point=new GLatLng(pos_lat,pos_long);
    var i=this.markers.length;
    this.markers[i]=new GMarker(point,{icon:this.icons[icon_id]});
    if(html!=''){
      var thismarker=this.markers[i];
      GEvent.addListener(thismarker, "click", function() {
        thismarker.openInfoWindowHtml(html);
      });
    }
    this.map.addOverlay(this.markers[i]);
  }
}
function KGM_RemoveTypeControls(){
  if(this.ok){
    this.map.removeControl(this.map_control);
  }
}
