// file:	/javascript/saff/links.js
//
// needs	/javascript/openFeedback.js
//			/javascript/panel_id.js
//			/javascript/epss_open.js
//			/javascript/gotoMainPage.js

//
// Local variables and setters/getters
//
var	saffLangDir = "en";		// global language directory

function setLangDir(lang) { saffLangDir = lang; }


//
// Debug tools - remove before production!
//
function DEBUG_ALERT(msg) {
//	alert("DEBUG: " + msg);
}

//
// Get GeoId from parameter or page if possible
//
function saffGetGeoId(geoId) {
	if (geoId == null || geoId == "") {
		if (document.hidden_navigation_form) {
			geoId = document.hidden_navigation_form.geo_id.value;
		}
		else {
			DEBUG_ALERT("/javascript/saff/links.js: Error - calling page missing hidden_navigation_form!");
		}
	}
	return geoId;
}

//
// Determine if no context is required - return true if small URL can be used
//
function saffUseSmallURL(geoId) {
	var useSmallURL = false;
	if ((geoId == "" || geoId == "01000US") && document.hidden_navigation_form) {
		if (document.hidden_navigation_form._geoContext.value == "" &&
			document.hidden_navigation_form._street.value == "" &&
			document.hidden_navigation_form._county.value == "" &&
			document.hidden_navigation_form._cityTown.value == "" &&
			document.hidden_navigation_form._state.value == "" &&
			document.hidden_navigation_form._zip.value == "") {
				useSmallURL = true;
			}
	}
	return useSmallURL;
}

//
// Open pop-up window
//
function openPopUp(winName, url) {
	var winParams = "menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,top=20,left=20,width=550,height=320";
	if (winName == "feedbackwin") {
		winParams = "menubar=no,resizable=yes,scrollbars=yes,top=10,left=10,width=620,height=560";
	}
	else if (winName == "helpwin") {
		winParams = "menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,top=20,left=20,width=550,height=320";
	}
	else if (winName == "identify") {
		winParams = "menubar=yes,scrollbars=yes,resizable=yes,top=10,left=10,width=750,height=550";
	}
	else if (winName == "explainwin") {
		winParams = "menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,top=20,left=20,width=600,height=400"; 
	}
	else if (winName == "epsswin") {
		winParams = "menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,top=20,left=20,width=600,height=380";
	}
	else if (winName == "examplewin") {
		winParams = "menubar=yes,scrollbars=yes,toolbar=yes,resizable=yes,width=700,height=510";
	}
	else if (winName == "econftp") {
		winParams = "menubar=yes,scrollbars=yes,toolbar=yes,top=20,left=20,resizable=yes,width=700,height=510";
	}
	var newWin = window.open(url, winName, winParams);
	if (window.focus) {
		newWin.focus();
	}
}

function saffShowPage(url) {
	location.href = url;
}

function showSAFFInfo(geoId, pageId, submenuId) {
	
	geoId = saffGetGeoId(geoId);
    if(typeof(submenuId)=="undefined"){ submenuId="";}
	if (saffUseSmallURL(geoId) && document.hidden_simple_static_page_form) {
		document.hidden_simple_static_page_form.action = "/jsp/saff/SAFFInfo.jsp";
		document.hidden_simple_static_page_form._pageId.value = pageId;
		document.hidden_simple_static_page_form._submenuId.value = submenuId;
		document.hidden_simple_static_page_form.submit();
	}
	else if (document.hidden_static_page_form) {
		document.hidden_static_page_form.action = "/jsp/saff/SAFFInfo.jsp";
		document.hidden_static_page_form.geo_id.value = geoId;
		document.hidden_static_page_form._pageId.value = pageId;
		document.hidden_simple_static_page_form._submenuId.value = submenuId;
		document.hidden_static_page_form.submit();
	}
	else {
		var url= "/jsp/saff/SAFFInfo.jsp";
		url = url + "?geo_id=" + geoId;
		url = url + "&_pageId=" + pageId;
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage(url);
	}
}

function showServletPage(geoId, servlet, submenuId, dsName, ciNbr, qrName,industry) {

	geoId = saffGetGeoId(geoId);
	//alert(reg);
	if (saffUseSmallURL(geoId) && document.hidden_simple_navigation_form) {
	    if (servlet != '') {
			document.hidden_simple_navigation_form.action = "/servlet/" + servlet;
		}
		if(typeof(submenuId)=="undefined"){ submenuId=document.hidden_simple_navigation_form._submenuId.value;}
		if(typeof(dsName)=="undefined") {dsName=document.hidden_simple_navigation_form.ds_name.value;}
		if(typeof(ciNbr)=="undefined") {ciNbr=document.hidden_simple_navigation_form._ci_nbr.value;}
		if(typeof(qrName)=="undefined") {qrName=document.hidden_simple_navigation_form.qr_name.value;}
		if(typeof(industry)=="undefined") {industry=document.hidden_simple_navigation_form._industry.value;}
		reg = document.hidden_simple_navigation_form.reg.value;
		if(reg==null || reg=="" || reg.indexOf(':' + ciNbr)==-1) {
			if(qrName !="" && ciNbr !="") reg = qrName + ":" + ciNbr;	
		}
		document.hidden_simple_navigation_form._submenuId.value = submenuId;
		document.hidden_simple_navigation_form.ds_name.value = dsName;
		document.hidden_simple_navigation_form._ci_nbr.value = ciNbr;
		document.hidden_simple_navigation_form.qr_name.value = qrName;
		document.hidden_simple_navigation_form.reg.value = reg;
		document.hidden_simple_navigation_form._industry.value = industry;
		document.hidden_simple_navigation_form.submit();		
	}
	else if (document.hidden_navigation_form) {
	    if (servlet != '') {
			document.hidden_navigation_form.action = "/servlet/" + servlet;
		}
		if(typeof(submenuId)=="undefined"){ submenuId=document.hidden_navigation_form._submenuId.value;}
		if(typeof(dsName)=="undefined") {dsName=document.hidden_navigation_form.ds_name.value;}
		if(typeof(ciNbr)=="undefined") {ciNbr=document.hidden_navigation_form._ci_nbr.value;}
		if(typeof(qrName)=="undefined") {qrName=document.hidden_navigation_form.qr_name.value;}	
		if(typeof(industry)=="undefined") {industry=document.hidden_simple_navigation_form._industry.value;}
		reg = document.hidden_navigation_form.reg.value;
		if(reg==null || reg=="" || reg.indexOf(':' + ciNbr)==-1) {
			if(qrName !="" && ciNbr !="") reg = qrName + ":" + ciNbr;	
		}
	
		document.hidden_navigation_form.geo_id.value = geoId;
		document.hidden_navigation_form._submenuId.value = submenuId;
		document.hidden_navigation_form.ds_name.value = dsName;
		document.hidden_navigation_form._ci_nbr.value = ciNbr;
		document.hidden_navigation_form.qr_name.value = qrName;
		document.hidden_navigation_form.reg.value = reg;
		document.hidden_navigation_form._industry.value = industry;
		document.hidden_navigation_form.submit();
		
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/" + servlet + "?geo_id=" + geoId + "&_submenuId=" + submenuId + "&ds_name=" + dsName + "&_ci_nbr=" + ciNbr + "&qr_name=" + qrName + "&_lang=" + saffLangDir + "&_sse=on");
	}
}



//
// Global Tools -- public APIs
//
// gtShowMainPage() should call gotoMainPage() after integration into AFF R9.2.
// function gtShowMainPage()	{ gotoMainPage(saffLangDir, ''); }
function gtShowMainPage()	{ saffShowPage("/home/saff/main.html?_lang=" + saffLangDir); }
function gtShowSearch()		{ saffShowPage("/servlet/AFFAdvSearchGeneralServlet?_lang=" + saffLangDir + "&_sse=on"); }
function gtOpenFeedback()	{ openFeedback(saffLangDir + "/"); }
function gtOpenFAQ()		{ openFAQ(); }
function gtOpenGlossary()	{ openEPSS(saffLangDir, "glossary_a"); }
function gtShowSiteMap()	{ showSAFFInfo(null, "gt1_site_map"); }
function gtOpenHelp()		{ openEPSS(saffLangDir); }


//
// Global Navigation -- public APIs
//
function gnShowPopulation(geoId,submenuId){ showServletPage(geoId, "SAFFPopulation", submenuId); }
function gnShowIteratedFactSheet(geoId,submenuId,dsName)	{ showServletPage(geoId, "SAFFFactsCharIteration", submenuId, dsName); }
function gnShowIteratedFactSheet2(geoId,submenuId,dsName,ciNbr,qrName) { showServletPage(geoId, "SAFFIteratedFacts", submenuId, dsName, ciNbr,qrName);}
function gnShowFactSheet(geoId,submenuId)	{ showServletPage(geoId, "ACSSAFFFacts","factsheet_1"); }
function gnShowPeople(geoId,submenuId)	{ showServletPage(geoId, "ACSSAFFPeople",submenuId); }
function gnShowHousing(geoId,submenuId)	{ showServletPage(geoId, "ACSSAFFHousing",submenuId); }
function gnShowBusiness(geoId,submenuId)	{ showServletPage(geoId, "SAFFBusiness",submenuId,'','','',''); }
function gnShowEconFactSheet(geoId,submenuId,industry)	{ showServletPage(geoId, "SAFFEconFacts",submenuId,'','','',industry); }
function gnShowEconIndustrySearch(geoId,submenuId)	{ showServletPage(geoId, "SAFFSelectIndustry",submenuId); }
function gnShowCensusesAndSurveys(geoId,submenuId) { showSAFFInfo(geoId, "censuses_surveys",submenuId); }
function gnShowTablesMaps(geoId,submenuId) { showSAFFInfo(geoId, "gn6a_tables_maps",submenuId); }
function gnShowDataSets(geoId,submenuId,programId)	{ suShowProgramDataSets(programId,submenuId); }
function gnShowMaps(geoId,submenuId)		{ showSAFFInfo(geoId, "thematicmaps",submenuId); }
function gnShowReferenceShelf(geoId,submenuId) { showSAFFInfo(geoId, "gn8_refshelf",submenuId); }
function gnShowTools(geoId,submenuId)		{ showSAFFInfo(geoId, "gn9_tools",submenuId); }

function gnShowSearchByTerm(geoId) {
	var searchterms = document.adv_search_form.searchterms.value;
	if (searchterms == "") {
		alert("Enter a search term. Click Go.");
		document.adv_search_form.searchterms.focus();
	}
	else if (searchterms == "*") {
		alert("Enter at least a word or a partial word. Click Go.");
		document.adv_search_form.searchterms.focus();
	}
	else if (document.adv_search_form.searchby[0].checked) {
		saffShowPage("/servlet/AdvSearchByKeywordServlet?_command=getResults&_keyword="
					+ escape(searchterms)
					+ "&_method=set&_programYear=&_synonyms=no&_lang=" + saffLangDir + "&_sse=on");
	}
	else {
		saffShowPage("/servlet/AdvSearchByPlacenameServlet?_command=getPlacenames&_keyword="
					+ escape(searchterms)
					+ "&_method=set&_programYear=&_placename=&_geoBucketId=&_treeId=&_state=&_lang=" + saffLangDir + "&_sse=on");
	}
}

function gnShowSearchByAddress(geoId) {
	saffShowPage("/servlet/AGSGeoAddressServlet?_programYear=50&_treeId=420&_lang=" + saffLangDir + "&_sse=on");
}


//
// Topic Pages -- public APIs
//
function tpShowBasicCounts(geoId)		{ showSAFFInfo(geoId, "tp1_basic_counts"); }
function tpShowAging(geoId)				{ showSAFFInfo(geoId, "tp2_aging"); }
function tpShowGender(geoId)			{ showSAFFInfo(geoId, "tp3_gender"); }
function tpShowDisability(geoId)		{ showSAFFInfo(geoId, "tp4_disability"); }
function tpShowEducation(geoId)			{ showSAFFInfo(geoId, "tp5_education"); }
function tpShowIncomeEmployment(geoId)	{ showSAFFInfo(geoId, "tp6_income_employment"); }
function tpShowOriginsLanguage(geoId)	{ showSAFFInfo(geoId, "tp7_origins_language"); }
function tpShowPoverty(geoId)			{ showSAFFInfo(geoId, "tp8_poverty"); }
function tpShowRaceEthnicity(geoId)		{ showSAFFInfo(geoId, "tp9_race_ethnicity"); }
function tpShowRelationships(geoId)		{ showSAFFInfo(geoId, "tp10_relationships"); }
function tpShowTransportation(geoId)	{ showSAFFInfo(geoId, "tp11_transportation"); }
function tpShowVeterans(geoId)			{ showSAFFInfo(geoId, "tp12_veterans"); }
function tpShowHousingPhysical(geoId)	{ showSAFFInfo(geoId, "tp13_housing_physical"); }
function tpShowHousingFinancial(geoId)	{ showSAFFInfo(geoId, "tp14_housing_financial"); }
function tpShowForeignTrade(geoId)		{ showSAFFInfo(geoId, "tp15_foreign_trade"); }
function tpShowGovernment(geoId)		{ showSAFFInfo(geoId, "tp16_government"); }
function tpShowBusinessIndustry(geoId)	{ showSAFFInfo(geoId, "tp17_business_industry"); }


//
// Splash Pages -- public APIs
//
function spShowACS(geoId)				{ showSAFFInfo(geoId, "sp1_acs"); }
function spShowEconomic(geoId)			{ showSAFFInfo(geoId, "sp2_economic"); }
function spShowPopEst(geoId)			{ showSAFFInfo(geoId, "sp3_pop_est"); }
function spShowDecennial(geoId)			{ showSAFFInfo(geoId, "sp4_decennial"); }
function spShowDecennialSF1(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_sf1"); }
function spShowDecennialSF2(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_sf2"); }
function spShowDecennialSF3(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_sf3"); }
function spShowDecennialSF4(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_sf4"); }
function spShowDecennialCD109(geoId)	{ showSAFFInfo(geoId, "sp4_decennial_cd109"); }
function spShowDecennialCD110(geoId)	{ showSAFFInfo(geoId, "sp4_decennial_cd110"); }
function spShowDecennialPL(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_pl"); }
function spShowDecennialAIAN(geoId)		{ showSAFFInfo(geoId, "sp4_decennial_aian"); }
function spShowIslandAreas(geoId)		{ showSAFFInfo(geoId, "sp5_island_areas"); }
function spShowGov(geoId)				{ showSAFFInfo(geoId, "sp6_gov"); }
function spShowPopProj(geoId)			{ showSAFFInfo(geoId, "sp7_pop_proj"); }
function spShowTableMapFormats(geoId)	{ showSAFFInfo(geoId, "sp8_table_map_formats"); }

//
// Supporting Pages -- public APIs
//
function suShowWhatsNew()				{ showSAFFInfo(null, "su1_whats_new"); }
function suShowNewFeatures()			{ showSAFFInfo(null, "su2_new_features"); }
function suShowNewFeatures1003()		{ showSAFFInfo(null, "su2_new_features_1003"); }
function suShowInTheSpotlight()			{ showSAFFInfo(null, "su3_spotlight"); }
function suShowReleaseSchedule()		{ saffShowPage("http://www.census.gov/population/www/censusdata/c2kproducts.html"); }
function suShowPuertoRico()				{ gotoMainPage("es", ''); }
function suShowKidsCorner()				{ saffShowPage("/home/en/kids/kids.html"); }
function suShowAIAN()					{ saffShowPage("/home/aian/index.html"); }
function suShowConfidentiality()		{ showSAFFInfo(null, "su5_confidentiality"); }
function suShowCompatibility()			{ openEPSS(saffLangDir, "browser_note"); }
function suShowBasicFacts()				{ saffShowPage("/servlet/BasicFactsServlet?_lang=en&_classic="); } // old main page
function suShowDataSet(dsName) { 
	if (document.breadcrumbDataSetsHref) {
		document.breadcrumbDataSetsHref.action = "/servlet/DatasetMainPageServlet";
		document.breadcrumbDataSetsHref._ds_name.value = dsName;
		document.breadcrumbDataSetsHref.submit();
	}
	else {
		DEBUG_ALERT("suShowDataSets using direct method instead of embeded form");
		saffShowPage("/servlet/DatasetMainPageServlet?_ds_name=" + dsName + "&_lang=en");
	}
}
function suShowProgramDataSets(pgm,submenuId) {
    if(typeof(pgm)=="undefined") { pgm="DEC";}
    if(typeof(submenuId)=="undefined"){ submenuId="";}
	if (document.breadcrumbProgramHref) {
		document.breadcrumbProgramHref.action = "/servlet/DatasetMainPageServlet";
		document.breadcrumbProgramHref._program.value = pgm;
		document.breadcrumbProgramHref.submit();
	}
	else {
		DEBUG_ALERT("suShowProgrmaDataSets using direct method instead of embeded form");
		saffShowPage("/servlet/DatasetMainPageServlet?_program=" + pgm + "&_lang=en");
	}
}


//
// Functions stored in metadata or maps to show in pop-up windows
//

//function openGlossary(lang, term) { <-- as spec'ed, but currently metadata is not returning language
function openGlossary(term) {
	if (!term || term == "") {
		term = "glossary_a.html"
	}
	openPopUp("epsswin", "/home/" + saffLangDir + "/epss/" + term);
}

function openHelp(lang, term) {
	if (!term || term == "") {
		term = "help.html"
	}
	openPopUp("helpwin", "/home/" + saffLangDir + "/epss/" + term);
}

// Build Reference Map URL
function getRMURL(geoId, bucketId, treeId) {
	if (!treeId) {
		treeId = '335';
	}
	if (!bucketId) {
		bucketId = '45';
	}
	return "/servlet/MapItDrawServlet?geo_id=" + geoId + "&_bucket_id=" + bucketId + "&tree_id=" + treeId + "&context=saff&_lang=en&_sse=on";
}

function openRM(geoId, bucketId, treeId) 	{ openPopUp("identify", getRMURL(geoId, bucketId, treeId)); }


//
// Functions to invoke AFF result pages via deep-linking.
//

function showDT(ds, geoId, table) {
	geoId = saffGetGeoId(geoId);
	if (document.hidden_dt_form) {
		document.hidden_dt_form.action = "/servlet/DTTable";
		document.hidden_dt_form.ds_name.value = ds;
		document.hidden_dt_form.geo_id.value = geoId;
		document.hidden_dt_form.mt_name.value = table;
		document.hidden_dt_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/DTTable?ds_name=" + ds + "&geo_id=" + geoId + "&mt_name=" + table + "&_sse=on&_lang=en");
	}
}

function showGCT(ds, geoId,boxhead, format) {
	geoId = saffGetGeoId(geoId);
	if (document.hidden_gct_form) {
		document.hidden_gct_form.action = "/servlet/GCTTable";
		document.hidden_gct_form.ds_name.value = ds;
		document.hidden_gct_form.geo_id.value = geoId;
		document.hidden_gct_form._box_head_nbr.value = boxhead;
		document.hidden_gct_form.format.value = format;
		document.hidden_gct_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/GCTTable?ds_name=" + ds + "&geo_id=" + geoId + "&_box_head_nbr=" + boxhead + "&format=" + format + "&_sse=on");
	}
}

function showGRT(ds, geoId,boxhead, format) {
	geoId = saffGetGeoId(geoId);
	if (document.hidden_gct_form) {
		document.hidden_gct_form.action = "/servlet/GRTTable";
		document.hidden_gct_form.ds_name.value = ds;
		document.hidden_gct_form.geo_id.value = geoId;
		document.hidden_gct_form._box_head_nbr.value = boxhead;
		document.hidden_gct_form.format.value = format;
		document.hidden_gct_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/GRTTable?ds_name=" + ds + "&geo_id=" + geoId + "&_box_head_nbr=" + boxhead + "&format=" + format + "&_sse=on");
	}
}

function showQT(ds, geoId, qrName) {
	geoId = saffGetGeoId(geoId);
	// if puerto rico, and if dp2, change to dp2pr.
	if (geoId.indexOf("US72") >= 0 && qrName.indexOf("_DP2") >= 0) {
		qrName = qrName + "PR";
	}
	if (document.hidden_qt_form) {
		document.hidden_qt_form.action = "/servlet/QTTable";
		document.hidden_qt_form.ds_name.value = ds;
		document.hidden_qt_form.geo_id.value = geoId;
		document.hidden_qt_form.qr_name.value = qrName;
		document.hidden_qt_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/QTTable?ds_name=" + ds + "&geo_id=" + geoId + "&qr_name=" + qrName + "&_sse=on&_lang=en");
	}
}

function showIQT(geoId, submenuId, ds, ciNbr, qrName) {
    
	if (document.hidden_iqt_form) {
		document.hidden_iqt_form.action = "/servlet/SaffIteratedFacts";
		document.hidden_iqt_form.ds_name.value = ds;
		document.hidden_iqt_form.geo_id.value = geoId;
		document.hidden_iqt_form.qr_name.value = qrName;
		document.hidden_iqt_form._ci_nbr.value = ciNbr;
		document.hidden_iqt_form.reg.value = qrName + ":" + ciNbr;
		document.hidden_iqt_form._submenuId.value = submenuId;
		document.hidden_iqt_form.submit();
   }    
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/SaffIteratedFacts?ds_name=" + ds + "&geo_id=" + geoId + "&qr_name=" + qrName + "&ci_nbr=" + ciNbr + "&reg=" + qrName + ":" + ciNbr + "&_submenuId=" + submenuId + "&_sse=on&_lang=en");
	}	
}

function showADP(ds, geoId, qrName) {
	geoId = saffGetGeoId(geoId);

	if (document.hidden_qt_form) {
		document.hidden_qt_form.action = "/servlet/ADPTable";
		document.hidden_qt_form.ds_name.value = ds;
		document.hidden_qt_form.geo_id.value = geoId;
		document.hidden_qt_form.qr_name.value = qrName;
		document.hidden_qt_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/ADPTable?ds_name=" + ds + "&geo_id=" + geoId + "&qr_name=" + qrName + "&_sse=on&_lang=en");
	}
}

function showMYP(ds, geoId, qrName) {
	geoId = saffGetGeoId(geoId);

	if (document.hidden_qt_form) {
		document.hidden_qt_form.action = "/servlet/MYPTable";
		document.hidden_qt_form.ds_name.value = ds;
		document.hidden_qt_form.geo_id.value = geoId;
		document.hidden_qt_form.qr_name.value = qrName;
		document.hidden_qt_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/MYPTable?ds_name=" + ds + "&geo_id=" + geoId + "&qr_name=" + qrName + "&_sse=on&_lang=en");
	}
}

function showTM(ds, geoId, byGsl, mapId) {
	geoId = saffGetGeoId(geoId);
	if (document.hidden_tm_form) {
		document.hidden_tm_form.action = "/servlet/ThematicMapFramesetServlet";
		document.hidden_tm_form.ds_name.value = ds;
		document.hidden_tm_form.geo_id.value = geoId;
		document.hidden_tm_form._dBy.value = byGsl;
		document.hidden_tm_form.tm_name.value = mapId;
		document.hidden_tm_form.submit();
	}
	else {
		DEBUG_ALERT("debug: using direct method instead of embeded form");
		saffShowPage("/servlet/ThematicMapFramesetServlet?ds_name=" + ds + "&geo_id=" + geoId + "&_dBy=" + byGsl + "&tm_name=" + mapId + "&_MapEvent=displayBy&_sse=on");
	}
}

function ShowTM(ds, geoId, byGsl, mapId) { // Fact Sheet Interface
	showTM(ds, geoId, byGsl, mapId);
}

function showRM(geoId, bucketId, treeId) {
	saffShowPage(getRMURL(geoId, bucketId, treeId));
}

// utility functions
function isEnterKey(event) {
	return ns4 ? (event.which == 13) : (event.keyCode == 13);
}
