function validate_search(search_form)  {

   var mylist = document.getElementById("select_type");
   var type = mylist.options[mylist.selectedIndex].value;
   var strTemp = document.getElementById("searchword").value;

   strTemp = trimAll(strTemp);
   if(strTemp.length > 0){

   }
   else
   {
   alert("Please enter a valid search keyword.");
   //document.search_form.searchword.focus();
   return false;
   }

	if (type == "google") {
		url = "http://www.google.com/search?q="+strTemp;
		window.open(url);
		return false;
	} else if (type == "yahoo") {
		url = "http://search.yahoo.com/search?p="+strTemp;
		window.open(url,"Search");
		return false;
	} else if (type == "msn") {
		url = "http://search.msn.com/results.aspx?q="+strTemp;
		window.open(url,"Search");
		return false;
	} else if (type == "mhtc") {
	   /* Check for valid keyword */

   var objRegExp= /^[a-z][-a-z0-9_ ]{0,49}$/i;
  		if(objRegExp.test(strTemp)==false)
	   {
		alert("Keyword can contain alphabets, digits, hyphen, underscore and space.");
		return false;
	   }
	   /* End of Check */
		return true;
	}

}
function trimAll( strValue ) {
 var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }

   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}