// JavaScript Document

//<![CDATA[

    //var map;
    //var geocoder;

	function addlocation(lat,lng) {
    var point = new GLatLng(lat,lng);
    map.addOverlay(new GMarker(point));
	}
	
    function load() {
      map = new GMap2(document.getElementById("map"));
	  map.addControl(new GLargeMapControl());
	  map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(50.848914,5.697548), 13);
      geocoder = new GClientGeocoder();
	}
	
	function openInfo(lat,lng) {
		var point = new GLatLng(lat,lng);
		var marker = createMarker(point,'<div style="width:240px">Some stuff to display in the First Info Window. With a <a href="http://www.econym.demon.co.uk">Link<\/a> to my home page<\/div>')
		map.addOverlay(marker);

		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("test");
		});
		map.addOverlay(marker);
	}
	
    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      //map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.setCenter(new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]), 16);
		map.addOverlay(marker);
        marker.openInfoWindowHtml('' + place.address + '' ) // + '<br>' +
          //'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
      var address = document.forms[0].q.value;
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
    }
    //]]>
	      
	function img_act(imgName) {
	        if (version == "n3" || version == "e4") {
	        imgOn = eval(imgName + "on.src");
	        document [imgName].src = imgOn;
	        }
	}
	function img_inact(imgName) {
	        if (version == "n3" || version == "e4") {
	        imgOff = eval(imgName + "off.src");
	        document [imgName].src = imgOff;
	        }
	}
	function pol_act(imgName) {
	        if (version == "n3" || version == "e4") {
	        imgOn = eval(imgName + ".src");
	        document [imgName].src = imgOn;
	        }
	}
	function pol_inact(imgName) {
	        if (version == "n3" || version == "e4") {
	        imgOff = eval(imgName + "off.src");
	        document [imgName].src = imgOff;
	        }
	}
	//-->
