// BpLabel 0.14 Copyright 2006 BitPerfect http://www.gmaptools.com - All rights reserved.
function BpLabel(){var _a=0;function ba(_b,_c,_d,_f,_g){this._b=_b;this._c=_c;this._d=_d||'';this._f=_f||'center';this._g=_g||false;this._h=85;this._i=G_MAP_FLOAT_SHADOW_PANE;this._a=++_a;this.isBpLabel=true;}ba.prototype=new GOverlay();var _j=ba.prototype;var _k=null;var _l=false;_j.initialize=function(_m,_g){this._m=_m;if(!_l)_l=GEvent.addListener(_m,'infowindowclose',function(){_k=null;});var _n=document.createElement('div');_n.innerHTML='<div class=\''+this._d+'\'>'+this._c+'</div>';_n.style.position='absolute';if(!this._d){var _o=_n.firstChild.style;_o.border='1px solid black';_o.backgroundColor='white';_o.filter='alpha(opacity:'+this._h+')';_o.KHTMLOpacity=this._h/100;_o.MozOpacity=this._h/100;_o.opacity=this._h/100;_o.fontWeight='bold';_o.whiteSpace='nowrap';_o.paddingRight='3px';_o.paddingLeft='3px';}if(_g||this._g)_n.style.display='none';this._n=_n;this.redraw(true);_m.getPane(this._i).appendChild(_n);this._p();if(this._q)this.setCursor(this._q);if(typeof(this._h)!='undefined')this.setOpacity(this._h);if(this.getHoverLine())this.setHoverLine(this.getHoverLine());this.setZIndex();return _n;};_j.getId=function(){return this._a;};_j._r=function(){var _m=this._m;var _s=_m.getCenter();var _t=_m.getBounds().toSpan();return new GLatLng(_s.lat()-_t.lat(),_s.lng());};_j._p=function(){var _u;var _v=!this.isVisible();if(_v){_u=this.getPoint();var offMapPoint=this._r();this.setPoint(offMapPoint);this.display(true);}this._w=this._x(this._n.firstChild);this._y=this._z(this._n.firstChild);if(_v){this.display(false);this.setPoint(_u);}};_j.getWidth=function(){return this._w;};_j.getHeight=function(){return this._y;};_j.getHtml=function(){return this._c;};_j.setHtml=function(_c){this._c=_c;if(!this._m)return;this._n.firstChild.innerHTML=this._c;if(this.isVisible()){this.hide();this.show();}this._p();this.redraw(true);};_j.getPoint=function(){return this._b;};_j.setPoint=function(_b){this._b=_b;if(typeof(this._aa)=='undefined')this.setZIndex();this.redraw(true);};_j.getOpacity=function(){return this._h;};_j.setOpacity=function(_h){if(_h<0)_h=0;if(_h>100)_h=100;this._h=_h;var _n=this._n;if(_n){var _ab=_h/100;if(typeof(_n.style.filter)=='string')_n.style.filter='alpha(opacity:'+_h+')';if(typeof(_n.style.KHTMLOpacity)=='string')_n.style.KHTMLOpacity=_ab;if(typeof(_n.style.MozOpacity)=='string')_n.style.MozOpacity=_ab;if(typeof(_n.style.opacity)=='string')_n.style.opacity=_ab;}};_j.getClassName=function(){return this._d;};_j.setClassName=function(_d){this._d=_d;this._n.firstChild.className=this._d;this._p();this.redraw(true);};_j.getUserData=function(){return this._ac;};_j.setUserData=function(_ad){this._ac=_ad;};_j.getPane=function(){return this._i;};_j.setPane=function(_i){this._i=_i;};_j.getCursor=function(){return this._q;};_j.setCursor=function(_q){this._q=_q;var _n=this._n;if(_n){try{_n.style.cursor=_q;}catch(e){_n.style.cursor=(_q=='pointer'?'hand':'pointer');}}};_j.getHoverLine=function(){return this._ae;};_j.setHoverLine=function(_af){this._ae=_af;if(!this._m)return;if(this._ae&&!this._ag){this._ah=GEvent.bindDom(this.getEventTarget(),'mouseover',this,this._ai);this._aj=GEvent.bindDom(this.getEventTarget(),'mouseout',this,this._ak);}else if(this._ag){GEvent.removeListener(this._ah);delete this._ah;GEvent.removeListener(this._aj);delete this._aj;}};_j._ai=function(){if(this._ae)this._m.addOverlay(this._ae);};_j._ak=function(){if(this._ae)this._m.removeOverlay(this._ae);};ba.getInfoWindowOpener=function(){return _k;};ba._al=function(_am){_k=_am;};var _an=['openInfoWindow','openInfoWindowHtml','openInfoWindowTabs','openInfoWindowTabsHtml','openInfoWindowXslt','showMapBlowup'];for(var i=0;i<_an.length;i++){_j[_an[i]]=function(){var _m=this._m;if(!_m)return;var _ao=new Array(this._ap());for(var i=0;i<arguments.length;i++)_ao.push(arguments[i]);_m.closeInfoWindow();ba._al(this);_m[_an[i]].apply(_m,_ao);};}_j._aq=function(){var _b=new GPoint(0,0);var _w=this.getWidth();var _y=this.getHeight();switch(this.getAnchor()){case 'n':_b.x-=Math.floor(_w/2);break;case 'ne':_b.x-=_w;break;case 'e':_b.x-=_w;_b.y-=Math.floor(_y/2);break;case 'se':_b.x-=_w;_b.y-=_y;break;case 's':_b.x-=Math.floor(_w/2);_b.y-=_y;break;case 'sw':_b.y-=_y;break;case 'w':_b.y-=Math.floor(_y/2);break;case 'center':_b.x-=Math.floor(_w/2);_b.y-=Math.floor(_y/2);}return _b;};_j.getInfoWindowOffset=function(){return this._ar;};_j.setInfoWindowOffset=function(_b){this._ar=_b;};_j._ap=function(){var _as=parseInt(this._n.style.left);var _at=parseInt(this._n.style.top);_as+=Math.round(this.getWidth()/2);_at+=Math.round(this.getHeight()/2);var _b=new GPoint(_as,_at);if(this._ar){_b.x+=this._ar.x;_b.y+=this._ar.y;}return this._m.fromDivPixelToLatLng(_b);};_j.getAnchor=function(){return this._f;};_j.setAnchor=function(_f){if(new RegExp('^(n|s)?(e|w)?$','i').test(_f)&&_f!='')this._f=_f;else this._f='center';this.redraw(true);};_j.getEventTarget=function(){if(!this._m)return;return this._n.firstChild;};_j.getMap=function(){return this._m;};_j.isMapped=function(){return(this._n&&this.getMap()&&this._n.parentNode===this.getMap().getPane(this.getPane()))?true:false;};_j.isVisible=function(){if(!this.isMapped())return false;return this._n.style.display!='none';};_j.show=function(){this.display(true);};_j.hide=function(){this.display(false);};_j.display=function(_au){if(!this._m)return;if(_au){this._n.style.display='';}else{this._n.style.display='none';}};_j.getZIndex=function(_av){if(typeof(this._aa)!='undefined')return this._aa;if(arguments.length==0)_av=this.getPoint().lat();return GOverlay.getZIndex(_av);};_j.setZIndex=function(_aw){if(arguments.length==0){this.setZIndex(this.getZIndex());delete this._aa;}else{this._aa=_aw;this.getEventTarget().parentNode.style.zIndex=_aw;}};_j.redraw=function(_ax){if(this.isMapped()){var _u=this._m.fromLatLngToDivPixel(this._b);var offset=this._aq();_u.x+=offset.x;_u.y+=offset.y;this._n.style.top=_u.y+'px';this._n.style.left=_u.x+'px';}else{var px=this.getMap().fromLatLngToDivPixel(this._r());this._n.style.top=px.y+'px';this._n.style.left=px.x+'px';this.getMap().getPane(this.getPane()).appendChild(this._n);var _ay=this._n.style.display;this._n.style.display='';this._p();this.getMap().getPane(this.getPane()).removeChild(this._n);this._n.style.display=_ay;}};_j.copy=function(){var _az=new ba(this._b,this._c,this._d,this._f);_az.setOpacity(this.getOpacity());_az.setHoverLine(this.getHoverLine());_az.setZIndex(this.getZIndex());_az.setPane(this.getPane());_az.setUserData(this.getUserData());_az.setCursor(this.getCursor());_az.setInfoWindowOffset(this.getInfoWindowOffset());return _az;};_j.remove=function(){this._n.parentNode.removeChild(this._n);delete this._m;};_j._z=function(_n){if(typeof(_n.offsetHeight)!='undefined')return _n.offsetHeight;else if(typeof(_n.style.pixelHeight)!='undefined')return _n.style.pixelHeight;return 0;};_j._x=function(_n){if(typeof(_n.offsetWidth)!='undefined')return _n.offsetWidth;else if(typeof(_n.style.pixelWidth)!='undefined')return _n.style.pixelWidth;return 0;};window.BpLabel=ba;}BpLabel();
