
function Infowin(latlng,html,title){this.latlng_=latlng;this.html_=html;this.title_=title;this.prototype=new GOverlay();this.initialize=function(map){var div=$('<div />').addClass('infowin');div.css({position:'absolute',width:246}).appendTo(map.getPane(G_MAP_FLOAT_PANE))
this.map_=map;this.div_=div;this.update(html,title);}
this.update=function(html,title){this.html_=html;this.title_=title;this.div_.empty();var close=$('<a id="close" href="#" onclick="closeOverlay();">close</a>').css({'background':'url(/img/infow-close.png) no-repeat','float':'right','margin-right':'10px','margin-top':'-12px','width':'10px','height':'10px','display':'block','text-indent':'-9999px'});$('<div />').css({'background-image':'url(/img/infow-top.png)',height:21,'font-family':'Arial,Verdana,Tahoma,Arial,sans-serif','font-size':'0.97em',color:'#97ADDE',padding:'22px 0 0 15px'}).append(close,title).appendTo(this.div_);var content=$('<div/>').addClass('infowin-content').css({'position':'relative','overflow':'hidden','max-height':104,'font-family':'Arial,Verdana,Tahoma,Arial,sans-serif','font-size':'0.9em',color:'#97ADDE','top':0}).html(html);$('<div />').css({'background-image':'url(/img/infow-bottom.png)','background-position':'bottom left','padding':'10px 10px 55px 15px'}).append(content).appendTo(this.div_);this.redraw(true);}
this.remove=function(){this.div_.remove();}
this.getMarker=function(key){return marker[key];}
this.setActiveKey=function(key){activeKey=key;}
this.copy=function(){return new Infowin(this.latlng_,this.html_);}
this.redraw=function(force){if(!force)return;var point=this.map_.fromLatLngToDivPixel(this.latlng_);this.div_.css({left:point.x-105,top:point.y-this.div_.height()+15});}}
function closeOverlay(){map.closeInfoWindow();}
function Tooltip(marker,content,padding){this.marker=marker;this.content=content;this.padding=padding;this.div=null;this.map=null;}
Tooltip.prototype=new GOverlay();Tooltip.prototype.initialize=function(map){this.div=document.createElement("div");var innerContainer=this.div.cloneNode(false);this.div.appendChild(innerContainer);this.div.style.position='absolute';this.div.style.visibility='hidden';this.shadowQuadrants=[{},{},{},{}]
this.shadowQuadrants[0].div=document.createElement('div');this.shadowQuadrants[0].div.style.position='absolute';this.shadowQuadrants[0].div.style.overflow='hidden';this.shadowQuadrants[0].img=createPngElement('/examples/Tooltip_v2/tooltip_shadow.png');this.shadowQuadrants[0].img.style.position='absolute';this.shadowQuadrants[0].div.appendChild(this.shadowQuadrants[0].img);this.shadowQuadrants[1].div=this.shadowQuadrants[0].div.cloneNode(false);this.shadowQuadrants[1].img=this.shadowQuadrants[0].img.cloneNode(true);this.shadowQuadrants[1].div.appendChild(this.shadowQuadrants[1].img);this.shadowQuadrants[2].div=this.shadowQuadrants[0].div.cloneNode(false);this.shadowQuadrants[2].img=this.shadowQuadrants[0].img.cloneNode(true);this.shadowQuadrants[2].div.appendChild(this.shadowQuadrants[2].img);this.shadowQuadrants[3].div=this.shadowQuadrants[0].div.cloneNode(false);this.shadowQuadrants[3].img=this.shadowQuadrants[0].img.cloneNode(true);this.shadowQuadrants[3].div.appendChild(this.shadowQuadrants[3].img);this.shadowQuadrants[0].div.style.right='0px';this.shadowQuadrants[0].div.style.top='0px';this.shadowQuadrants[0].img.style.top='0px';this.shadowQuadrants[0].img.style.right='0px';this.shadowQuadrants[1].div.style.left='0px';this.shadowQuadrants[1].div.style.top='0px';this.shadowQuadrants[1].img.style.top='0px';this.shadowQuadrants[2].div.style.left='0px';this.shadowQuadrants[2].div.style.bottom='0px';this.shadowQuadrants[2].img.style.bottom='0px';this.shadowQuadrants[2].img.style.left='0px';this.shadowQuadrants[3].div.style.right='0px';this.shadowQuadrants[3].div.style.bottom='0px';this.shadowQuadrants[3].img.style.bottom='0px';this.shadow=this.div.cloneNode(false);this.shadow.appendChild(this.shadowQuadrants[0].div);this.shadow.appendChild(this.shadowQuadrants[1].div);this.shadow.appendChild(this.shadowQuadrants[2].div);this.shadow.appendChild(this.shadowQuadrants[3].div);innerContainer.className='tooltip';var child=typeof this.content=='string'?document.createTextNode(this.content):this.content;innerContainer.appendChild(child);map.getPane(G_MAP_FLOAT_PANE).appendChild(this.div);map.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(this.shadow);this.map=map;}
Tooltip.prototype.remove=function(){this.div.parentNode.removeChild(this.div);}
Tooltip.prototype.copy=function(){var content=typeof this.content=='string'?this.content:this.content.cloneNode(true);return new Tooltip(this.marker,content,this.padding);}
Tooltip.prototype.redraw=function(force){if(!force)return;var markerPos=this.map.fromLatLngToDivPixel(this.marker.getPoint());var iconAnchor=this.marker.getIcon().iconAnchor;var xPos=Math.round(markerPos.x-this.div.clientWidth/2);var yPos=markerPos.y-iconAnchor.y-this.div.clientHeight-this.padding;this.div.style.top=yPos+'px';this.div.style.left=xPos+'px';shadowAnchor=new GPoint(markerPos.x+Math.round((this.marker.getIcon().iconSize.height+this.padding)/2),markerPos.y-Math.round((this.marker.getIcon().iconSize.height+this.padding)/2)+4);var shadowSize=new GSize(this.div.clientWidth+Math.round(this.div.clientHeight/2)+8,Math.round(this.div.clientHeight/2)+10);if(shadowSize.width%2==1)shadowSize.width--;if(shadowSize.height%2==1)shadowSize.height--;this.shadow.style.left=(shadowAnchor.x-(shadowSize.width-shadowSize.height-10)/2)+'px';this.shadow.style.top=(shadowAnchor.y-shadowSize.height)+'px';this.shadow.style.width=(shadowSize.width)+'px';this.shadow.style.height=shadowSize.height+'px';var qHeight=shadowSize.height/2;var qOddWidth=shadowSize.height>shadowSize.width?shadowSize.height/2:(shadowSize.width)/2;var qEvenWidth=shadowSize.width-qOddWidth;this.shadowQuadrants[0].div.style.width=qOddWidth+'px';this.shadowQuadrants[0].div.style.height=qHeight+'px';this.shadowQuadrants[1].div.style.width=qEvenWidth+'px';this.shadowQuadrants[1].div.style.height=qHeight+'px';this.shadowQuadrants[1].img.style.left=-(160-shadowSize.height)+'px';this.shadowQuadrants[2].div.style.width=qOddWidth+'px';this.shadowQuadrants[2].div.style.height=qHeight+'px';this.shadowQuadrants[3].div.style.width=qEvenWidth+'px';this.shadowQuadrants[3].div.style.height=qHeight+'px';this.shadowQuadrants[3].img.style.right=-(160-shadowSize.height)+'px';}
Tooltip.prototype.show=function(){this.div.style.visibility='visible';this.shadow.style.visibility='visible';}
Tooltip.prototype.hide=function(){this.div.style.visibility='hidden';this.shadow.style.visibility='hidden';}
var IS_IE=false;var IS_LT_IE7;function createPngElement(src){var img=document.createElement('img');img.setAttribute('src',src);if(IS_IE&&IS_LT_IE7){img.style.visibility='hidden';var div=document.createElement('div');div.appendChild(img);div.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+src+'\',sizingMethod=\'crop\')';return div;}
return img;}
