var label_start_html="<div class='$class$' $props$>";var label_end_html="</div>";var infolabel;function Label(marker){if(marker){this.marker=marker;this.anchorLatLng=marker.getPoint();this.initialized=true;}else this.initialized=false;};Label.prototype.GetStartHTML=function(){var text=label_start_html;if(this.classname)text=text.replace("$class$",this.classname);else text=text.replace("$class$","map_label");if(this.extraprops)text=text.replace("$props$",this.extraprops);else text=text.replace("$props$","");return(text);};Label.prototype.initialize=function(a){var b=document.createElement('div');b.parentLabel=this;b.setAttribute('id',this.id);b.innerHTML=this.GetStartHTML()+this.content+label_end_html;document.body.appendChild(b);b.style.position='absolute';if(this.color)b.style.backgroundColor=this.color;if(this.text_color)b.style.color=this.text_color;if(!this.pane)this.pane=PANE_FLOAT_LABEL;if(!this.visible)b.style.visibility="hidden";if(this.percentOpacity)this.setOpacity(this.percentOpacity);this.w=document.getElementById(this.id).offsetWidth;this.h=document.getElementById(this.id).offsetHeight;this.mapTray=a.getPane(this.pane);this.mapTray.appendChild(b);if(!this.markerOffset)this.markerOffset=new GSize(0,0);this.setPosition();this.zoomend_event=GEvent.bind(a,"zoomend",this,function(){this.setPosition();});this.moveend_event=GEvent.bind(a,"moveend",this,function(){this.setPosition();});};Label.prototype.setPosition=function(a){if(a)this.anchorLatLng=a;var b=map.fromLatLngToDivPixel(this.anchorLatLng);var x=parseInt(b.x);var y=parseInt(b.y);var d=document.getElementById(this.id);if(d){this.w=d.offsetWidth;this.h=d.offsetHeight;}with(Math){switch(this.anchorPoint){case 'topLeft':break;case 'topCenter':x-=floor(this.w/2);break;case 'topRight':x-=this.w;break;case 'midRight':x-=this.w;y-=floor(this.h/2);break;case 'bottomRight':x-=this.w;y-=this.h;break;case 'bottomCenter':x-=floor(this.w/2);y-=this.h;break;case 'bottomLeft':y-=this.h;break;case 'midLeft':y-=floor(this.h/2);break;case 'center':x-=floor(this.w/2);y-=floor(this.h/2);break;default:break;}}if(d){d.style.left=x-this.markerOffset.width+'px';d.style.top=y-this.markerOffset.height+'px';}};Label.prototype.setOpacity=function(b){if(b<0)b=0;if(b>100)b=100;var c=b/100;var d=document.getElementById(this.id);if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+b+')';}if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}};Label.prototype.setClassName=function(b){var d=document.getElementById(this.id);d.setAttribute("class",b);d.setAttribute("className",b);this.classname=b;};Label.prototype.setColor=function(b){var d=document.getElementById(this.id);d.style.backgroundColor=b;this.color=b;};Label.prototype.setTextColor=function(b){var d=document.getElementById(this.id);d.style.color=b;this.text_color=b;};Label.prototype.setHTML=function(b){this.content=b;var d=document.getElementById(this.id);if(d){d.innerHTML=this.GetStartHTML()+this.content+label_end_html;}};GMap2.prototype.addLabel=function(a){a.initialize(this);};GMap2.prototype.removeLabel=function(a){var b=document.getElementById(a.id);if(b!=null){a.mapTray.removeChild(b);delete(b);}if(a){GEvent.removeListener(a.zoomend_event);GEvent.removeListener(a.moveend_event);}}