function buildFPUrl(arg) {
	var thisForm = document.forms['journalsearch'];
	var url = approot_path + (approot_path.indexOf('/', approot_path.length - 1) == approot_path.length - 1 ? '' : '/') + 'journals/';
	var cmd = '';
	var tabindex = '';
	var term = '';
	var title_switch = 'current';
	var search_option = 'articles';
	var journal = '';

	var rxDigit = /^\d+$/;
	var rxCollJournals = /^Coll(\d+)$/;
	var rxTitleSwitch = /^(show|hide)$/;

	if (rxDigit.test(arg)) {
		tabindex = arg;
		cmd = '';
		term = '';
		if (thisForm['title-switch'] !== undefined) {
			if (thisForm.elements['title-switch'].length !== undefined) {
				title_switch = thisForm['title-switch'][0].checked ? 'current' : 'all';
			} else {
				title_switch = thisForm['title-switch'].value == 'hide' ? 'current' : 'all';
			}
		}
		search_option = thisForm['search-option'][1].checked ? 'articles' : 'journals';
		if ((pmc_fp.has_collections === 'yes' && pmc_fp.last_tab_index == parseInt(tabindex)) || pmc_fp.last_tab_index == 0) {
			url += 'collections/'  + '?titles=' + title_switch + '&search=' + search_option;
		} else {
			if (pmc_fp.new_tab_index == parseInt(tabindex)) {
				tabindex = 'new';
			} else {
				tabindex = 't' + tabindex;
			}
			url += '?filter=' + tabindex + '&titles=' + title_switch + '&search=' + search_option;
		}
	} else if (rxCollJournals.test(arg)) {
			journal = RegExp.$1;
			if (thisForm['title-switch'] !== undefined) {
				if (thisForm.elements['title-switch'].length !== undefined) {
					title_switch = thisForm['title-switch'][0].checked ? 'current' : 'all';
				} else {
					title_switch = thisForm['title-switch'].value == 'hide' ? 'current' : 'all';
				}
			}
			search_option = thisForm['search-option'][1].checked ? 'articles' : 'journals';
			url += 'collections/' + journal + '/?search=' + search_option + '&titles=' + title_switch;
	} else {
		if (arg === 'search') {
			tabindex = '';
			cmd = 'search';
			term = thisForm['term'].value;
			search_option = thisForm['search-option'][1].checked ? 'articles' : 'journals';
			if (search_option == 'journals') {
				title_switch = 'all';
			} else {
				if (thisForm['title-switch'] !== undefined) {
					if (thisForm.elements['title-switch'].length !== undefined) {
						title_switch = thisForm['title-switch'][0].checked ? 'current' : 'all';
					} else {
						title_switch = thisForm['title-switch'].value == 'hide' ? 'current' : 'all';
					}
				}
			}
			url += '?term=' + encodeURIComponent(term) + '&titles=' + title_switch + '&search=' + search_option;
		} else if (rxTitleSwitch.test(arg)) {
			tabindex = thisForm['tabindex'].value;
			cmd = thisForm['cmd'].value;
			term = thisForm['term'].value;
			title_switch = (arg == 'show') ? 'all' : 'current';
			search_option = thisForm['search-option'][1].checked ? 'articles' : 'journals';
			if (cmd === 'search' && term.length !== 0) {
				url += '?term=' + encodeURIComponent(term) + '&titles=' + title_switch + '&search=' + search_option;
			} else if (pmc_fp.has_collections === 'yes' && pmc_fp.last_tab_index == parseInt(tabindex)) {
				url += 'collections/' + '?titles=' + title_switch + '&search=' + search_option;
			} else {
				if (pmc_fp.new_tab_index == parseInt(tabindex)) {
					tabindex = 'new';
				} else {
					tabindex = 't' + tabindex;
				}
				url += '?filter=' + tabindex + '&titles=' + title_switch + '&search=' + search_option;
			}
		}
	}

	return url;
}



