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/';
	url2 = path + url;
	target.location.href = url2;
}
function AdvancedSearch(s, url, n, sr) {
	var regExp1 = /\bfield\b/;
	var str = s.value; 
	var path = url.value;
	var noResults = n.value;
	var searchResults = sr.value
		
	if ( str == "" ){ 
		alert("Please be sure to enter something to search for.");
		s.focus();
	} 
	else { 
		if ( typeof regExp1.source != 'undefined' ) 
			//var srcVal = 'http://172.31.10.21/' + path + '/QAdvancedSearch_direct?OpenAgent&Query=' + escape( str ) + '&start=1&SearchOrder=4&NoResults=' + noResults + '&SearchResults=' + searchResults + '&language=' + document.Notes.QueryLanguage.value;
			//window.document.getElementById('avframe').src =  srcVal;
			openSearchResultsWindow(document.Notes.ProtocolSetting.value + path + '/DlgSearchResults?readForm&Query=' + escape( str ) + '&start=1&SearchOrder=4&NoResults=' + noResults + '&SearchResults=' + searchResults + '&language=' + document.Notes.QueryLanguage.value );
		}
	return false;
}
function doSearch ( s ) {
	var regExp1 = /\bfield\b/;
	var str = s.value; 
	
	if ( str == "" ){ 
		alert("Please be sure to enter something to search for.");
		s.focus();
	} 
	else { 
		if ( typeof regExp1.source != 'undefined' ) 
			openDbRelativeURL("webSearchView?SearchView&Query=" + escape( str ) + "&start=1&SearchOrder=4&language=" + document.Notes.QueryLanguage.value);
	}
	return false;
}
function enteredSearch(event, button) {
	if (navigator.appName.indexOf('Microsoft') >= 0) {
		if (window.event && window.event.keyCode == 13)
			button.click();
		else
			return true;
	} else if (event && event.which == 13) {
		button.click();
	} else {
		return true;
	}
}
function openSearchResultsWindow(url) {
	var isMinNS4=(navigator.appName.indexOf("Netscape")>=0&&parseFloat(navigator.appVersion)>=4)?1:0;
	var isMinIE4=(document.all)?1:0;
		
	var screenwidth = getFullWW();
	var screenheight = getFullWH();
		
	var props = 'width=500px, height=500px, toolbar=no,location=no,directories=no,menubar=no,status=no, scrollbars=yes, resizable=yes ';
	if (isMinNS4) props += ',screenX=' + (screenwidth/2 - 250) + ',screenY=' + (screenheight/2 - 250);
	if (isMinIE4) props += ',left=' + (screenwidth/2 - 250) + ',top=' + (screenheight/2 - 250);
	var searchWin = window.open(url, 'popupsearchresults', props);
	searchWin.focus();
}

