var map;var calledGoogleMapApi=false;var isTheFirstMarker=true;var iconHotel;var currentHotel;var iconLandmark;var iconCity;var iconAirport;var customIcons;var curlat=0;var curlng=0;var lat1=0;var lat2=0;var lng1=0;var lng2=0;function loadMapMain(){if(calledGoogleMapApi){}else{var a=document.createElement("script");a.setAttribute("src","http://maps.google.com/maps?file=api&v=2&key="+GOOGLE_API_KEY+"&async=2&callback=loadMap");a.setAttribute("type","text/javascript");document.documentElement.firstChild.appendChild(a);calledGoogleMapApi=true;isTheFirstMarker=true}}function loadMap(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("mapframe"));map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.addControl(new GScaleControl());map.setCenter(new GLatLng(lat_in,long_in),13);var a=document.createElement("script");a.setAttribute("src","js/extinfowindow.js");a.setAttribute("type","text/javascript");document.documentElement.firstChild.appendChild(a)}firstTitlesLoadedEventListener=GEvent.addListener(map,"tilesloaded",tilesloadedHandler)}function pushStaticMap(){var a=document.getElementById("staticmap");a.style.zIndex=0;a.style.display="none"}function tilesloadedHandler(){loadMarkers();setTimeout("pushStaticMap();",1000);GEvent.removeListener(firstTitlesLoadedEventListener)}function loadMarkers(){iconHotel=new GIcon();iconHotel.image="imgcommon/mapmarkers/marker-hotel-blue.png";iconHotel.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";iconHotel.iconSize=new GSize(20,20);iconHotel.shadowSize=new GSize(22,22);iconHotel.iconAnchor=new GPoint(6,20);iconHotel.infoWindowAnchor=new GPoint(5,1);currentHotel=new GIcon();currentHotel.image="imgcommon/mapmarkers/marker-hotel-orange-large.png";currentHotel.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";currentHotel.iconSize=new GSize(27,27);currentHotel.iconAnchor=new GPoint(6,20);currentHotel.infoWindowAnchor=new GPoint(5,1);iconLandmark=new GIcon();iconLandmark.image="imgcommon/mapmarkers/marker-landmark.png";iconLandmark.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";iconLandmark.iconSize=new GSize(20,20);iconLandmark.shadowSize=new GSize(22,22);iconLandmark.iconAnchor=new GPoint(6,20);iconLandmark.infoWindowAnchor=new GPoint(5,1);iconCity=new GIcon();iconCity.image="imgcommon/mapmarkers/marker-city.png";iconCity.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";iconCity.iconSize=new GSize(9,9);iconCity.shadowSize=new GSize(11,11);iconCity.iconAnchor=new GPoint(6,11);iconCity.infoWindowAnchor=new GPoint(5,1);iconAirport=new GIcon();iconAirport.image="imgcommon/mapmarkers/marker-airport.png";iconAirport.shadow="http://labs.google.com/ridefinder/images/mm_20_shadow.png";iconAirport.iconSize=new GSize(20,20);iconAirport.shadowSize=new GSize(22,22);iconAirport.iconAnchor=new GPoint(6,20);iconAirport.infoWindowAnchor=new GPoint(5,1);customIcons=[];customIcons.Villa=iconHotel;customIcons["Bed and Breakfast"]=iconHotel;customIcons["Guest accommodation"]=iconHotel;customIcons.Landmark=iconLandmark;customIcons.Hostel=iconHotel;customIcons.Resort=iconHotel;customIcons.currentHotel=currentHotel;GDownloadUrl("ct_xmlgeneration-onehotel.php?sid="+sid_in+"&hotel_id="+hotel_in+"&city="+city_in+"&lat="+lat_in+"&lng="+long_in,function(f){var h=GXml.parse(f);var d=h.documentElement.getElementsByTagName("marker");for(var g=0;g<d.length;g++){var b=d[g].getAttribute("name");var m=d[g].getAttribute("address");var n=d[g].getAttribute("class");var c=d[g].getAttribute("image");var a=d[g].getAttribute("url");var k=d[g].getAttribute("type");curlat=parseFloat(d[g].getAttribute("latitude"));curlng=parseFloat(d[g].getAttribute("longitude"));var l=new GLatLng(curlat,curlng);if(isTheFirstMarker){lat1=curlat;lat2=curlat;lng1=curlng;lng2=curlng;isTheFirstMarker=false}else{lat1=Math.min(lat1,curlat);lat2=Math.max(lat2,curlat);lng1=Math.min(lng1,curlng);lng2=Math.max(lng2,curlng)}var e=createHotelMarker(map,l,b,m,k,c,n,a);map.addOverlay(e)}var p=new GLatLngBounds(new GLatLng(lat1,lng1),new GLatLng(lat2,lng2));var o=map.getBoundsZoomLevel(p);var j=map.getCenter();map.setCenter(j,13)});GDownloadUrl("ct_xmlgeneration-landmarks.php?city="+city_in+"&lat="+lat_in+"&lng="+long_in,function(f){var b=GXml.parse(f);var h=b.documentElement.getElementsByTagName("landmarker");for(var d=0;d<h.length;d++){var e=h[d].getAttribute("landmarkname");var a=h[d].getAttribute("type");var c=new GLatLng(parseFloat(h[d].getAttribute("latitude")),parseFloat(h[d].getAttribute("longitude")));var g=createLandMarker(map,c,e,a);map.addOverlay(g)}})}function createHotelMarker(a,i,b,h,g,d,j,c){var e=new GMarker(i,customIcons[g]);var f="<table cellpadding='0' cellspacing='0' width='250' style='font-family: arial; font-size: 11px;'><tr><td width='100%' colspan='2'><table width='100%' cellpadding='0' cellspacing='0' style='font-family: arial; font-size: 11px;'><tr><td width='150'><strong>"+b+"</strong></td><td align='right'><img src='http://static.booking.com/static/img/icons/stars/"+j+"sterren4.png'></td></tr></table></td></tr><tr style='background-color: orange;'><td style='padding: 3px;'><img src='"+d+"'  width='60' height='60'></td><td style='text-align: justify; vertical-align: text-top;'>"+h+"</td></tr></table>";GEvent.addListener(e,"click",function(){window.parent.location=c});GEvent.addListener(e,"mouseover",function(){e.openExtInfoWindow(a,"simple_window",f,{beakOffset:5})});GEvent.addListener(e,"mouseout",function(){a.closeExtInfoWindow()});return e}function createLandMarker(f,b,d,a){var e=new GMarker(b,customIcons[a]);var c="<div style='font-size:12px; font-family:arial; background-color:#9bbdde; font-weight:bold; color:#fff;'><b>"+d+"</b></div>";GEvent.addListener(e,"mouseover",function(){e.openExtInfoWindow(f,"simple_window",c,{beakOffset:5})});GEvent.addListener(e,"mouseout",function(){f.closeExtInfoWindow()});return e};
