﻿function trim (s)
{
   //   /            open search
   //     ^            beginning of string
   //     \s           find White Space, space, TAB and Carriage Returns
   //     +            one or more
   //   |            logical OR
   //     \s           find White Space, space, TAB and Carriage Returns
   //     $            at end of string
   //   /            close search
   //   g            global search

   return s.replace(/^\s+|\s+$/g, "");
}

function string_match(sPattern,sValue) {
	var regexp = new RegExp(sPattern, "g");
	var matched = sValue.match(regexp);
	if (matched) {
		return (true);
	}
	else {
		return (false);
	}
}