function findCategory(selectObject) {
	var s;
	
	s = clearSearch(location.href);
	s += '&id=' + searchArticleID.toString();
	s += '&cid=' + categoryID[selectObject.selectedIndex - 1];
	s += '&ad1=' + ad1Index.toString();
	s += '&ad2=' + ad2Index.toString();

	location = s;
}

function findExhibitor(searchField) {
	var s;
	
	s = trim(searchField.value);
	if (s.length > 0 && s != 'Type exhibitor or line name here') {
		s = clearSearch(location.href);
		s += '&id=' + searchArticleID.toString();
		s += '&exh=' + escape(searchField.value);
		s += '&ad1=' + ad1Index.toString();
		s += '&ad2=' + ad2Index.toString();
		
		location = s;
	}
}

function findLine(searchField) {
	var s;
	
	s = trim(searchField.value);
	if (s.length > 0 && s != 'Type exhibitor or line name here') {
		s = clearSearch(location.href);
		s += '&id=' + searchArticleID.toString();
		s += '&line=' + escape(searchField.value);
		s += '&ad1=' + ad1Index.toString();
		s += '&ad2=' + ad2Index.toString();
		
		location = s;
	}
}

function clearField(searchField) {
	searchField.value = '';
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
