/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
**/

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

 function SubmitSearch() {
	document.SearchForm.q.value = trim(document.SearchForm.SearchText.value);
	window.event.returnValue = false;
	if (!document.SearchForm.q.value=='')
		document.SearchForm.submit();
	return false;
}

function SubmitSearchwtEnter(e)	{
	if (!e) var e = window.event;

	if ((e.keyCode) && (e.keyCode == 13))
		SubmitSearch();
	else if ((e.which) && (e.which == 13))
		SubmitSearch();
	else return;
}
