// tooltip function ToolTip() { this.container = false; this.map = false; this.marker = false; } ToolTip.prototype = new GOverlay(); ToolTip.prototype.initialize = function(map) { this.map = map; this.container = document.createElement("div"); this.container.id = 'gm-tooltip'; this.map.getPane(G_MAP_FLOAT_PANE).appendChild(this.container); } ToolTip.prototype.show = function(marker, content) { if (!this.map) { map.addOverlay(this); } this.marker = marker; this.container.innerHTML = content; this.redraw(true); } ToolTip.prototype.remove = function() { if (this.container && this.container.parentNode) { this.container.style.display = 'none'; } } ToolTip.prototype.copy = function() { return new ToolTip(this.marker); } ToolTip.prototype.redraw = function(force) { if (!force || !this.marker || !this.map) { return; } var c = this.map.fromLatLngToDivPixel(this.marker.getLatLng()); this.container.style.left = (c.x + this.marker.x_offset) + "px"; this.container.style.top = (c.y + this.marker.y_offset) + "px"; this.container.style.display = 'block'; } // details function Details() { this.container = false; this.map = false; this.marker = false; this.wWidth = 0; this.wHeight = 0; } Details.prototype = new GOverlay(); Details.prototype.initialize = function(map) { this.map = map; this.container = document.createElement("div"); this.container.id = 'gm-detailwindow'; this.contentContainer = document.createElement("div"); this.contentContainer.className = 'content'; this.container.appendChild(this.contentContainer); this.map.getPane(G_MAP_FLOAT_PANE).appendChild(this.container); this.wWidth = parseInt(this.container.offsetWidth); this.wHeight = parseInt(this.container.offsetHeight); addEvent(this.container, "click", function(){ mapDetails.remove(); }); GEvent.addListener(this, 'closeclick', function() { }); } Details.prototype.wait = function(marker, html) { this.marker = marker; mouseIn = html; //console.log(mouseIn); function f() { details.show(marker, html); } f.delay(700); } Details.prototype.out = function(marker, html) { //console.log('out'); mouseIn = ''; } Details.prototype.show = function(marker, html) { if (mouseIn == html) { this.marker = marker; this.remove(); var url = '/modules/search/ajax/map/click.php?'; url += 'o=' + html; var jsonRequest = new Request.JSON({url: url, method: 'get', onComplete: function(data) { if (!details.map) { map.addOverlay(details); } details.contentContainer.innerHTML = data.html; details.redraw(true, details.marker); } }).send(); } } Details.prototype.remove = function() { if (this.container && this.container.parentNode) { this.container.style.display = 'none'; } } Details.prototype.copy = function() { return new Details(); } Details.prototype.redraw = function(force, marker) { if (!force || !marker || !this.map) { return; } var c = this.map.fromLatLngToDivPixel(marker.getLatLng()); var ne = this.map.fromLatLngToDivPixel(this.map.getBounds().getNorthEast()); var sw = this.map.fromLatLngToDivPixel(this.map.getBounds().getSouthWest()); this.container.style.left = (c.x - 74) + "px"; this.container.style.top = ((c.y - this.wHeight) + 8) + "px"; this.container.style.display = 'block'; var yTopSpace = ((this.wHeight + 30) - (c.y - ne.y)); var xRightSpace = ((this.wWidth - 74) - (ne.x - c.x)); var xLeftSpace = (c.x - sw.x); var xSpace = 0; var ySpace = 0; if (xRightSpace > 0 && xRightSpace > 40) { xSpace = (xRightSpace * -1); } if (xLeftSpace < 100) { xSpace = xLeftSpace; } if (yTopSpace > 0) { ySpace = yTopSpace; } if (ySpace != 0 || xSpace != 0) { this.map.panBy(new GSize(xSpace, ySpace)); flagNoRemoveDetails = 1; } } // controls function MapTypeControl() {} MapTypeControl.prototype = new GControl(); MapTypeControl.prototype.initialize = function() { var container = document.createElement("div"); container.id = 'gm-type'; for (var i = 0; i < mapTypeInfo.length; i++) { var aEle = document.createElement("a"); aEle.id = 'gm-type-options-'+mapTypeInfo[i].id; aEle.innerHTML = mapTypeInfo[i].title; aEle.href = 'javascript: mapTypeControl.typeSelect(' + i + ');'; container.appendChild(aEle); } map.getContainer().appendChild(container); this.typeSelect(0); return container; } MapTypeControl.prototype.typeSelect = function(optionsIndex) { for (var i = 0; i < mapTypeInfo.length; i++) { if (i == optionsIndex) { map.setMapType(mapTypeInfo[i].type); document.getElementById('gm-type-options-' + mapTypeInfo[i].id).className = 'selected'; } else { document.getElementById('gm-type-options-' + mapTypeInfo[i].id).className = ''; } } } MapTypeControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)); }