function LabeledMarker(latlng,opt_opts){this.opts_=opt_opts;this.labelText_=opt_opts.labelText||"";this.labelClass_=opt_opts.labelClass||"LabeledMarker_markerLabel";this.labelOffset_=opt_opts.labelOffset||new GSize(0,0);this.clickable_=opt_opts.clickable||true;this.title_=opt_opts.title||"";this.labelVisibility_=true;this.ownVisibility_=true;this.div_=document.createElement("div");this.div_.className=this.labelClass_;this.div_.innerHTML=this.labelText_;this.div_.style.position="absolute";this.div_.style.cursor="pointer";this.div_.title=this.title_;if(opt_opts.draggable){opt_opts.draggable=false;}
GMarker.apply(this,arguments);}
LabeledMarker.prototype=new GMarker(new GLatLng(0,0));LabeledMarker.prototype.initialize=function(map){GMarker.prototype.initialize.apply(this,arguments);this.map_=map;if(!this.ownVisibility_){this.hide();}
this.applyLabelVisibility_();map.getPane(G_MAP_MARKER_PANE).appendChild(this.div_);if(this.clickable_){var eventPassthrus=['click','dblclick','mousedown','mouseup','mouseover','mouseout'];for(var i=0;i<eventPassthrus.length;i++){var name=eventPassthrus[i];GEvent.addDomListener(this.div_,name,GEvent.callback(GEvent,GEvent.trigger,this,name,this.getLatLng()));}}};LabeledMarker.prototype.redraw=function(force){GMarker.prototype.redraw.apply(this,arguments);this.redrawLabel_();};LabeledMarker.prototype.redrawLabel_=function(){var p=this.map_.fromLatLngToDivPixel(this.getLatLng());var z=GOverlay.getZIndex(this.getLatLng().lat());this.div_.style.left=(p.x+this.labelOffset_.width)+"px";this.div_.style.top=(p.y+this.labelOffset_.height)+"px";this.div_.style.zIndex=z;};LabeledMarker.prototype.remove=function(){GEvent.clearInstanceListeners(this.div_);if(this.div_.outerHTML){this.div_.outerHTML="";}
if(this.div_.parentNode){this.div_.parentNode.removeChild(this.div_);}
this.div_=null;GMarker.prototype.remove.apply(this,arguments);};LabeledMarker.prototype.copy=function(){var newMarker=new LabeledMarker(this.getLatLng(),this.opts_);newMarker.labelVisibility_=this.labelVisibility_;newMarker.ownVisibility_=this.ownVisibility_;return newMarker;};LabeledMarker.prototype.show=function(){GMarker.prototype.show.apply(this,arguments);this.ownVisibility_=true;this.applyLabelVisibility_();};LabeledMarker.prototype.hide=function(){GMarker.prototype.hide.apply(this,arguments);this.ownVisibility_=false;this.applyLabelVisibility_();};LabeledMarker.prototype.setLabelVisibility=function(visibility){this.labelVisibility_=visibility;this.applyLabelVisibility_();};LabeledMarker.prototype.getLabelVisibility=function(){return this.labelVisibility_;};LabeledMarker.prototype.applyLabelVisibility_=function(){if((!this.isHidden())&&this.labelVisibility_){this.div_.style.display='block';}else{this.div_.style.display='none';}};LabeledMarker.prototype.setLabelText=function(text){this.labelText_=text;this.div_.innerHTML=text;this.opts_.labelText=text;};