function InfoBox(n){n=n||{};google.maps.OverlayView.apply(this,arguments);this.content_=n.content||"";this.disableAutoPan_=n.disableAutoPan||!1;this.maxWidth_=n.maxWidth||0;this.pixelOffset_=n.pixelOffset||new google.maps.Size(0,0);this.position_=n.position||new google.maps.LatLng(0,0);this.zIndex_=n.zIndex||null;this.boxClass_=n.boxClass||"infoBox";this.boxStyle_=n.boxStyle||{};this.closeBoxMargin_=n.closeBoxMargin||"2px";this.closeBoxURL_=n.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif";n.closeBoxURL===""&&(this.closeBoxURL_="");this.infoBoxClearance_=n.infoBoxClearance||new google.maps.Size(1,1);this.isHidden_=n.isHidden||!1;this.alignBottom_=n.alignBottom||!1;this.pane_=n.pane||"floatPane";this.enableEventPropagation_=n.enableEventPropagation||!1;this.div_=null;this.closeListener_=null;this.moveListener_=null;this.contextListener_=null;this.eventListeners_=null;this.fixedWidthSet_=null}InfoBox.prototype=new google.maps.OverlayView;InfoBox.prototype.createInfoBoxDiv_=function(){var n,t,i,u=this,r=function(n){n.cancelBubble=!0;n.stopPropagation&&n.stopPropagation()},f=function(n){n.returnValue=!1;n.preventDefault&&n.preventDefault();u.enableEventPropagation_||r(n)};if(!this.div_){if(this.div_=document.createElement("div"),this.setBoxStyle_(),typeof this.content_.nodeType=="undefined"?this.div_.innerHTML=this.getCloseBoxImg_()+this.content_:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(this.content_)),this.getPanes()[this.pane_].appendChild(this.div_),this.addClickHandler_(),this.div_.style.width?this.fixedWidthSet_=!0:this.maxWidth_!==0&&this.div_.offsetWidth>this.maxWidth_?(this.div_.style.width=this.maxWidth_,this.div_.style.overflow="auto",this.fixedWidthSet_=!0):(i=this.getBoxWidths_(),this.div_.style.width=this.div_.offsetWidth-i.left-i.right+"px",this.fixedWidthSet_=!1),this.panBox_(this.disableAutoPan_),!this.enableEventPropagation_){for(this.eventListeners_=[],t=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],n=0;n<t.length;n++)this.eventListeners_.push(google.maps.event.addDomListener(this.div_,t[n],r));this.eventListeners_.push(google.maps.event.addDomListener(this.div_,"mouseover",function(){this.style.cursor="default"}))}this.contextListener_=google.maps.event.addDomListener(this.div_,"contextmenu",f);google.maps.event.trigger(this,"domready")}};InfoBox.prototype.getCloseBoxImg_=function(){var n="";return this.closeBoxURL_!==""&&(n="<img",n+=" src='"+this.closeBoxURL_+"'",n+=" align=right",n+=" style='",n+=" position: relative;",n+=" cursor: pointer;",n+=" margin: "+this.closeBoxMargin_+";",n+="'>"),n};InfoBox.prototype.addClickHandler_=function(){var n;this.closeBoxURL_!==""?(n=this.div_.firstChild,this.closeListener_=google.maps.event.addDomListener(n,"click",this.getCloseClickHandler_())):this.closeListener_=null};InfoBox.prototype.getCloseClickHandler_=function(){var n=this;return function(t){t.cancelBubble=!0;t.stopPropagation&&t.stopPropagation();google.maps.event.trigger(n,"closeclick");n.close()}};InfoBox.prototype.panBox_=function(n){var i,y,e=0,f=0,p;if(!n&&(i=this.getMap(),i instanceof google.maps.Map)){i.getBounds().contains(this.position_)||i.setCenter(this.position_);y=i.getBounds();var l=i.getDiv(),a=l.offsetWidth,o=l.offsetHeight,s=this.pixelOffset_.width,r=this.pixelOffset_.height,v=this.div_.offsetWidth,h=this.div_.offsetHeight,c=this.infoBoxClearance_.width,u=this.infoBoxClearance_.height,t=this.getProjection().fromLatLngToContainerPixel(this.position_);t.x<-s+c?e=t.x+s-c:t.x+v+s+c>a&&(e=t.x+v+s+c-a);this.alignBottom_?t.y<-r+u+h?f=t.y+r-u-h:t.y+r+u>o&&(f=t.y+r+u-o):t.y<-r+u?f=t.y+r-u:t.y+h+r+u>o&&(f=t.y+h+r+u-o);e===0&&f===0||(p=i.getCenter(),i.panBy(e,f))}};InfoBox.prototype.setBoxStyle_=function(){var n,t;if(this.div_){this.div_.className=this.boxClass_;this.div_.style.cssText="";t=this.boxStyle_;for(n in t)t.hasOwnProperty(n)&&(this.div_.style[n]=t[n]);typeof this.div_.style.opacity!="undefined"&&this.div_.style.opacity!==""&&(this.div_.style.filter="alpha(opacity="+this.div_.style.opacity*100+")");this.div_.style.position="absolute";this.div_.style.visibility="hidden";this.zIndex_!==null&&(this.div_.style.zIndex=this.zIndex_)}};InfoBox.prototype.getBoxWidths_=function(){var i,n={top:0,bottom:0,left:0,right:0},t=this.div_;return document.defaultView&&document.defaultView.getComputedStyle?(i=t.ownerDocument.defaultView.getComputedStyle(t,""),i&&(n.top=parseInt(i.borderTopWidth,10)||0,n.bottom=parseInt(i.borderBottomWidth,10)||0,n.left=parseInt(i.borderLeftWidth,10)||0,n.right=parseInt(i.borderRightWidth,10)||0)):document.documentElement.currentStyle&&t.currentStyle&&(n.top=parseInt(t.currentStyle.borderTopWidth,10)||0,n.bottom=parseInt(t.currentStyle.borderBottomWidth,10)||0,n.left=parseInt(t.currentStyle.borderLeftWidth,10)||0,n.right=parseInt(t.currentStyle.borderRightWidth,10)||0),n};InfoBox.prototype.onRemove=function(){this.div_&&(this.div_.parentNode.removeChild(this.div_),this.div_=null)};InfoBox.prototype.draw=function(){this.createInfoBoxDiv_();var n=this.getProjection().fromLatLngToDivPixel(this.position_);this.div_.style.left=n.x+this.pixelOffset_.width+"px";this.alignBottom_?this.div_.style.bottom=-(n.y+this.pixelOffset_.height)+"px":this.div_.style.top=n.y+this.pixelOffset_.height+"px";this.div_.style.visibility=this.isHidden_?"hidden":"visible"};InfoBox.prototype.setOptions=function(n){typeof n.boxClass!="undefined"&&(this.boxClass_=n.boxClass,this.setBoxStyle_());typeof n.boxStyle!="undefined"&&(this.boxStyle_=n.boxStyle,this.setBoxStyle_());typeof n.content!="undefined"&&this.setContent(n.content);typeof n.disableAutoPan!="undefined"&&(this.disableAutoPan_=n.disableAutoPan);typeof n.maxWidth!="undefined"&&(this.maxWidth_=n.maxWidth);typeof n.pixelOffset!="undefined"&&(this.pixelOffset_=n.pixelOffset);typeof n.alignBottom!="undefined"&&(this.alignBottom_=n.alignBottom);typeof n.position!="undefined"&&this.setPosition(n.position);typeof n.zIndex!="undefined"&&this.setZIndex(n.zIndex);typeof n.closeBoxMargin!="undefined"&&(this.closeBoxMargin_=n.closeBoxMargin);typeof n.closeBoxURL!="undefined"&&(this.closeBoxURL_=n.closeBoxURL);typeof n.infoBoxClearance!="undefined"&&(this.infoBoxClearance_=n.infoBoxClearance);typeof n.isHidden!="undefined"&&(this.isHidden_=n.isHidden);typeof n.enableEventPropagation!="undefined"&&(this.enableEventPropagation_=n.enableEventPropagation);this.div_&&this.draw()};InfoBox.prototype.setContent=function(n){this.content_=n;this.div_&&(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.fixedWidthSet_||(this.div_.style.width=""),typeof n.nodeType=="undefined"?this.div_.innerHTML=this.getCloseBoxImg_()+n:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(n)),this.fixedWidthSet_||(this.div_.style.width=this.div_.offsetWidth+"px",typeof n.nodeType=="undefined"?this.div_.innerHTML=this.getCloseBoxImg_()+n:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(n))),this.addClickHandler_());google.maps.event.trigger(this,"content_changed")};InfoBox.prototype.setPosition=function(n){this.position_=n;this.div_&&this.draw();google.maps.event.trigger(this,"position_changed")};InfoBox.prototype.setZIndex=function(n){this.zIndex_=n;this.div_&&(this.div_.style.zIndex=n);google.maps.event.trigger(this,"zindex_changed")};InfoBox.prototype.getContent=function(){return this.content_};InfoBox.prototype.getPosition=function(){return this.position_};InfoBox.prototype.getZIndex=function(){return this.zIndex_};InfoBox.prototype.show=function(){this.isHidden_=!1;this.div_&&(this.div_.style.visibility="visible")};InfoBox.prototype.hide=function(){this.isHidden_=!0;this.div_&&(this.div_.style.visibility="hidden")};InfoBox.prototype.open=function(n,t){var i=this;t&&(this.position_=t.getPosition(),this.moveListener_=google.maps.event.addListener(t,"position_changed",function(){i.setPosition(this.getPosition())}));this.setMap(n);this.div_&&this.panBox_()};InfoBox.prototype.close=function(){var n;if(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.eventListeners_){for(n=0;n<this.eventListeners_.length;n++)google.maps.event.removeListener(this.eventListeners_[n]);this.eventListeners_=null}this.moveListener_&&(google.maps.event.removeListener(this.moveListener_),this.moveListener_=null);this.contextListener_&&(google.maps.event.removeListener(this.contextListener_),this.contextListener_=null);this.setMap(null)};var PartnerMap={init:function(n){var r=this,t,u=function(){$.ajax({type:"POST",url:n.DataEndpoint+"/MapDefaultLocation/"+n.MapId,dataType:"json",contentType:"application/json; charset=utf-8",success:function(i){t=new google.maps.Map(n.Element,{zoom:10,center:{lat:i.Lat,lng:i.Lon},gestureHandling:"greedy",streetViewControl:!1});f()},error:function(){}})},f=function(){$.ajax({type:"POST",url:n.DataEndpoint+"/PartnerData/"+n.MapId,dataType:"json",contentType:"application/json; charset=utf-8",success:function(n){n.forEach(o)},error:function(){}})};this.markerSettings={Good:{markerImage:"/images/keg36_green.png",fontColor:"#000000",zIndex:2}};var i=new google.maps.InfoWindow,e=_.template('<table class="partnerMapTable">\n'+"\t<% _.forEach(obj, function(partner) { %>\n"+'\t<tr>\n\t\t<td rowspan="2">\n'+'\t\t\t<img style="height: 23px;float: left;width: auto;margin-right: 5px;margin-top: 4px;" src="<%=PartnerMap.markerSettings[\'Good\'].markerImage %>" />\n'+"\t\t<\/td>\n"+'\t\t<td colspan="2"><b><%- partner.FullName %><\/b><\/td>\n'+"\t<\/tr>\n\t<tr>\n"+"\t\t<td><%- partner.Address %> <\/td>\n"+"\t\t<td>Phone: <%- partner.Phone %> <\/td>\n"+"\t<\/tr>\n"+"\t<% }) %>\n"+"<\/table>"),o=function(n){var u=r.markerSettings.Good,f=document.createElement("div"),o,s;f.style.cssText="margin-top: 0px; padding-top: 10px; height: 36px; width: 30px; text-align: center; vertical-align: middle;z-index:"+u.zIndex+";";f.innerHTML="<b><\/b>";o=new InfoBox({content:f,boxStyle:{textAlign:"center",background:"url('"+u.markerImage+"') no-repeat",color:u.fontColor,fontWeight:"bold",opacity:.75,width:"30px",height:"36px"},disableAutoPan:!0,pixelOffset:new google.maps.Size(-15,-18),position:new google.maps.LatLng(n.Lat,n.Lon),closeBoxURL:"",isHidden:!1,pane:"overlayMouseTarget",clickable:!0,enableEventPropagation:!0,zIndex:u.zIndex});o.open(t);s=this;google.maps.event.addDomListener(f,"click",function(){i.setContent(e(n.Partners));i.open(t,o)})};u()}}