// verifies that string t is a valid email address in for a@b.c
function emailaddressvalidate(t) {
var r = /\S+@\S+\.\S/;
if (r.test(t)) return true;
return false;
}
// makes n copies of string t and returns it
function copies(t,n) {
   x = '';
   for (i = 1; i <= n; i++) {x += t;}
   return x;
   } 
// trims whitespace off of front and back of string
function trim(t)    {return t.replace(/(^ +)|( +$)/g,'')}
// trims whitespace off of front of string
function ltrim(t)   {return t.replace(/(^ +)/g,'')}
// trims whitespace off of back of string
function rtrim(t)   {return t.replace(/( +$)/g,'')}
// replaces each cluster of whitespace t with n copies of string f
// eg - fillspace('this   is   a string,' ',1) results in 'this is a string'
function fillspace(t,f,n) {return t.replace(/\s+/g,copies(f,n))} 