/*  Copyright © 2001, 2002 OGMA Consulting Corp. */

function makeSafeURL(myString, browser) {
  var myChar = '';
  var textOut = '';

  if ((browser == 'IE')       && (isIE != true))       { return myString };
  if ((browser == 'Netscape') && (isNetscape != true)) { return myString };


  for (i = 0; i < myString.length; i++) {
    myChar = myString.substr(i, 1);
    if (/[\w]/.test(myChar)) {
      textOut = textOut + myChar;
    } else {

      if      (myChar == '?')  { textOut = textOut + '%3F' }
      else if (myChar == '&')  { textOut = textOut + '%26' }
      else if (myChar == '"')  { textOut = textOut + '%22' }
      else if (myChar == "'")  { textOut = textOut + '%27' }
      else if (myChar == '`')  { textOut = textOut + '%60' }
      else if (myChar == '>')  { textOut = textOut + '%3E' }
      else if (myChar == '<')  { textOut = textOut + '%3C' }
      else if (myChar == '%')  { textOut = textOut + '%25' }
      else if (myChar == '/')  { textOut = textOut + '%2F' }
      else if (myChar == '@')  { textOut = textOut + '%40' }
      else if (myChar == '#')  { textOut = textOut + '%23' }
      else if (myChar == '~')  { textOut = textOut + '%7E' }
      else if (myChar == ' ')  { textOut = textOut + '%20' }
      else if (myChar == '\\') { textOut = textOut + '%5C' }
      else if (myChar == '+')  { textOut = textOut + '%2B' }
      else if (myChar == '\n') { textOut = textOut + '%0D%0A' }
      else {
        textOut = textOut + myChar;
      }

    }
  }

  return textOut;
}
