/*http://www.kadifeli.com/fedon/utf.htm*/
function my_character2numeric (t)
{

  s = u2dp (t);
  s=s.replace (/&amp;/g, "&");
  return s
}

function u2df (s)
{
  ret = ''; 
  for (i=0; i<s.length; i++)
    ret += '&#' + s.charCodeAt(i) + ';'; 
  return ret;
}

function u2dp (s)
{
  ret = '';
  for (i=0; i<s.length; i++) {
    charCode = s.charCodeAt(i);
    if ((charCode <= 127) && (charCode != 34) && (charCode != 38) &&
        (charCode != 60) && (charCode != 62))
      ret += s.charAt(i);
    else
      ret += '&#' + charCode + ';';
  }
  return ret;
}

function u2hf (s)
{
  ret = '';
  for (i=0; i<s.length; i++) 
    ret += '&#x' + s.charCodeAt(i).toString(16).toUpperCase() + ';'; 
  return ret;
}

function u2hp (s)
{
  ret = '';
  for (i=0; i<s.length; i++) {
    charCode = s.charCodeAt(i);
    if ((charCode <= 127) && (charCode != 34) && (charCode != 38) &&
        (charCode != 60) && (charCode != 62))
      ret += s.charAt(i);
    else
      ret += '&#x' + charCode.toString(16).toUpperCase() + ';'; 
  }
  return ret; 
}
function urlencode(str) {
return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function urldecode(str) {
return unescape(str.replace('+', ' '));
}
