///////////////////////////////////////////////////////
// Map edit dialog 

var BOOL_TRUE = 'True';		// bool.TrueString
var BOOL_FALSE = 'False';	// bool.FalseString

// return true if the dialog returns values
function doMapDialog(addressId, cityId, stateId, postalCodeId, countryCodeId, linkId, directionsId)
{
	var addressObject = document.getElementById(addressId);
	var cityObject = document.getElementById(cityId);
	var stateObject = document.getElementById(stateId);
	var postalCodeObject = document.getElementById(postalCodeId);
	var countryCodeObject = document.getElementById(countryCodeId);
	var linkObject = document.getElementById(linkId);
	var directionsObject = document.getElementById(directionsId);
	
	var p = new Object();
	p.address = addressObject.value;
	p.city = cityObject.value;
	p.state = stateObject.value;
	p.postalCode = postalCodeObject.value;
	p.countryCode = countryCodeObject.value;
	p.link = (linkObject.value == BOOL_TRUE);
	p.directions = (directionsObject.value == BOOL_TRUE);
	
	var v = window.showModalDialog(MapDialogUrl, p, 
		"scroll:no;center:yes;help:no;status:yes;dialogHeight:446px;dialogWidth:465px");
	
	if(v) 
	{
		addressObject.value = v.address;
		cityObject.value = v.city;		
		stateObject.value = v.state;
		postalCodeObject.value = v.postalCode;		
		countryCodeObject.value = v.countryCode;		
		linkObject.value = (v.link) ? BOOL_TRUE : BOOL_FALSE;
		directionsObject.value = (v.directions) ? BOOL_TRUE : BOOL_FALSE;		
		return true;
	}
	
	return false;
}

function btnMapOnClick(urlSection)
{
	var url = MapLinkBaseUrl + '?' + urlSection;
	window.open(url, "_blank", "width=400, height=400");
}
