var map,street,boundaries,placesArray=[],place,places,marker,markers,mClu;var markersArray=[];var infowindow;CustomMapControl.prototype.currentStreetState_=null;CustomMapControl.prototype.currentPlacesState_=null;CustomMapControl.prototype.currentPoligonState_=null;CustomMapControl.prototype.hideStreet=function(map,street){street.setMap(null);this.currentStreetState_=false};CustomMapControl.prototype.showStreet=function(map,street){street.setMap(map);this.currentStreetState_=true};CustomMapControl.prototype.getStreetState=function(){return this.currentStreetState_};CustomMapControl.prototype.getStreetStateText=function(){if(this.getStreetState()){return'Скрыть улицы'}else{return'Показать улицы'}};CustomMapControl.prototype.getStreetStateTip=function(){if(this.getStreetState()){return'Скрыть названия улиц'}else{return'Показать названия улиц'}};CustomMapControl.prototype.hidePlaces=function(map){if(placesArray){for(i in placesArray){placesArray[i].setMap(null)};placesArray.length=0};this.currentPlacesState_=false};CustomMapControl.prototype.showPlaces=function(map,placesPoint){setPlaces(map);this.currentPlacesState_=true};CustomMapControl.prototype.getPlacesState=function(){return this.currentPlacesState_};CustomMapControl.prototype.getPlacesStateText=function(){if(this.getPlacesState()){return'Скрыть инфраструктуру'}else{return'Показать инфраструктуру'}};CustomMapControl.prototype.getPlacesStateTip=function(){if(this.getPlacesState()){return'Убрать с карты магазины, кафе, остановки, аптеки, обменники и другое'}else{return'Показать на карте магазины, кафе, остановки, аптеки, обменники и другое'}};CustomMapControl.prototype.showMarker=function(map){setMarker(map);this.currentPoligonState_=false};CustomMapControl.prototype.showPoligon=function(map){setPoligon(map);this.currentPoligonState_=true};CustomMapControl.prototype.getPoligonState=function(){return this.currentPoligonState_};CustomMapControl.prototype.getPoligonStateText=function(){if(this.getPoligonState()){return'Показать метки квартир'}else{return'Показать территорию квартир'}};CustomMapControl.prototype.getPoligonStateTip=function(){if(this.getPoligonState()){return'Вместо очертаний квартир будут значки, рекомендуется для iPad, планшетов и смартфонов'}else{return'Вместо значков будет отмечена территория квартир, рекомендуется для мощных компьютеров и быстрого интернета'}};function CustomMapControl(controlDiv,map,currentStreetState,currentPlacesState,currentPoligonState){var control=this;control.currentStreetState_=currentStreetState;control.currentPlacesState_=currentPlacesState;control.currentPoligonState_=currentPoligonState;controlDiv.style.padding='5px 0px';var switchStreetUI=document.createElement('DIV');switchStreetUI.style.backgroundColor='white';switchStreetUI.style.color='black';switchStreetUI.style.borderStyle='solid';switchStreetUI.style.borderWidth='1px';switchStreetUI.style.padding='2px 4px 1px';switchStreetUI.style.cursor='pointer';switchStreetUI.style.textAlign='center';switchStreetUI.title=control.getStreetStateTip();switchStreetUI.innerHTML=control.getStreetStateText();switchStreetUI.style.cssFloat='right';controlDiv.appendChild(switchStreetUI);var boundaries=new google.maps.LatLngBounds(new google.maps.LatLng(MAP_STREET_NW),new google.maps.LatLng(MAP_STREET_SE));var street=new google.maps.GroundOverlay("MAP_STREET_IMG",boundaries);google.maps.event.addDomListener(switchStreetUI,'click',function(){if(control.getStreetState()){control.hideStreet(map,street);switchStreetUI.title=control.getStreetStateTip();switchStreetUI.innerHTML=control.getStreetStateText()}else{control.showStreet(map,street);switchStreetUI.title=control.getStreetStateTip();switchStreetUI.innerHTML=control.getStreetStateText()}});var switchPlacesUI=document.createElement('DIV');switchPlacesUI.style.backgroundColor='white';switchPlacesUI.style.color='black';switchPlacesUI.style.borderStyle='solid';switchPlacesUI.style.borderWidth='1px';switchPlacesUI.style.padding='2px 4px 1px';switchPlacesUI.style.cursor='pointer';switchPlacesUI.style.textAlign='center';switchPlacesUI.title=control.getPlacesStateTip();switchPlacesUI.innerHTML=control.getPlacesStateText();switchPlacesUI.style.cssFloat='right';controlDiv.appendChild(switchPlacesUI);google.maps.event.addDomListener(switchPlacesUI,'click',function(){if(control.getPlacesState()){control.hidePlaces(map);switchPlacesUI.title=control.getPlacesStateTip();switchPlacesUI.innerHTML=control.getPlacesStateText()}else{document.getElementById('loadingstate').style.display='block';control.showPlaces(map);switchPlacesUI.title=control.getPlacesStateTip();switchPlacesUI.innerHTML=control.getPlacesStateText()}});var switchPoligonUI=document.createElement('DIV');switchPoligonUI.style.backgroundColor='white';switchPoligonUI.style.color='black';switchPoligonUI.style.borderStyle='solid';switchPoligonUI.style.borderWidth='1px';switchPoligonUI.style.padding='2px 4px 1px';switchPoligonUI.style.cursor='pointer';switchPoligonUI.style.textAlign='center';switchPoligonUI.title=control.getPoligonStateTip();switchPoligonUI.innerHTML=control.getPoligonStateText();switchPoligonUI.style.cssFloat='right';controlDiv.appendChild(switchPoligonUI);google.maps.event.addDomListener(switchPoligonUI,'click',function(){document.getElementById('loadingstate').style.display='block';if(control.getPoligonState()){control.showMarker(map);switchPoligonUI.title=control.getPoligonStateTip();switchPoligonUI.innerHTML=control.getPoligonStateText()}else{control.showPoligon(map);switchPoligonUI.title=control.getPoligonStateTip();switchPoligonUI.innerHTML=control.getPoligonStateText()}});var loading=document.createElement('DIV');loading.style.backgroundColor='#fffcd5';loading.style.color='black';loading.style.borderStyle='solid';loading.style.borderWidth='1px';loading.style.padding='4px';loading.style.clear='both';loading.style.display='none';loading.style.zIndex='10';loading.id='loadingstate';loading.style.textAlign='center';loading.innerHTML=' Подождите, идет загрузка..';controlDiv.appendChild(loading)};$(document).ready(function(){var centerLatlng=new google.maps.LatLng(38.935957,33.170645);var mapOptions={zoom:6,center:centerLatlng,scrollwheel:false,panControl:false,streetViewControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP};var map=new google.maps.Map(document.getElementById("map"),mapOptions);var mapControlDiv=document.createElement('DIV');var customControl=new CustomMapControl(mapControlDiv,map,false,false,true);mapControlDiv.index=1;map.controls[google.maps.ControlPosition.TOP_RIGHT].push(mapControlDiv);var createMclu=new MarkerClusterer(map,[],{gridSize:30});mClu=createMclu;if(customControl.getPoligonState()){setPoligon(map)}else{setMarker(map)}});function setPlaces(map){$.get("/lib/getPlaces.php",function(data){var places=data.documentElement.getElementsByTagName("marker");for(var i=0;i'+o.getAttribute("tip")+o.getAttribute("price")+''});infowindow.open(map,marker)});markersArray.push(marker);return marker};function setPoligon(map){if(markersArray){for(i in markersArray){markersArray[i].setMap(null)};markersArray.length=0};$.get("/lib/getMarker.php?d=search&action=map&month=jul&&&pool=&cond=&food=&inet=&park=&kyxn=&cafe=&tele=&frez=&sort=&price1=&price2=&&",function(data){var markers=data.documentElement.getElementsByTagName("marker");for(var i=0;imaxw){tt.style.width=maxw+'px'}h=parseInt(tt.offsetHeight)+top},pos:function(e){var u=ie?event.clientY+document.documentElement.scrollTop:e.pageY;var l=ie?event.clientX+document.documentElement.scrollLeft:e.pageX;tt.style.top=(u-h)+'px';tt.style.left=(l+left)+'px'},hide:function(){tt.style.display='none'}}}();