//This function is used to open a link in a new browser windowfunction NewWindow(mypage, myname, w, h, scroll) {var winl = (screen.width - w) / 2;var wint = (screen.height - h) / 2;winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'win = window.open(mypage, myname, winprops)if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }}//var jdebug = false;function getCookie(name) {var ret = new String('');  var dc = document.cookie;  if (dc == null) {     	return '' }	//alert(dc)	//alert(dc);  var prefix = name + "=";  var begin = dc.indexOf("; " + prefix);  if (begin == -1) {    begin = dc.indexOf(prefix);    if (begin != 0) return '';  } else    begin += 2;  var end = document.cookie.indexOf(";", begin);   if (end == -1)    end = dc.length;        //alert(unescape(dc.substring(begin + prefix.length, end)));  return unescape(dc.substring(begin + prefix.length, end));}//function doSubmit() {	// Retrieve default separator for query elements	var QuerySeparator = " and";	var matchType = document.forms[0].MatchType; // Radio choices	if ( matchType != null ) {		// Loop through radio choices -- determine which one was selected		for (var i=0; i < matchType.length; i++) {			if ( matchType[i].checked ) {				if ( matchType[i].value == "All" ) {					QuerySeparator = " and ";				} else if ( matchType[i].value == "Any" ) {					QuerySeparator = " or ";								} else if ( matchType[i].value == "Exact" ) {					QuerySeparator = "";								}							}		}	}		// Retrieve Query String	var QueryVar = new String(document.forms[0].Query.value);		// added per Help Desk request - 09/27/05 Tom Graham	// will convert any commas entered into the search field into 'or' statements	QueryVar = replaceSubstring(QueryVar, ',', ' or ' );		QueryVar = replaceSubstring(QueryVar.toLowerCase(), 'm&a', 'Mergers and Acquisitions');	QueryVar = replaceSubstring(QueryVar.toLowerCase(), 'm & a', 'Mergers and Acquisitions');	if (QueryVar.indexOf("\"", 0) == -1) { //only do this if the search string is not in quotes -- exact phrase		while (QueryVar.indexOf("&", 0) !== -1) {			QueryVar = QueryVar.replace("&", "and");  //otherwise "&" will throw an domino error  [updated by Chris Crompton 11/1/2003]			}		}	if (QueryVar == "") {		if ( document.forms[0].subQuery != null ){			QueryVar = document.forms[0].subQuery.value;			if ( QueryVar == "" ){				alert("Search String cannot be Empty. Please enter a Query to Search.");				return false;			}		}	}		var QueryValue = QueryVar.toLowerCase();		// Remove extra spaces -- match one or more spaces and replace it with one space		QueryValue = QueryValue.replace(/\s+/g, " ");// alert( QueryValue + "-end" );/*		//If the Domino Key word FIELD is entered add Quotes to avoid an error		var pos = QueryValue.indexOf( "field " );		if ( pos > -1 ){			if ( pos == 0 ){				QueryValue = '"' + QueryValue.substring(0, 5) + '"' + QueryValue.substring(6);			} else {				QueryValue = QueryValue.substring(0, pos) + '"' + QueryValue.substring(pos, pos + 5) + '"' + QueryValue.substring(pos + 6);			}		}		var pos = QueryValue.indexOf( " field" );		if ( pos > -1 ){			QueryValue = QueryValue.substring(0, pos + 1) + '"' + QueryValue.substring(pos + 1) + '"';					}				if ( QueryValue == "field" ){			QueryValue = '"' + QueryValue + '"';		}*/		// Match first space outside quotes OR quoted expressions		// --- break string into separate elements, but respect quotes		// --- also retrieve last element if not inside quotes		// chris crompton added (\([^\(\)]*\)) as a regular expression to allow for parenthesis to delimit phrases		//QueryArrayRaw = QueryValue.match(/([^"\s]*\s)|("[^"]*")|([^"\s]*$)/g);		QueryArrayRaw = QueryValue.match(/([^"\s\(\)]*(\))*\s)|(\(+"[^"]*"\)*)|(\(+[^"\s]*(\s|$))|("[^"]*"(\))*)|([^"\s]*(\))*$)/g);//  alert( QueryArrayRaw.toString() + "-end" );//alert(window.navigator.remoteAddr);		// Build Query array by removing blank elements		//    and eliminating trailing spaces		QueryArray = new Array();		var count = 0;		//if (jdebug) alert('TESTING INTERNALLY');		for (var i=0; i < QueryArrayRaw.length; i++) {			//if (jdebug) alert(QueryArrayRaw[i]);			// Remove spaces at the end of each element			var element = QueryArrayRaw[i].replace(/\s$/, "");			// Remove blank elements = Add non-blank elements only			if ( element != "" ) {				QueryArray[count] = element;				count++;			}		}// alert( QueryArray.toString() + "-end" );		// example: c    or    b   "a or b "   f   "  c   d   "                      		var submitflag = 0;		for (var i=0; i < QueryArray.length; i++) {			if  (( QueryArray[i] == 'and'  || QueryArray[i] == 'or'  || QueryArray[i] == 'not' ) &&  (QueryArray.length == 1)) {				alert('Please enter a valid Query to Search.');				submitflag = 1;				return false;			}						if (( QueryArray[i] == 'and'  || QueryArray[i] == 'or'  || QueryArray[i] == 'not' ) && ( i+1 == QueryArray.length )) {				alert('Please enter a valid Query text After the Boolean Operator');				submitflag = 1;				return false;			}			if (( QueryArray[i] == 'and'  || QueryArray[i] == 'or'  || QueryArray[i] == 'not' ) && (i == 0) && ( QueryArray.length > 0) ) {				alert('Please enter a valid Query text Before the Boolean Operator');				submitflag = 1;								return false;			}			// test for multiple conjunctions together			//if ((i>0) &&  ( QueryArray[i] == 'and'  || QueryArray[i] == 'or'  || QueryArray[i] == 'not' ) &&  ( QueryArray[i-1] == 'and'  || QueryArray[i-1] == 'or'  || QueryArray[i-1] == 'not' ) ) {			if ((i>0) &&  ( QueryArray[i] == 'and'  || QueryArray[i] == 'or' ) &&  ( QueryArray[i-1] == 'and'  || QueryArray[i-1] == 'or' ) ) {				alert('There are two Boolean Operators listed together in your query.  Please remove one.');				submitflag = 1;								return false;			}					// append an "or" to joined terms if one is not present			if ((i>0) &&  !( QueryArray[i] == 'and'  || QueryArray[i] == 'or'  || QueryArray[i] == 'not' ) &&  !( QueryArray[i-1] == 'and'  || QueryArray[i-1] == 'or'  || QueryArray[i-1] == 'not' ) ) {				QueryArray[i-1] = QueryArray[i-1] + QuerySeparator;			}		}		if (	submitflag == 0 ) {			// reconstruct query string including extra "ands" if needed	         var queryString = '';			for (var i=0; i < QueryArray.length; i++) {                    if (queryString == '') {                    	queryString = QueryArray[i];                    }                    else if (queryString != ' ') {	 			     queryString = queryString + ' ' + QueryArray[i];			     }			}			var itemCatalog = document.forms[0].SearchCatalog.options[document.forms[0].SearchCatalog.selectedIndex].value;			if ((userRoles.indexOf("[DB-Pharm]", 0) >=0) &&					 (getCookie('pharmafilter') == 'T') &&					 itemCatalog == 'DB') {			queryString = 'Field ph=T and ' + queryString;			}			var searchForm;			var searchParams;			//remove quotes from querystring			queryString = replaceSubstring(queryString, '\"', '');						var uspace = getCookie('uspace');			if (uspace != '') uspace = '&uspace=' + uspace;						 			document.forms[0].Query.value = queryString; 			 			if (itemCatalog == "All" || itemCatalog == 'ALL') { 				searchForm = 'SearchALL!OpenForm'; 				searchParams = ''; 				itemCatalog = ''; 			}else{ 				searchForm = 'SearchNew' + '!SearchView'; 				searchParams = '&SearchWV=1&SearchOrder=1&Start=1&Count=10' + uspace; 				if (itemCatalog=='GBC') { 				itemCatalog = ' and ((field ItemCatalog=' + itemCatalog + ') OR ' + 				'(field documentnumber contains '+ itemCatalog + ')' +				'OR (field sourcecode=ibe) OR (field itemtype=mr))'; 				}else{				itemCatalog = ' and (field ItemCatalog=' + itemCatalog + ')';				}			}						if ( noSubmit ) {						var site = 'http://www3.best-in-class.com'					var url = thisDB + "/" + searchForm + '&Query=(' + queryString + ')' +				itemCatalog + searchParams + '&AQ=' + QueryVar;				if (itemCatalog == '') { 					url += '&ItemCatalog=ALL'; 				}				window.location.href = url;					//alert(url)				//thisisatest			} else {				document.forms[0].submit();				return true;				}		}}//