function openDbRelativeURL( url, target ){
	//Check we have a target window;
	target = (target == null ) ? window : target;
	//Work out the path of the database;
	path = location.pathname.split('.nsf')[0] + '.nsf/';
	target.location.href = path + url;
}

function replaceSubString( originalString , searchForString , replaceWithString ){
	var objRegExp = eval( "/" + searchForString + "/g" );
	return ( originalString.replace( objRegExp , replaceWithString ) );
}

function doSearch ( s, dbIDs ) {
	var regExp1 = /\bfield\b/;
	var regExp2 = /[(,),\{,\},<,>,!,\[,\]]/;
	var str = s.value;
	if ( str == "" ){
		alert("Please enter one or more search terms in the search box.");
		s.focus();
	} else {
		alert("in here");

		if ( typeof regExp1.source != 'undefined' ) { //supports regular expression testing
			if ( regExp1.test( str ) || regExp2.test( str ) ){
				var alrt = "The following terms and punctuation can not be used in your search query:"; 
				alrt += "\n\nthe reserved word 'field'"
				alrt += "\nthe characters [ ] { } () <> ! , (comma) ;"
				s.focus();
				return alert( alrt );
			}
			//openDbRelativeURL("Search?SearchView&Query=" + escape( str ) + "&start=1&count=10");
			//10 is max docs per page
			//~1 is sorting by relevance
			//alert ("/web14/dvc/searchdb.nsf/search?openagent&"+replaceSubString(dbIDs, 'n', ',')+"^"+replaceSubString(str, ' ', '&') +"%1%10~1");
			top.location.href="/web14/dvc/searchdb.nsf/search?openagent&"+replaceSubString(dbIDs, 'n', ',')+"^"+replaceSubString(str, ' ', '&') +"%1%10~1";
		}
	}
}

function goLink() {
	top.location.href = document.navigationForm.siteSelect.options[document.navigationForm.siteSelect.selectedIndex].value
}
