var _searchUrl;
var _searchControl;

// The event handler
function alertkey(e) {
	
	if( !e ) {
		// if the browser did not pass the event information to the
		// function, we will have to obtain it from the event register
		if( window.event ) {
			e = window.event;
		} else {
			return;
		}
	}
	
	if( typeof( e.which ) == 'number' ) {
		// NS 4, NS 6+, Mozilla 0.9+, Opera
		e = e.which;
	} else if( typeof( e.keyCode ) == 'number'  ) {
		// IE, NS 6+, Mozilla 0.9+
		e = e.keyCode;
	} else if( typeof( e.charCode ) == 'number'  ) {
		// also NS 6+, Mozilla 0.9+
		e = e.charCode;
	} else {
		// Total failure, we have no way of obtaining the key code
		return;
	}
	
	// Enter has been pressed. Do something!
	if (e == 13)
	{
		setTimeout("causeRedirect();",100);
		return false;
	}
	else
	{
		return true;
	}
}

// causes the page to redirect
function causeRedirect() {
	if (_searchControl != null) {
		var gotoLocation; 
		gotoLocation = _searchUrl
		
		if (gotoLocation.indexOf('?') != -1) 
			if (gotoLocation.substring(gotoLocation, gotoLocation.length-1, 1) != "?") gotoLocation += '&';
		else 
			gotoLocation += '?';
			
		gotoLocation += 'query=' + escape(_searchControl.value);
		
		window.location.href = gotoLocation;
	}
}

 function doclear(theText) 
{
	if (theText.value == theText.defaultValue)
	{
		theText.value = ""
	}
}
 

