// trim function
  	String.prototype.trim = function()
  	{
  	  return( this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
	}


function CheckInput()
{
	var f = document.SearchForm;
	if ( f.q.value.length == 0 || f.q.value.trim().length == 0 )
	{
		alert("Please enter a search word!");
		f.q.focus();
		return;
	}
	if ( f.SearchMethod[0].checked ) // ir part search
	{
		document.location.href = "http://ec.irf.com/v6/en/US/adirect/ir?cmd=catSearchFrame&domSendTo=byID&domProductQueryName=" + f.q.value.trim();

	}
	else    // google search
	{
		document.location.href ="http://search.irf.com/search?&btnG=Search+IRF.COM&site=IRF_search&client=IRF_search&proxystylesheet=IRF_search&output=xml_no_dtd&q=" + f.q.value.trim();
	}

	return;
}
