<!--
// list of excluded search words
var aExclude = new Array("terrorist","terror");

/************************************************************
* function: 	fixSearch()
* Author: 		Dustin Stickle
* Created: 		June 11, 2002
* Description:	takes a search string and reformats it to
*				remove excluded words and force a keyword
*			 	or keyphrase search in the Excite search.
* Updated:		
*************************************************************/
function fixSearch()
{
	var oSearch = document.forms[0].search;
	var sSearch = oSearch.value;
	var re = /"/ig; //regular expression for "
	var re2 = /'/ig; //regular expression for '
	
	var aOccur = sSearch.match(re);
	// replace all occurances of "
	if (aOccur != '' && aOccur != null)
	{
		for (var i=0; i<aOccur.length; i++)
		{
			sSearch=sSearch.replace('"','');
		}
	}
	
	var aOccur2 = sSearch.match(re2);
	// replace all occurances of '
	if (aOccur2 != '' && aOccur2 != null)
	{
		for (var i=0; i<aOccur2.length; i++)
		{
			sSearch=sSearch.replace("'","");
		}
	}
	
	// split the phrases concatenated with +
	var aWords = sSearch.split('+');
	for (var i=0;i<aExclude.length;i++)
	{
		for (var j=0;j<aWords.length;j++)
		{
			aWords[j]=aWords[j].replace(aExclude[i],"");
		}
	}
	
	// contain phrases in double quotes and concatenate them
	oSearch.value='';
	for (var j=0;j<aWords.length;j++)
	{
		aWords[j] = trim(aWords[j]);
		if (aWords[j] != '' && j != aWords.length-1 && aWords[j+1] != '')
		{
			oSearch.value+='"'+aWords[j]+'"+';
		}
		else if (aWords[j] != '')
		{
			oSearch.value+='"'+aWords[j]+'"';			
		}
	}
	
	// submit the form with the updated values
	document.forms[0].submit();
	return false;
}

function netscapeKeyPress(e) 
{
    if (e.which == 13)
	{
		fixSearch();
	}
}

function microsoftKeyPress()
{
    if (window.event.keyCode == 13)
	{
    	fixSearch();
	}
}

if (navigator.appName == 'Netscape')
{
    window.captureEvents(Event.KEYPRESS);
    window.onKeyPress = netscapeKeyPress;
}

function rtrim(argvalue) {

  while (1) {
    if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
      break;
    argvalue = argvalue.substring(0, argvalue.length - 1);
  }

  return argvalue;
}

function ltrim(argvalue) {

  while (1) {
    if (argvalue.substring(0, 1) != " ")
      break;
    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}

function trim(argvalue) {
  var tmpstr = ltrim(argvalue);

  return rtrim(tmpstr);

}

//-->