function ExamplePopup (url,w,h) {	window.open(url,'_blank','width='+w+',height='+h+',toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=no');}function BackgroundSamplePopup (bg_map,place) {	window.open('background_examples.cgi?bg_map='+bg_map+'&place='+place,'bg_ex','width=750,height=450,toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes');}function HelpPopup (feature) {	window.open('/help.html' + '#' + feature,'help','width=640,height=500,toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes');}function FilePopup (url,windowname,w,h) {	window.open(url,windowname,'width='+w+',height='+h+',toolbar=no,location=no,status=no,menubar=yes,resizable=yes,scrollbars=yes');}function ChangeFormTarget(theForm) {	theForm.target = (theForm.new_window.checked) ? '_blank' : '_top';}function confirmRedirect(url,text) {	if(confirm("Would you like to go to "+text+"?")){		window.location = url;	} else {		return false;	}}function confirmRedirectSubmit(url,text,formname) {	if(confirm("Would you like to go to "+text+"?")){		document.main.action = url;		document.main.target = '_top';		document.main.form.value = formname;		document.getElementById('data_input').name='form.data';		document.main.submit();	} else {		return false;	}}function Track_Statistics_Warning() {	alert ('WARNING: GPS altitude data is very inaccurate; therefore, the elevation gain/loss statistics that are calculated from your track data may be off by a considerable amount.  Choosing to have your elevations replaced by DEM data may help, but even that is not guaranteed to be 100% correct.');}function Validate_Data_Box(data_box) {	if (data_box.value.match(/[a-z0-9]/i) && !data_box.value.match(/\b(lati?|latt?itude?|long?|lng|long?t?itude?|street|add?ress?e?1?|city|town|plaats|ville|state|province|nation|country|zip|zipcode|postal|post ?code|code ?postale?|airport)\b/i)) {		if (confirm('You\'ve entered some text into the \'data\' box, but it doesn\'t appear to have a valid header row on it and may produce an error.  Continue anyway?')) {			return true;		} else {			return false;		}	}}function FilterMapList(theForm) {	var format = document.getElementById('format').value;	var mapCount = theForm.bg_map.options.length;	var defaultMap = [];	for (i = 0; i < mapCount; i++) {		// if (theForm.bg_map.options[i].value == 'landsat') { defaultMap['jpg'] = i; defaultMap['jpeg'] = i; defaultMap['png'] = i; defaultMap['svg'] = i; }		if (theForm.bg_map.options[i].value == 'google_hybrid') { defaultMap['google'] = i; }		else if (theForm.bg_map.options[i].value == 'yahoo_hybrid') { defaultMap['yahoo'] = i; }	}	for (j = 0; j < mapCount; j++) {		var txt = theForm.bg_map.options[j].text;		var val = theForm.bg_map.options[j].value;		var last = txt.substring(txt.length-1,txt.length);		if (!format) {			ShowMenuItem(theForm.bg_map,j);		} else if (format == 'google') {			if (val.indexOf('google') > -1 || val.indexOf('modis_daily') > -1 || val == 'usgs_topo' || val == 'usgs_aerial' || val == 'bluemarble' || val == 'landsat' || val == 'nrcan_topo' || val == 'nrcan_topo_names' || val == 'natatlas_county_outlines') { ShowMenuItem(theForm.bg_map,j); }			else { HideMenuItem(theForm.bg_map,j); }		} else if (format.indexOf('yahoo') > -1) {			if (val.indexOf('yahoo') > -1) { ShowMenuItem(theForm.bg_map,j); }			else { HideMenuItem(theForm.bg_map,j); }		} else if (format == 'googleearth') {			if (j == 0) { ShowMenuItem(theForm.bg_map,j); }			else { HideMenuItem(theForm.bg_map,j); }			theForm.bg_map.selectedIndex = 0;		} else if (format == 'svg') {			if (val.indexOf('google') > -1 || val.indexOf('yahoo') > -1) { HideMenuItem(theForm.bg_map,j); }			else { ShowMenuItem(theForm.bg_map,j); }			} else { // PNG or JPEG			if (val.indexOf('_tiles') > -1 || val.indexOf('google') > -1 || val.indexOf('yahoo') > -1 || val == 'tiger') { HideMenuItem(theForm.bg_map,j); }			else { ShowMenuItem(theForm.bg_map,j); }			}	}	if (!bg_map_changed && defaultMap[format] != null && theForm.bg_map.selectedIndex == 0) { theForm.bg_map.selectedIndex = defaultMap[format]; }	if (theForm.bg_map.options[theForm.bg_map.selectedIndex].disabled) {		if (format == 'google') { theForm.bg_map.selectedIndex = defaultMap['google']; }		else if (format.indexOf('yahoo') > -1) { theForm.bg_map.selectedIndex = defaultMap['yahoo']; }		else { theForm.bg_map.selectedIndex = defaultMap['normal']; }	}}function CheckForDisabledMapSelection(theForm) {	var defaultMap = [];	for (i = 0; i < theForm.bg_map.options.length; i++) {		if (theForm.bg_map.options[i].value == 'landsat') { defaultMap['svg'] = defaultMap['jpg'] = defaultMap['png'] = i; }		else if (theForm.bg_map.options[i].value == 'google_hybrid') { defaultMap['google'] = i; }		else if (theForm.bg_map.options[i].value == 'yahoo_hybrid') { defaultMap['yahoo'] = i; }	}	if (theForm.bg_map.options[theForm.bg_map.selectedIndex].disabled) {		theForm.bg_map.selectedIndex = defaultMap[theForm.format.value];	}	if (theForm.bg_map.options[theForm.bg_map.selectedIndex].value.indexOf('google') > -1) {		if (theForm.format.value != 'google') {			theForm.bg_map.selectedIndex = defaultMap[theForm.format.value]		}	} else if (theForm.bg_map.options[theForm.bg_map.selectedIndex].value.indexOf('yahoo') > -1) {		if (theForm.format.value.indexOf('yahoo') < 0) {			theForm.bg_map.selectedIndex = defaultMap[theForm.format.value]		}	}}function HideMenuItem(theMenu,i) {	theMenu.options[i].disabled = true; theMenu.options[i].style.display = 'none';}function ShowMenuItem(theMenu,i) {	theMenu.options[i].disabled = false; theMenu.options[i].style.display = '';}function GPSBabel_FilterFormats(theForm,theMenu) {	var type = '['+theForm.type.value.toUpperCase()+']';	for (j = 0; j < theMenu.length; j++) {		var txt = theMenu.options[j].text;		if (txt.indexOf(type) > -1) {			theMenu.options[j].disabled = false;		} else {			if (j == theMenu.selectedIndex) { theMenu.selectedIndex = 0; }			theMenu.options[j].disabled = true;		}	}}function GPSBabel_ShowOptions(theMenu) {	var code = theMenu.value;	for (j = 0; j < (theMenu.length); j++) {		var c = theMenu.options[j].value;		if (c == code) {			if (document.getElementById(c+':options')) { Show(c+':options'); }		} else {			if (document.getElementById(c+':options')) { Hide(c+':options'); }		}	}}function Show(ob) {	if (document.getElementById) { document.getElementById(ob).style.display = ''; }	else if (document.all) { document.all.ob.style.display = ''; }	else { document.ob.style.display = ''; }}function Hide(ob) {	if (document.getElementById) { document.getElementById(ob).style.display = 'none'; }	else if (document.all) { document.all.ob.style.display = 'none'; }	else { document.ob.style.display = 'none'; }}function Toggle(ob) {	if (document.getElementById) { currentVisibility = document.getElementById(ob).style.display; }	else if (document.all) { currentVisibility = document.all.ob.style.display; }	else { currentVisibility = document.ob.style.display; }	if (currentVisibility == 'none') { Show(ob); }	else { Hide(ob); }}function getRadioByValue (radioButtonOrGroup,value) {	if (!radioButtonOrGroup.length) { // single button		if (radioButtonOrGroup.value == value) {			return radioButtonOrGroup;		} else {			return null;		}	} else {		for (var b = 0; b < radioButtonOrGroup.length; b++) {			if (radioButtonOrGroup[b].value == value) {				return radioButtonOrGroup[b];			}		}		return null;	}}bg_map_changed = false;