var postalCode         = '';

/* mapheading.js: script for map operations */
var mappedObjectUTMs   = '';
var mappedObjectLabels = '';
var mappedObjectLinks  = '';
var mappedObjectClasses= '';

function addObjectToMap( postalCode, label, link )
{
	if (addObjectToMap.arguments.length > 3)
	{
		theClass = addObjectToMap.arguments[ 3 ];
	}
	else
	{
		theClass = 'zoningCircle';
	}
	if (postalCode != ''){
	mappedObjectUTMs   = mappedObjectUTMs   + postalCode   + ';;';
	mappedObjectLabels = mappedObjectLabels + label + ';;';
	mappedObjectLinks  = mappedObjectLinks  + link + ';;';
	mappedObjectClasses  = mappedObjectClasses  + theClass + ';;';
}}

function showLocationOnMap( postalcode, hinttext )
{
	if (showLocationOnMap.arguments.length > 3)
	{
		theClass = showLocationOnMap.arguments[ 3 ];
	}
	else
	{
		theClass = 'zoningCircle';
	}

	var index;
	while ( ( index = hinttext.indexOf( "&" ) ) != -1 )
	{
		hinttext = hinttext.substring( 0, index ) + "%26" + hinttext.substring( index + 1, hinttext.length );
	}
	while ( ( index = hinttext.indexOf( "'" ) ) != -1 )
	{
		hinttext = hinttext.substring( 0, index ) + "%27" + hinttext.substring( index + 1, hinttext.length );
	}
	var ifrm = document.getElementById( "ap_iframe" );
	ifrm.width = 540;
	ifrm.height = 480;
	ifrm.src = "svg_map_php/map.php?appId=31&postalCode=" + postalCode.replace(" ","") +
		"&zoom=2&hinttext=" + hinttext + "&sr_formSend=true&myparent=true&theClass=" + theClass;
}


function showLocationsOnMap()
{
	var ifrm = document.getElementById( "ap_iframe" );
	var warning = document.getElementById( "warning" );
	ifrm.width = 540;
	ifrm.height = 538 ;

	// The drawing function is implemented in the SVG code, which
	// is loaded into an iframe;  thus, the following statement should
	// be included somewhere in the initialization sequence for that code:
	//   parent.draw_locations = name_of_some_implemented_function
	// The function takes three parameters: a list of UTM co-ordinates "utme,utmn",
	// a list of fly-over text labels and a list of URLs, where each
	// list is comprised of elements separated by two semi-colons
	// A warning is displayed if the SVG plug-in is not completely loaded
	// and the drawing function cannot be found yet.
	if ( typeof( draw_locations ) != "undefined" )
	{
		warning.style.visibility = "hidden";
		warning.style.position = "absolute";
		draw_locations( mappedObjectUTMs, mappedObjectLabels, mappedObjectLinks, mappedObjectClasses );
	}
	else
	{
		warning.style.position = "relative";
		warning.style.visibility = "visible";
	}
}




