function replaceQuote(name){
var tempQuery=name
userQuery = "";

for (i = 0; i < tempQuery.length; i++)
  if ((tempQuery.charAt(i)=='%') &&
     (tempQuery.charAt(i+1)=='2') &&
     (tempQuery.charAt(i+2)=='2'))
       {userQuery = userQuery + '&quot;';
        i=i+2;
       }
  else
       {if (tempQuery.charAt(i)=="+")
	     userQuery = userQuery + " "
		else
		 userQuery = userQuery + tempQuery.charAt(i);
       }

userQuery=unescape(userQuery);
stripQts2(userQuery);
document.write(userQuery);
}

function trim(psText) {
	psText = psText.replace(/^[\s]+/g,"");
	psText = psText.replace(/[\s]+$/g,"");
	return psText;
}

function booleanOperator(txt) {
  if ((txt=='and') || (txt=='or') || (txt=='not') || (txt=='within') || (txt=='near') || (txt=='atleast'))
    return true
  else
    return false;
}

function checkSearch() { 
if (document.SearchForm.text.value == "")
  {
    window.alert("Please enter a text value to be searched for.");
    return false;
  }

/* 11/09/04 
   Parse user query for double quotes and if found don't process the query at all (even if quotes doesn't cover the entire query). 
   If no double quotes exist then do the following processing to the search text:
     add double quotes around all of the Boolean commands (or, and, not, within, atleast). This changes the Boolean operator to a search term.
     If an ANDed search then place the AND Boolean command between each term
     If an ORed search than place the OR Boolean command between each term
*/

document.SearchForm.original.value = document.SearchForm.text.value;
searchString = trim(document.SearchForm.text.value.toLowerCase());

if (searchString.indexOf('"') != -1)
  {  
    document.SearchForm.text.value = searchString;
    document.SearchForm.submit();
    return;
  }

if (searchString.indexOf(' or ') != -1)
  {  
    document.SearchForm.text.value = searchString;
    document.SearchForm.submit();
    return;
  }

newString = searchString.split(' '); 
originalString = searchString;
searchString = '';

for (i=0; i<newString.length; i++)
  if ((booleanOperator(newString[i])))
    newString[i] = '"' + newString[i] + '"';

for (i=0; i<newString.length; i++)
  {   // ANDed search
      if (searchString=='')
        searchString = newString[i]
      else
        searchString = searchString + ' and ' + newString[i];
  }


document.SearchForm.text.value = searchString;
document.SearchForm.submit();
}

function clearInput(){
	document.emailLookUp.email.value='';
}

function submitForm(){
	document.emailLookUp.submit();
}

