


// Starts "trim" function
function trim(inputString) {
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { 
	  retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   
   return retValue; 
} // Ends the "trim" function

//function for search
function sSearch() 
{
	var search = trim(document.form1.search.value);
	if (search.length >0)
	{
		//window.location.href="/searchresult.php?query=" + search;
		document.form1.action="http://www.mid-day.com/searchresult.php?query=" + search;
		return true;
	}else 
	{
		alert("Please enter search string.");
		return false;
	}
	
}
