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