// appellation regions var controlText ; function CoordMapType(tileSize) { this.tileSize = tileSize; } CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) { var div = ownerDocument.createElement('DIV'); div.innerHTML = coord + " " + zoom; div.style.width = this.tileSize.width + 'px'; div.style.height = this.tileSize.height + 'px'; div.style.fontSize = '10'; div.style.borderStyle = 'solid'; div.style.borderWidth = '1px'; div.style.borderColor = '#AA0000'; return div; }; var WineOptions = { getTileUrl: function(coord, zoom) { return "http://static.gaultmillau.fr/images/maptiles/" + zoom + "_" + coord.x + "_" + coord.y + ".png"; }, tileSize: new google.maps.Size(256, 256), isPng: true }; var WineMapType=null; function showHideAppellationTiles(map){ if(WineMapType==null){ WineMapType= new google.maps.ImageMapType(WineOptions); map.overlayMapTypes.insertAt(0, WineMapType); if(controlText!=null){controlText.style.fontWeight = 'bold';} }else{ map.overlayMapTypes.removeAt(0); WineMapType=null; if(controlText!=null){controlText.style.fontWeight = 'normal';} } } function AppellationControl(pdocument, map) { var appellationControlDiv = pdocument.createElement('DIV'); // Set CSS styles for the DIV containing the control // Setting padding to 5 px will offset the control // from the edge of the map appellationControlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = pdocument.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Appellations'; appellationControlDiv.appendChild(controlUI); // Set CSS for the control interior controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '12px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Appellations'; controlUI.appendChild(controlText); // Setup the click event listeners: simply set the map to // Chicago google.maps.event.addDomListener(controlUI, 'click', function() { showHideAppellationTiles(map); }); appellationControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(appellationControlDiv); showHideAppellationTiles(map); }