code: function(s, newline)
  	{
  		s = String(s || '');
  		
  		s = s.replace(/&/g,'&amp;'); // 38 26
  		s = s.replace(/"/g,'&quot;'); // 34 22
  		s = s.replace(/\'/g,'&#39;'); // 39 27
  		s = s.replace(/</g,'&lt;'); // 60 3C
  		s = s.replace(/>/g,'&gt;'); // 62 3E
  
  		if (newline == null || newline)
  		{
  			s = s.replace(/\n/g, '&#xa;');
  		}
  		
  		return s;
  	}
docs: Function: htmlEntities
  
  Replaces characters (less than, greater than, newlines and quotes) with
  their HTML entities in the given string and returns the result.
  
  Parameters:
  
  s - String that contains the characters to be converted.
  newline - If newlines should be replaced. Default is true.