var PANE_LINE=G_MAP_MAP_PANE;var PANE_STOP=G_MAP_MARKER_SHADOW_PANE;var PANE_STOP_LABEL=G_MAP_MARKER_PANE;var PANE_VEHICLE=G_MAP_FLOAT_SHADOW_PANE;var PANE_VEHICLE_LABEL=G_MAP_MARKER_MOUSE_TARGET_PANE;var PANE_FLOAT_LABEL=G_MAP_FLOAT_PANE;var label_zindex_counter=1;function Marker(){};Marker.prototype=new GOverlay();Marker.prototype.Add=function(){if(this.visible)return;this.visible=true;this.initialize(map);if(this.label&&vehicle_labels_visible)map.addLabel(this.label);};Marker.prototype.remove=function(){this.Remove();};Marker.prototype.Remove=function(){if(!this.visible)return;this.mapTray.removeChild(this.element);if(this.label)map.removeLabel(this.label);if(this.FloatLabel){map.removeLabel(this.FloatLabel);this.FloatLabel=null;}this.visible=false;};Marker.prototype.initialize=function(map){image_to_load=new Image();image_to_load.src=this.image;this.w=image_to_load.width;this.h=image_to_load.height;var b=document.createElement('img');b.parentMarker=this;b.setAttribute('id',this.id);b.setAttribute('src',this.image);b.style.position='absolute';this.element=b;this.mapTray=map.getPane(this.pane);this.mapTray.appendChild(b);this.Move();this.Align(this.w,this.h);GEvent.bind(map,"zoomend",this,function(){this.Move();});GEvent.bind(map,"moveend",this,function(){this.Move();});};Marker.prototype.redraw=function(force){this.Move();};Marker.prototype.Move=function(position){if(position)this.position=position;if(this.label&&this.label.visible)this.label.setPosition(this.position);if(this.FloatLabel&&this.FloatLabel.visible)this.FloatLabel.setPosition(this.position);var b=map.fromLatLngToDivPixel(this.position);this.x=parseInt(b.x);this.y=parseInt(b.y);this.Align(this.w,this.h);};Marker.prototype.AlignFloatLabel=function(){if(this.FloatLabel){with(Math){switch(this.FloatLabel.anchorPoint){case 'topLeft':this.FloatLabel.markerOffset=new GSize(-(this.w/2),-(this.h/2));break;case 'topRight':this.FloatLabel.markerOffset=new GSize(this.w/2,-this.h/2);break;case 'bottomRight':this.FloatLabel.markerOffset=new GSize(this.w/2,this.h/2);break;case 'bottomLeft':this.FloatLabel.markerOffset=new GSize(-this.w/2,this.h/2);break;default:break;}}this.FloatLabel.setPosition();}};Marker.prototype.Align=function(w,h){this.w=w;this.h=h;this.element.style.width=this.w+"px";this.element.style.height=this.h+"px";this.element.style.left=this.x-Math.floor(this.w/2)+"px";this.element.style.top=this.y-Math.floor(this.h/2)+"px";this.AlignFloatLabel();if(this.label){with(Math){switch(this.label.anchorPoint){case 'topLeft':this.label.markerOffset=new GSize(-(this.w/2),-(this.h/2));break;case 'topRight':this.label.markerOffset=new GSize(this.w/2,-this.h/2);break;case 'bottomRight':this.label.markerOffset=new GSize(this.w/2,this.h/2);break;case 'bottomLeft':this.label.markerOffset=new GSize(-this.w/2,this.h/2);break;default:break;}}this.label.setPosition();}};Marker.prototype.getPoint=function(){return(this.position);};Marker.prototype.ChangeImage=function(image){this.image=image;this.element.src=image;image_to_load=new Image();image_to_load.src=image;var w=image_to_load.width;var h=image_to_load.height;if(this.w!=w||this.h!=h)this.Align(w,h);};Marker.prototype.ShowFloatingLabel=function(){if(!this.FloatLabel){var label=new Label();label.pane=this.FloatLabelPane;if(this.FloatLabelExtraProperties)label.extraprops=this.FloatLabelExtraProperties;label.visible=false;label.id="float_label_"+this.id;label.content="";label.anchorPoint=this.FloatLabelAnchor;this.FloatLabel=label;}if(!this.FloatLabel.initialized){this.FloatLabel.anchorLatLng=this.position;this.FloatLabel.classname=this.FloatLabelClassName;this.FloatLabel.percentOpacity=this.FloatLabelOpacity;this.FloatLabel.content=this.content;map.addLabel(this.FloatLabel);this.AlignFloatLabel();this.FloatLabel.initialized=true;}else{this.FloatLabel.setOpacity(this.labelOpacity);this.FloatLabel.setHTML(this.content);this.FloatLabel.setPosition(this.position);}this.FloatLabel.visible=true;var div_obj=document.getElementById(this.FloatLabel.id);div_obj.style.visibility="visible";div_obj.style.zIndex=label_zindex_counter++;};Marker.prototype.HideFloatingLabel=function(){if(this.FloatLabel&&this.FloatLabel.initialized){this.FloatLabel.visible=false;var div_obj=document.getElementById(this.FloatLabel.id);if(div_obj){document.getElementById(this.FloatLabel.id).style.visibility="hidden";div_obj.style.zIndex="";}}};Marker.prototype.FloatLabelVisible=function(){return(this.FloatLabel&&this.FloatLabel.visible);};