/*
This function is used to trim all leading and trailing spaces in a string.
This function takes a string as input and returns the trimmed string.
At present this function uses substr() method, on the assumption that 
first argument to substr() will never be negative and 
second argument will never be greater than str.length
*/
function trim(str){
	var start= str.length, end = 0, ch, i;
	for(i=0;i<str.length;i++) {
		ch = str.charAt(i);
		if(ch !=' '){
			start = i;
			break;
		}
	}
	for(i=str.length-1;i>=0;i--) {
		ch = str.charAt(i);
		if(ch !=' '){
			end = i;
			break;
		}
	}
	if (start<=end)
		return str.substr(start,end-start+1);
	else
		return "";
}


// This function is copied from wmpagelts.js
// for Tsunami website
function submitCustomSearchForm(type)
{
   document.customSearchPanelForm.request.value='search';
   document.customSearchPanelForm.excell.value='';
   document.customSearchPanelForm.pageno.value='1';
   document.customSearchPanelForm.selection.value=type;
   // it should be set to empty string otherwise
   // while doing a customn search the Match All and Match Any
   // in normal search try to downlod the results to sql or xls
   //document.customSearchPanelForm.req.value=""
                                                                                                                    
   // Modified by Raghavan - 14-09-2004. While calling "Dump" the
   // parameter "req" should not be null instead it should
   // be "displayResults/download/jpivot".
   // So, setting the value of hidden variable
   // 'req.value='displayResults'
   document.customSearchPanelForm.req.value="displayResults";
   // End - Raghavan 14-09-2004
                                                                                                                    
   document.customSearchPanelForm.submit();
}

