// places handler function NewPlaces(mapi) { var objplaces = new Object(); objplaces.displayplaces = true; objplaces.lastzoom = -1; objplaces.mapi = mapi; objplaces.places = new Array(); objplaces.info = null; objplaces.showPlaces = function() { this.displayplaces = true; this.recheckLevels(); } objplaces.hidePlaces = function() { this.displayplaces = false; this.recheckLevels(); } objplaces.flipPlaces = function() { if (this.displayplaces) { this.hidePlaces(); } else { this.showPlaces(); } } objplaces.createPlaceItem = function(item) { p = new Array(); p.data = item; p.data.pos = new google.maps.LatLng(p.data.gpslat, p.data.gpslng); p.marker = this.mapi.markers.markers[this.mapi.markers.CreatePlaceMarker(this, p.data)]; //this.mapi.gmap.addOverlay(p.marker); p.marker.setMap(this.mapi.gmap); if ((this.lastzoom < p.data.fromzoom) || (!this.displayplaces)) { p.marker.setVisible(false); //p.marker.hide(); } return p; } objplaces.destroyPlaceItem = function(item) { //this.mapi.gmap.removeOverlay(item.marker); item.marker.setMap(null); } objplaces.refreshPlacesFromArray = function(places) { tmpplaces = new Array(); for (ti = 0; ti < places.length; ti++) { tmpplaces[ti] = this.createPlaceItem(places[ti]); } for (ti = 0; ti < this.places.length; ti++) { this.destroyPlaceItem(this.places[ti]); } this.places = tmpplaces; } objplaces.reqLoadPlacesError = function() { } objplaces.reqLoadPlacesComplete = function() { } objplaces.reqLoadPlacesSuccess = function(data) { if (!data.error) { this.refreshPlacesFromArray(data.places); } else alert(data.errordesc); } objplaces.loadPlaces = function() { var url = 'http://www.kamennimuzici.cz/mapa/places.php'; var params = {op:'getplaces', area:'all'}; jQuery.ajax({cache:false, context:this, data:params, dataType:'json', error:this.reqLoadPlacesError, success:this.reqLoadPlacesSuccess, complete:this.reqLoadPlacesComplete, url:url, type:'POST'}); } objplaces.reloadPlaces = function() { } objplaces.recheckLevels = function() { if (this.places.length) { for (ti = 0; ti < this.places.length; ti++) { if ((this.places[ti].data.fromzoom <= this.lastzoom) && (this.displayplaces)) { //this.places[ti].marker.show(); this.places[ti].marker.setVisible(true); } else { //this.places[ti].marker.hide(); this.places[ti].marker.setVisible(false); } } } } objplaces.reloadTimerCallback = (function(obj, meth) { return function () { meth.call(obj); } })(objplaces, objplaces.reloadPlaces); objplaces.setReloadTimeout = function(what) { if (what == 'zoom') { intr = 1000; } else { intr = 500; } if (this.reloadtimer != null) { clearTimeout(this.reloadtimer); } callback = function (obj, meth) { f = function () { } f.obj = obj; f.meth = meth; return f; } this.reloadtimer = setTimeout(objplaces.reloadTimerCallback, intr); } objplaces.onMapChange = function() { zoom = this.mapi.gmap.getZoom() if (this.lastzoom != zoom) { this.lastzoom = zoom; this.recheckLevels(); this.setReloadTimeout('zoom'); } else { this.setReloadTimeout('pos'); } } objplaces.onResultMouseOver = function(item) { this.mapi.markers.markers[item.idmarker].setIcon(icourls.placeSel); this.showInfo(item); } objplaces.onResultMouseOut = function(item) { this.mapi.markers.markers[item.idmarker].setIcon(icourls.place); this.clearInfos(); } objplaces.onResultClick = function(item) { this.openPlaceDetail(this.mapi.markers.markers[item.idmarker].idplace); } objplaces.openPlaceDetail = function(id) { this.loadDetail(id); } objplaces.reqLoadDetailError = function() { } objplaces.reqLoadDetailComplete = function() { } objplaces.reqLoadDetailSuccess = function(data) { if (!data.error) { this.displayDetail(data); } else alert(data.errordesc); } objplaces.loadDetail = function(id) { var url = 'http://www.kamennimuzici.cz/mapa/places.php'; var params = {op:'getdetail', id:id}; jQuery.ajax({cache:false, context:this, data:params, dataType:'json', error:this.reqLoadDetailError, success:this.reqLoadDetailSuccess, complete:this.reqLoadDetailComplete, url:url, type:'POST'}); } objplaces.displayDetail = function(data) { //iw = this.mapi.gmap.getInfoWindow(); label = data.detail.name; cont = '