// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
 var map;
 var geocoder;
 
function create_google_map() {
	// Create a google maps geocoder for finding points by addressdata
	geocoder = new GClientGeocoder();
 
	// Create the google map
	map = new GMap2(document.getElementById("map"));

	// Format the address to make it retrievable from the google maps geocoder
	var loc = ['InterFlame','Costerstraat 14','1704 RJ','Heerhugowaard'];
	// Find the address and center the map at the found point
	add_address(geocoder, loc);
	
	// Add zoom and map type control to the google map
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
}

function add_address(geocoder, loc) {
		var address = loc[1]+ ', ' + loc[2] + ', ' + loc[3] + ', NL';
		geocoder.getLatLng(address,	function(point) {
   	  map.setCenter(new GLatLng(52.6824183665388, 4.836215972900391), 13);
       var marker = new GMarker(point);
       map.addOverlay(marker);
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml('<b>' + loc[0] + '</b><br>' + loc[1] + '<br>' + loc[2] + ' ' + loc[3]);
			});
			marker.openInfoWindowHtml('<b>' + loc[0] + '</b><br>' + loc[1] + '<br>' + loc[2] + ' ' + loc[3]);
  	}
	);
}

	var isNav4 = false;
	var isIE4 = false;
	var isMac = false;
	var isNav6 = false;
	
	var	isIE = (navigator.userAgent.indexOf("MSIE") != -1);
	var	isFirefox = (navigator.userAgent.indexOf("Firefox") != -1);
	var	isSafari = (navigator.userAgent.indexOf("Safari") != -1);
	
	var togglingBeheer = false;
	
	if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
		isNav4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) != 5) ? true : false;
		isNav6 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 5) ? true : false;
		isIE4  = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
		isMac  = (navigator.platform.indexOf("Mac") != -1) ? true : false;
	};

















// var WINDOW_HTML = '<div style="color: #000000"><strong>InterFlame</strong><br>Costerstraat 14<br>1704 RJ Heerhugowaard<\/div>';		
// 	function load() {
//   
// 		if (GBrowserIsCompatible()) {
//   		var map = new GMap2(document.getElementById("map"));
// 			map.addControl(new GSmallMapControl());
// 			map.addControl(new GMapTypeControl());
// 			map.setCenter(new GLatLng(52.67992069431732, 4.840035438537598), 14);
// 		
// 			var marker = new GMarker(new GLatLng(52.6785677288945, 4.836215972900391));
// 	     map.addOverlay(marker);
// 	     GEvent.addListener(marker, "click", function() {
// 	       marker.openInfoWindowHtml(WINDOW_HTML);
// 	     });
// 	     marker.openInfoWindowHtml(WINDOW_HTML);
// 		}
// 	}