//this function is designed to check a text field for empty spaces. The normal check (if blahblah.value=="") 
//does not account for empty strings (space character). Neither does (if blahblah.value.length==0). The function below will
//return a true as long as there is something other than empty spaces in the text field, and a false if it is empty 
//or if there are nothing but space characters in it. 
//To use the function: if(trim(target.Outcomes.value)=="") where target.Outcomes.value is the name of your text control
//Also, you must include this file in your page     Make sure you enter the correct path,
//and type the include file inside your script tags


function trim (theString)
{
   if ((theString != null) && (theString.length > 0))
   {
       for (var cFirstCharacter = 0; (cFirstCharacter < theString.length) && (theString.charAt(cFirstCharacter) == ' '); cFirstCharacter++)
           ;

       for (var cLastCharacter = theString.length-1; (cLastCharacter > 0) && (theString.charAt(cLastCharacter) == ' '); cLastCharacter--)
           ;

       if (cFirstCharacter <= cLastCharacter)
           theString = theString.substring(cFirstCharacter, cLastCharacter+1);
       else
           theString = '';
       }

   return theString;
}