/*As illustrated by this example, the text, enclosed with single quotes, must be passed to a function call return escape(). Attention: Single quotes or apostrophes, respectively, inside the tooltip text itself each must be escaped with a backslash. Example:
return escape('This text won\'t create an error.');
Characters not found in the normal alphanumeric character set, inevitably must be specified using character entities. For instance, use &quot; instead of " or &Ouml; instead of Ö. Consider the following three irregularities: Write & amp; instead of &amp;, & lt; instead of &lt; (displaying as <) and & gt; instead of &gt; (displaying as >).    
Top of page 
 
Cross Browser 
 
Documentation 
 
Download 
 */ 
 
 
 

function leftTrim(sString)
//======================== 
{
	if( sString )
	{
		while (sString.substring(0,1) == ' ')
		{
			sString = sString.substring(1, sString.length);
		}
	}
	return sString;
}

function rightTrim(sString) 
//=========================
{
	if( sString )
	{
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
	}
	return sString;
}

function trimAll(sString)
//=======================
{
	if( sString )
	{
		while (sString.substring(0,1) == ' ')
		{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
	}
	return sString;
}

function toHTML(sString)
//======================
{
	if( sString )
	{
    //replaces \n by <br>, ' by \' and " by &quot; 
    var eChars = ["\n", "'", '"'];
    var rChars = ["<br>", "\\'", '&quot;'];
    var len = eChars.length;
    
    for (var i=0; i<len ; i++) 
    {
      var sArray = sString.split(eChars[i]);
      var lenSplit = sArray.length;
      if( lenSplit > 1 )
      {
        var s = '';
        for (var j=0; j<lenSplit; j++) 
        {
          s += sArray[j];
          if( j < lenSplit-1 ) 
            s += rChars[i];
        }
        sString = s;
      }
    }
    return sString;
	}
	return sString;
}
