function reloadLabelRegionAppellation(){ var myregionname=''; var myappellationname=''; var labelval=''; var myregionid=document.getElementById('region_id').value; var myappellationid=document.getElementById('appellation_id').value; var amyregion=document.getElementById('a_region_id_'+myregionid); var amyappellation=document.getElementById('a_appellation_id_'+myappellationid); if(amyregion!=null){ myregionname=amyregion.innerHTML; if(amyappellation!=null){ myappellationname=amyappellation.innerHTML; } } if(myregionname!=null && myregionname != ''){ labelval=myregionname; if(myappellationname!=null && myappellationname != ''){ labelval=labelval+' / '+myappellationname; } }else{ labelval='Région / Appellation'; } $('#region_appellation').html(labelval); } function selectAppellation(regionname,apid,apname){ document.getElementById('appellation_id').value=apid; document.getElementById('region_appellation').innerHTML=regionname+' / '+apname; $('#unselect_appellation').show(); $('#appsul > li').removeClass('active'); $('#appellation_id_'+apid).addClass('active'); } function changeShowMoreOptions(winerestauranthotel){ var elid= 'showmoreoptions'+winerestauranthotel; var val =document.getElementById(elid); if(val!=null && val !=''){ if(val=='true'){ document.getElementById(elid).value='false'; }else{ document.getElementById(elid).value='true'; } }else{ document.getElementById(elid).value='true'; } } function getIconStripe(type,char){ return new google.maps.MarkerImage(('http://static.gaultmillau.fr/images/icons/icon-'+type+'-'+char+'-stripe.png'),new google.maps.Size(35,50),new google.maps.Point(0,0),new google.maps.Point(23,48)); } var hotel_icon = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-hotel.png',new google.maps.Size(35,40)); var hotel_resto_icon = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-hotel-resto.png', new google.maps.Size(35,40)); var resto_icon = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-resto.png',new google.maps.Size(35,40)); var estate_icon = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-vin.png',new google.maps.Size(35,40)); var hotel_icon_big = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-hotel-big.png',new google.maps.Size(35,40)); var hotel_resto_icon_big = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-hotel-resto-big.png', new google.maps.Size(35,40)); var resto_icon_big = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-resto-big.png',new google.maps.Size(35,40)); var estate_icon_big = new google.maps.MarkerImage('http://static.gaultmillau.fr/images/icons/icon-vin-big.png',new google.maps.Size(35,40)); var currentballoon = null; /* * offsetVertical, offsetHorizontal, className, height, width */ function InfoBox(opts) { //nooit meer dan 1 balloon tonen if(currentballoon !=null){ currentballoon.setMap(null); } google.maps.OverlayView.call(this); this.latlng_ = opts.marker.getPosition(); this.ycorrection = opts.ycorrection; this.map_ = opts.map; this.type=opts.type; this.offsetVertical_ = getOffsetVertical(this.type); //this.offsetVertical_ = -600; this.offsetHorizontal_ = -6; this.width_ = 266; this.html=opts.html; var me = this; // Once the properties of this OverlayView are initialized, set its map so // that we can display it. This will trigger calls to panes_changed and // draw. currentballoon=this; this.setMap(this.map_); } /* InfoBox extends GOverlay class from the Google Maps API */ InfoBox.prototype = new google.maps.OverlayView(); /* Creates the DIV representing this InfoBox */ InfoBox.prototype.remove = function() { if (this.div_) { this.div_.parentNode.removeChild(this.div_); this.div_ = null; } if (this.stemel_) { this.stemel_.parentNode.removeChild(this.stemel_); this.stemel_ = null; } }; /* Redraw the Bar based on the current projection and zoom level */ InfoBox.prototype.draw = function() { // Creates the element if it doesn't exist already. this.createElement(); if (!this.div_) return; // Calculate the DIV coordinates of two opposite corners of our bounds to // get the size and position of our Bar var pixPosition = this.getProjection().fromLatLngToDivPixel(this.latlng_); if (!pixPosition) return; // Now position our DIV based on the DIV coordinates of our bounds this.div_.style.width = this.width_ + "px"; this.div_.style.left = (pixPosition.x + this.offsetHorizontal_ - this.width_/2) + "px"; this.div_.style.height = getBoxHeight(this.type); this.div_.style.top = (pixPosition.y + this.offsetVertical_ - this.ycorrection) + "px"; this.div_.style.display = 'block'; this.stemel_.style.width = this.width_ + "px"; this.stemel_.style.height = "24px"; this.stemel_.style.left = (pixPosition.x + this.offsetHorizontal_ - this.width_/2) + "px"; this.stemel_.style.top = (pixPosition.y - 40) + "px"; this.div_.style.display = 'block'; }; /* Creates the DIV representing this InfoBox in the floatPane. If the panes * object, retrieved by calling getPanes, is null, remove the element from the * DOM. If the div exists, but its parent is not the floatPane, move the div * to the new pane. * Called from within draw. Alternatively, this can be called specifically on * a panes_changed event. */ InfoBox.prototype.createElement = function() { var panes = this.getPanes(); var div = this.div_; if (!div) { // This does not handle changing panes. You can set the map to be null and // then reset the map to move the div. div = this.div_ = document.createElement("div"); div.style.position = "absolute"; div.className='mapinfo-box'+getClassName(this.type); div.style.background = "white"; div.style.width = this.width_ + "px"; div.style.height = getBoxHeight(this.type); var contentDiv = document.createElement("div"); contentDiv.style.padding = "0px" contentDiv.innerHTML = this.html; var closeel=document.createElement("div"); closeel.className="btn-holder"; closeel.innerHTML='[X]'; function removeInfoBox(ib) { return function() { ib.setMap(null); }; } var stemel = this.stemel_; if(!stemel){ stemel = this.stemel_ =document.createElement("div"); stemel.style.width="24px"; stemel.style.height="24px"; stemel.style.marginLeft=((this.width_/2)-12)+'px'; stemel.style.position = "absolute"; stemel.innerHTML=''; } google.maps.event.addDomListener(closeel, 'click', removeInfoBox(this)); google.maps.event.addDomListener(this.map_, 'click', removeInfoBox(this)); div.appendChild(closeel); div.appendChild(contentDiv); div.style.display = 'none'; panes.floatPane.appendChild(div); panes.floatPane.appendChild(stemel); this.panMap(); } else if (div.parentNode != panes.floatPane) { // The panes have changed. Move the div. div.parentNode.removeChild(div); panes.floatPane.appendChild(div); } else { // The panes have not changed, so no need to create or move the div. } } /* Pan the map to fit the InfoBox. */ InfoBox.prototype.panMap = function() { // if we go beyond map, pan map var map = this.map_; var bounds = map.getBounds(); if (!bounds) return; // The position of the infowindow var position = this.latlng_; // The dimension of the infowindow var iwWidth = this.width_; var iwHeight = getBoxHeight(this.type); // The offset position of the infowindow var iwOffsetX = this.offsetHorizontal_; var iwOffsetY = this.offsetVertical_; // Padding on the infowindow var padX = 40; var padY = 40; // The degrees per pixel var mapDiv = map.getDiv(); var mapWidth = mapDiv.offsetWidth; var mapHeight = mapDiv.offsetHeight; var boundsSpan = bounds.toSpan(); var longSpan = boundsSpan.lng(); var latSpan = boundsSpan.lat(); var degPixelX = longSpan / mapWidth; var degPixelY = latSpan / mapHeight; // The bounds of the map var mapWestLng = bounds.getSouthWest().lng(); var mapEastLng = bounds.getNorthEast().lng(); var mapNorthLat = bounds.getNorthEast().lat(); var mapSouthLat = bounds.getSouthWest().lat(); // The bounds of the infowindow var iwWestLng = position.lng() + (iwOffsetX - padX) * degPixelX; var iwEastLng = position.lng() + (iwOffsetX + iwWidth + padX) * degPixelX; var iwNorthLat = position.lat() - (iwOffsetY - padY) * degPixelY; var iwSouthLat = position.lat() - (iwOffsetY + iwHeight + padY) * degPixelY; // calculate center shift var shiftLng = (iwWestLng < mapWestLng ? mapWestLng - iwWestLng : 0) + (iwEastLng > mapEastLng ? mapEastLng - iwEastLng : 0); var shiftLat = (iwNorthLat > mapNorthLat ? mapNorthLat - iwNorthLat : 0) + (iwSouthLat < mapSouthLat ? mapSouthLat - iwSouthLat : 0); // The center of the map var center = map.getCenter(); // The new map center var centerX = center.lng() - shiftLng; var centerY = center.lat() - shiftLat; // center the map to the new shifted center //map.setCenter(new google.maps.LatLng(centerY, centerX)); // Remove the listener after panning is complete. }; function initDevisCounter(min,bulk){ $('div.deviscounter').each(function(){ var hold = $(this); var input = hold.find('input.text'); var decrease = hold.find('a.decrease'); var increase = hold.find('a.increase'); decrease.click(function(){ var d = input.val()*1; d-=bulk; if (d < min) d = min; input.val(d); return false; }); increase.click(function(){ var d = input.val()*1; d+=bulk; input.val(d); return false; }); }); } function clearIfNotClickedFirst(field, inhoud) { if (field.value == inhoud) { field.value = ''; } } function fillifEmpty(field,inhoud){ if(field.value=='') { field.value=inhoud; } } function getClassName(type){ if(type==null)return ''; if(type=='hotel')return ' mapinfo-hotel-box'; if(type=='restaurant')return ' mapinfo-restaurant-box'; if(type=='estate')return ' mapinfo-estate-box'; return ''; } function getBoxHeight(type){ if(type==null)return 'auto'; if(type=='hotel')return '145px'; if(type=='restaurant')return '145px'; if(type=='hotel_restaurant')return '320px'; if(type=='estate')return '175px'; return 'auto'; } function getOffsetVertical(type){ if(type==null)return -210; if(type=='hotel')return -180; if(type=='restaurant')return -180; if(type=='hotel_restaurant')return -354; if(type=='estate')return -210; return '-210'; } function showHideDiv(id){ var div = document.getElementById(id); if(div && div.style.visibility=='hidden'){ div.style.visibility='visible'; }else if(div && div.style.visibility=='visible'){ div.style.visibility='hidden'; } }