    //<![CDATA[
// this is the Javascript that makes the map.  It should be defined in the head of the document

// global variables
      var map;
      var request;
// Create our colored marker icons 
var icons = new Array();
icons["red"] = new GIcon(G_DEFAULT_ICON); 
icons["red"].image = "/images/mm_20_red.png"; 
icons["red"].shadow = "/images/mm_20_shadow.png";
icons["red"].iconSize = new GSize(12, 20);
icons["red"].shadowSize = new GSize(22, 20);
icons["red"].iconAnchor = new GPoint(6, 20);
icons["red"].infoWindowAnchor = new GPoint(5, 1);

function get_icon(iconColor) {
   if ((typeof(iconColor)=="undefined") || (iconColor==null)) { 
      iconColor = "red"; 
   }
   if (!icons[iconColor]) {
      icons[iconColor] = new GIcon(icons["red"]);
      icons[iconColor].image = "/images/mm_20_"+ iconColor +".png";
   } 
   return icons[iconColor];
}

// A function to create the marker and set up the event window
// function createMarker(point,name,html) {
function createMarker(point,name,html,iconStr) {

        // FF 1.5 fix
        html = '<div style="white-space:nowrap;">' + html + '</div>';
        var marker = new GMarker(point);
	if (iconStr) {
            marker = new GMarker(point, get_icon(iconStr));
        }
		
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }


// This function picks up the click and opens the corresponding info window
function myclick(i) {
        gmarkers[i].openInfoWindowHtml(htmls[i]);
      }


function makeMap() {
    if (GBrowserIsCompatible()) {
      // resize the map
      var m = document.getElementById("map");
      m.style.height = "400px";
      m.style.width = "500px";

      // create the map
      map = new GMap(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      // map.centerAndZoom(new GPoint(-79.359741, 43.907787), 8);
      map.setCenter(new GLatLng(47.3309, 11.1875), 14);
      map.setMapType(G_SATELLITE_MAP); 
	  
    } else {
      alert("your browser does not support Google Maps!");
    }


   getXMLfile();

}

function getXMLfile() {
   // Read the data from example.xml
   request = GXmlHttp.create();
   filename = "seefeld_hotel4xml.php"
   if (filename.length == 0) { 
   alert("Please enter a filename!");
   return false;
   }


//      filename = "example.xml"
   request.open("GET", filename, true);
   request.onreadystatechange = processXMLfile;



   request.send(null);
   return false;
}

function processXMLfile() {

  if (request.readyState == 4) {
    if ((request.status == 200) || (request.status == 304)) {
       var xmlDoc = request.responseXML;
       if (xmlDoc.documentElement) {
          // obtain the array of markers and loop through it
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");

          map.clearOverlays();
          for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            // var point = new GPoint(lng,lat);
            var point = new GLatLng(lat,lng);
            var hotel = markers[i].getAttribute("hotel");
            var address = markers[i].getAttribute("address");
            var town = markers[i].getAttribute("town");
            var tel = markers[i].getAttribute("tel");
            var site = markers[i].getAttribute("site");
            var imagename = markers[i].getAttribute("imagename");
            var affurl = markers[i].getAttribute("affurl");
            var location = markers[i].getAttribute("location");
			var affid = markers[i].getAttribute("affid");
             if (affid=="aff") {
				var html = "<p><b>" + hotel + "</b><br/><img src='http://www.walkseefeld.com/images/maps/" + imagename + ".jpg'  width='100' height='75' alt='" + hotel +"' class='hotel' /><br/>" + address + "<br/>" + town + "<br/>Tel: " + tel + "<br/><a href='http://www.booking.com/hotel/at/" + affurl + ".html?aid=328088' rel='nofollow'><img src='/images/accommodation/checkavailability.gif' alt='Check Availability' width='122' height='20' border='0'></a></p>";
			 }
			 else {
				var html = "<p><b>" + hotel + "</b><br/>" + address + "<br/>" + town + "<br/>Tel: " + tel + "</p>";
			 }
            var icon = markers[i].getAttribute("icon");
            // create the marker
            var marker = createMarker(point,hotel,html,icon);
            map.addOverlay(marker);
          }
       } else {
          alert("invalid xml file:"+filename);
       }
    } else {
     alert("file not found:"+filename);
    }
  }
}

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/
	// and http://www.geocodezip.com/

    //]]>

