Cwo.RegisterNamespace("Cwo.Maps.Mini");Cwo.Maps.Mini=function(j,x,o,a,v,p,l,s,i){var n=this,e=null,w=null,d=j,k=x,t=o,r=a,m=v,u=p,b=l,g=$("#"+k),q=$("#"+u),c=$("#"+b),y="Selected",h=i,f=$("#BingMapKey").val();this.LoadMap=function(){if(w===null){w=new Cwo.MapProvider(f)}e=w.RenderMap(document.getElementById(m),{centerLat:t,centerLong:r,zoom:12});n.MapLoaded();if(Cwo.Common.GetCookie("PropertyWideMapToken")!==""){e.SetClientToken(Cwo.Common.GetCookie("PropertyWideMapToken"))}};this.MapLoaded=function(){e.AddMarker(t,r,{icon:"",typeName:"mapPoint",width:19,height:21})};this.ClickButton=function(){if(g.hasClass(y)){n.HideMap()}else{n.ShowMap()}};this.ShowMap=function(){n.RegisterRoofTopLatLongUseage();$("#"+d+" ul."+y+" li.ShowMiniMap span a").each(function(z){$(this).text("Show Mini Map")});$("#"+d+" ul."+y).each(function(z){$(this).removeClass(y)});g.addClass(y);if($("#"+u).text()==="Show Mini Map"){$("#"+u).text("Hide Mini Map")}if(!Cwo.Maps.IsScriptLoaded()){Cwo.Page.EventController.Subscribe("Maps.BingScriptLoaded",n.LoadMap)}else{n.LoadMap()}};this.HideMap=function(){g.removeClass(y);if($("#"+u).text()==="Hide Mini Map"){q.text("Show Mini Map")}};this.RegisterRoofTopLatLongUseage=function(){Cwo.AjaxCall("/webservices/Map.asmx/RegisterRooftopLatLongUseage",'{"hasRoofTopLatLongs":'+h+"}",function(){},null,true)};q.bind("click",function(z){z.preventDefault();n.ClickButton()});c.bind("click",function(z){z.preventDefault();n.HideMap()})};
