function search(url, error) 
{
	var topSearch = document.getElementById('search_phrase');
	if (topSearch && trim(topSearch.value) != '') {
		window.location = url + topSearch.value;
	} else {
		var contentSearch = document.getElementById('content_search');
		if (contentSearch && trim(contentSearch.value) != '') {
			window.location = url + contentSearch.value;
		} else {
			alert(error);
		}
	}
}

function checkEnter(event, url, error)
{    
    if (event.keyCode==13) search(url, error);
}

function trim(text)
{
	return (text || "").replace( /^\s+|\s+$/g, "" );
}