<!--
function string_trim(s)
{
/*
  Version 1- October 27, 2009: Obsolete
  Strip leading and trailing whitespace and return everything in between.
  return s.replace(/^\s*(\b.*\b|)\s*$/, "$1");

  Version 2 - October 27, 2009: Currently in Use
  Source: http://www.qodo.co.uk/blog/javascript-trim-leading-and-trailing-spaces/
  Strip the spaces at the start, end and also any multiple spaces in the middle 
  to give a nicely formatted string.

  SQL Injection Hack Detection and Fix Code Added as Well.
  SQL Hacking Words/Chars: "<script", "'", "SELECT", "DROP", ";", "--", "INSERT", "UPDATE", "DELETE", "XP_"

  Fix 1: Implemented in /js/string.js file
  Replace SQL Hacking Words/Chars with Blank String || Time Stamp

  Fix 2: Implemented in /js/string.asp file
  Replace Input String Containing SQL Hacking Words/Chars with Client IP and Time Stamp
*/

  var t;

  s = s.replace(/(^\s*)|(\s*$)/gi,"");
  s = s.replace(/[ ]{2,}/gi," ");
  s = s.replace(/\n /,"\n");

  // /i: case-insensitive search
  if ((s.search(/<script/i) == -1) && (s.search(/'/i) == -1) && (s.search(/SELECT/i) == -1) && (s.search(/DROP/i) == -1) && (s.search(/;/i) == -1) && (s.search(/--/i) == -1) && (s.search(/INSERT/i) == -1) && (s.search(/UPDATE/i) == -1) && (s.search(/DELETE/i) == -1) && (s.search(/XP_/i) == -1))
  {
    t = s;
  }
  else
  {
    // t = '';
    t = Date();
  }

  return t;
}
//-->
