function Rtrim(s)
{	
	var retValue = s;
   var ch = retValue.substring(0, 1);
 
 // Check for spaces at the beginning of the string
   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
}