google.load("maps","2.x");function txIsNumeric(expression){var nums="0123456789";if(expression!=null&&expression.length==0)return(false);if(expression!=null){for(var n=0;n<expression.length;n++){if(nums.indexOf(expression.charAt(n))==-1)return(false);};return(true);}else{return(false);}};function txUrlencode(str){var ret=str;ret=ret.toString();ret=encodeURIComponent(ret);ret=ret.replace(/%20/g,'+');return ret;}
function MapSearchView(map,os){this.currentAnchor;this.viewableAnchors=new Array();this.viewableSubAnchors=new Array();this.viewableRegionAnchors=new Array();this.viewableAreaAnchors=new Array();this.viewableCityAnchors=new Array();this.map=map;this.os=os;this.defaultFetchSubAnchors=false;this.formControlMode='link';this.mode='id';this.formId=null;this.planetSelectId=null;this.continentSelectId=null;this.countrySelectId=null;this.regionSelectId=null;this.areaSelectId=null;this.citySelectId=null;this.cityquarterSelectId=null;this.streetSelectId=null;this.streetNoSelectId=null;this.setCurrentAnchor=function(geoAnchor){this.currentAnchor=geoAnchor;};this.fetchViewableAnchors=function(){var thisObject=this;var result=this.os.getViewableAnchors(this.currentAnchor);for(var index in result){var currVA=new MapSearchViewGeoAnchor();currVA.importAnchor(result[index]);this.viewableAnchors.push(currVA);};if(this.defaultFetchSubAnchors==true){this.fetchViewableSubAnchors();};};this.fetchViewableSubAnchors=function(){for(var index in this.viewableAnchors){var currSubResult=this.os.getViewableAnchors(this.viewableAnchors[index]);for(var index2 in currSubResult){var currVA=new MapSearchViewGeoAnchor();currVA.importAnchor(currSubResult[index2]);this.viewableSubAnchors.push(currVA);}}};this.getSuggestedZoom=function(){switch(this.currentAnchor.context){case'PLANET':return 1;break;case'CONTINENT':return 3;break;case'COUNTRY':return 5;break;case'REGION':return 7;break;case'AREA':return 8;break;case'CITY':return 11;break;case'CITYQUARTER':return 12;break;}};this.buildMap=function(){var thisObject=this;if(this.viewableAnchors!=null&&this.viewableAnchors.length>0){var currMarker=new Array();var currPoint=null;for(var index in this.viewableAnchors){currMarker=this.createMarkerFromAnchor(this.viewableAnchors[index]);this.map.addOverlay(currMarker);}}
if(this.viewableSubAnchors!=null&&this.viewableSubAnchors.length>0){var currMarker=new Array();var currPoint=null;for(var index in this.viewableSubAnchors){currMarker=this.createMarkerFromAnchor(this.viewableSubAnchors[index]);this.map.addOverlay(currMarker);}}};this.selectDropDownValue=function(element,text){for(var i=0;i<element.options.length;i++)
{if((parseInt(element.options[i].value)==parseInt(text))||element.options[i].value==text)
{element.options[i].selected=true;}
else
{element.options[i].selected=false;}}};this.createMarkerFromAnchorForSelectForm=function(anchor){var mode=this.mode;var formId=this.formId;var planetSelectId=this.planetSelectId;var continentSelectId=this.continentSelectId;var countrySelectId=this.countrySelectId;var regionSelectId=this.regionSelectId;var areaSelectId=this.areaSelectId;var citySelectId=this.citySelectId;var cityquarterSelectId=this.cityquarterSelectId;var streetSelectId=this.streetSelectId;var streetNoSelectId=this.streetNoSelectId;var markerOptions=this.createMarkerOptionsFromAnchor(anchor);var thisObject=this;var point=new GLatLng(parseFloat(anchor.latitude),parseFloat(anchor.longitude));var marker=new GMarker(point,markerOptions);marker.value=anchor["name"];GEvent.addListener(marker,"click",function(){if(planetSelectId!=null&&anchor.context=='PLANET'){var planetSelector=document.getElementById(planetSelectId);if(planetSelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(planetSelector,anchor.planetId);}else{thisObject.selectDropDownValue(planetSelector,anchor.name);}}}
if(continentSelectId!=null&&anchor.context=='CONTINENT'){var continentSelector=document.getElementById(continentSelectId);if(continentSelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(continentSelector,anchor.continentId);}else{thisObject.selectDropDownValue(continentSelector,anchor.name);}}}
if(countrySelectId!=null&&anchor.context=='COUNTRY'){var countrySelector=document.getElementById(countrySelectId);if(contrySelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(countrySelector,anchor.countryId);}else{thisObject.selectDropDownValue(countrySelector,anchor.name);}}}
if(regionSelectId!=null&&anchor.context=='REGION'){var regionSelector=document.getElementById(regionSelectId);if(regionSelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(regionSelector,anchor.regionId);}else{thisObject.selectDropDownValue(regionSelector,anchor.name);}}}
if(areaSelectId!=null&&anchor.context=='AREA'){var areaSelector=document.getElementById(areaSelectId);if(areaSelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(areaSelector,anchor.areaId);}else{thisObject.selectDropDownValue(areaSelector,anchor.name);}}}
if(citySelectId!=null&&anchor.context=='CITY'){var citySelector=document.getElementById(citySelectId);if(citySelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(citySelector,anchor.cityId);}else{thisObject.selectDropDownValue(citySelector,anchor.name);}}
var cityquarterSelector=document.getElementById(cityquarterSelectId);cityquarterSelector.value=null;}
if(cityquarterSelectId!=null&&anchor.context=='CITYQUARTER'){if(citySelectId!=null){var citySelector=document.getElementById(citySelectId);if(citySelector.options.length>0){if(mode=='id'){thisObject.selectDropDownValue(citySelector,anchor.cityId);}else{thisObject.selectDropDownValue(citySelector,anchor.name);}}}
var cityquarterSelector=document.getElementById(cityquarterSelectId);cityquarterSelector.value=anchor.cityquarterId;}
if(streetSelectId!=null&&anchor.context=='STREET'){var streetSelector=document.getElementById(streetSelectId);if(streetSelector.options.length>0){thisObject.selectDropDownValue(streetSelector,anchor.streetId);}}
if(streetNoSelectId!=null&&anchor.context=='STREETNO'){var streetNoSelector=document.getElementById(streetNoSelector);if(streetNoSelector.options.length>0){thisObject.selectDropDownValue(streetNoSelector,anchor.streetNoId);}}
var currForm=document.getElementById(formId);currForm.submit();});return marker;};this.createMarkerOptionsFromAnchor=function(anchor){if(anchor.context=='CITYQUARTER'){var tmpName=anchor.parentName+" - "+anchor.name;}else{var tmpName=anchor.name;}
if(anchor.numobj>1){var currTitle=tmpName+" ("+anchor.numobj+" gepruefte Feriendomizile).";}else{var currTitle=tmpName+" ("+anchor.numobj+" geprueftes Feriendomizil).";}
switch(anchor.context){case'CITY':case'CITYQUARTER':var imagestring="http://www.location-bretagne.de/laxoo/globalinc/phpPics/nmarkers/numbered_marker.php?text="+txUrlencode(anchor.name)+"&numobj="+anchor.numobj+"&context="+anchor.context;var cityMarker=new GIcon();cityMarker.iconAnchor=new GPoint(9,34);cityMarker.iconSize=new GSize(20,34);cityMarker.shadowSize=new GSize(37,34);cityMarker.iconShadow="http://www.location-bretagne.de/laxoo/globalinc/phpPics/nmarkers/pushpins/templates/shadow50.png";cityMarker.image=imagestring;cityMarker.infoWindowAnchor=new GPoint(9,2);cityMarker.infoShadowAnchor=new GPoint(18,25);markerOptions={icon:cityMarker,title:currTitle};break;default:var imagestring="http://www.location-bretagne.de/laxoo/globalinc/phpPics/nmarkers/numbered_marker.php?text="+txUrlencode(anchor.name)+"&numobj="+anchor.numobj+"&context="+anchor.context;var areaIcon=new GIcon();areaIcon.iconSize=new GSize(48,48);areaIcon.iconAnchor=new GPoint(48/2,48/2);areaIcon.iconShadow="http://www.location-bretagne.de/laxoo/globalinc/phpPics/nmarkers/numbered_marker.php?shadow=true&text="+txUrlencode(anchor.name)+"&numobj="+anchor.numobj+"&context="+anchor.context;areaIcon.shadowSize=new GSize(66,66);areaIcon.image=imagestring;areaIcon.infoWindowAnchor=new GPoint(9,2);areaIcon.infoShadowAnchor=new GPoint(18,25);markerOptions={icon:areaIcon,title:currTitle};};return markerOptions;};this.createMarkerFromAnchorWithLink=function(anchor){var thisObject=this;var point=new GLatLng(parseFloat(anchor.latitude),parseFloat(anchor.longitude));var marker=new GMarker(point,markerOptions);marker.value=anchor["name"];var lstring="http://www.location-bretagne.de/exec/ferienhaus/suche/powersuche/"+anchor.regionId+"/"+anchor.areaId+"/"+anchor.cityId+"/Anreise+unbekannt/Aufenthalt+unbekannt/1/ignore/ignore/ignore/Ergebnis";GEvent.addListener(marker,"click",function(){window.location.href=lstring;});return marker;};this.createMarkerFromAnchor=function(anchor){var markerOptions=this.createMarkerOptionsFromAnchor(anchor);switch(this.formControlMode){case'link':return this.createMarkerFromAnchorWithLink(anchor);break;case'form':return this.createMarkerFromAnchorForSelectForm(anchor);break;default:return this.createMarkerFromAnchorWithLink(anchor);}};this.displayMap=function(){this.map.setCenter(new google.maps.LatLng(this.currentAnchor.latitude,this.currentAnchor.longitude),this.getSuggestedZoom());};this.showCurrentSelection=function(){if(this.currentAnchor.context=='CITYQUARTER'){var tmpName=this.currentAnchor.parentName+" - "+this.currentAnchor.name;}else{var tmpName=this.currentAnchor.name;}
switch(this.currentAnchor.context){default:if(this.currentAnchor.numobj>1){var expString=" gepr&uuml;fte Feriendomizile";}else{var expString=" gepr&uuml;ftes Feriendomizil";}
var myHtml="<center><span style=\"text-align:center;color:darkblue;\"><b>Aktuelle Auswahl:</b><br /><span style=\"font-size:16px;color:red;font-weight:bold\">"
+tmpName
+"</span><br />"
+"<b> "+this.currentAnchor.numobj+expString+"</b>"
+"."
+"<br />Klicken Sie auf die Markierungen,<br />um die Suche weiter zu verfeinern.</span></center>";this.map.openInfoWindowHtml(new GLatLng(this.currentAnchor.latitude,this.currentAnchor.longitude),myHtml);}};this.closeCurrentSelection=function(){this.map.closeInfoWindow();};this.removeMap=function(){var mapContainer=document.getElementById("gmap");mapContainer.style.visibility="hidden";};}
function MapSearchViewGeoAnchor(){this.longitude;this.latitude;this.context;this.id;this.parentId;this.name;this.parentName;this.planetId;this.continentId;this.countryId;this.regionId;this.areaId;this.cityId;this.cityquarterId;this.streetId;this.streetNoId;this.numobj;this.importAnchor=function(anchor){this.longitude=anchor['longitude'];this.latitude=anchor['latitude'];this.context=anchor['context'];this.id=anchor['id'];this.parentId=anchor['parentId'];this.name=anchor['name'];this.parentName=anchor['parentName'];this.planetId=anchor['planetId'];this.continentId=anchor['continentId'];this.countryId=anchor['countryId'];this.regionId=anchor['regionId'];this.areaId=anchor['areaId'];this.cityId=anchor['cityId'];this.cityquarterId=anchor['cityquarterId'];this.streetId=anchor['streetId'];this.streetNoId=anchor['streetNoId'];this.numobj=anchor["numobj"];};}
