
lastId = false;
function openMenuID(ID){
	if(lastId){
		document.getElementById(lastId).style.display = 'none';
		lastId = ID;
	}
	document.getElementById(ID).style.display = 'block';
}
function closeMenuID(ID){
	if(lastId = ID){
		document.getElementById(lastId).style.display = 'none';
		lastId = false;
	}else{
		document.getElementById(lastId).style.display = 'none';
	}
}

function xredirect(message,url){
	alert(message);
	window.location=url;
}

//Action check! ask realy act?
function didYouMean(url,what){
	var userSaid = confirm(what)
	if(userSaid == true){
		window.location=url;
	}else{
		return userSaid;
	}
}

var map = null;
var geocoder = null;

function showAddress(address) {
	if (GBrowserIsCompatible()) {
		geocoder = new GClientGeocoder();
		if (geocoder) {
			geocoder.getLatLng(
				address,
				function(point) {
					if (point) {
						map = new GMap2(document.getElementById("google_map"));
						map.addControl(new GSmallMapControl());
						map.addControl(new GMapTypeControl());
						map.setCenter(point, 13);
						var marker = new GMarker(point);
						map.addOverlay(marker);
					} 
				}
        		);
		}
	}
}
function getAddressGeocodes(fName,address) {
	if (GBrowserIsCompatible()) {
		geocoder = new GClientGeocoder();
		if (geocoder) {
			geocoder.getLatLng(
				address,
				function(point) {
					if (!point) {
						alert("Longitude: 0.0, Latitude: 0.0, Altitude: 0.0");
					} else {
						alert('Longitude: ' + point.x + ', Latitude: ' + point.y+' Altitude: '+ point.z +' ');
						document.forms[fName]['LATITUDE'].value = point.y;
						document.forms[fName]['LONGITUDE'].value = point.x;
						document.forms[fName]['ALTITUDE'].value = point.z;
					}
				}
        		);
		}
	}
}

