/**
 * Wrapper function for sanitizing input.
 * By: M. Dichirico
 */
function sanitize(input)
{
  if (input != '') {
    input = smart_quotes(input);
    input = bullet_points(input);
    input = single_quotes(input);
  }

  return input;
}

/**
 * Converts smart quotes to Web-friendly quotes.
 * M. Dichirico
 */
function smart_quotes(input)
{
  if (input != '') {
    left_double_quotes = '&ldquo;';
    //left_double_quotes = '"';
    input = input.replace(/\u201c/g, left_double_quotes);
    
    right_double_quotes = '&rdquo;';
    //right_double_quotes = '"';
    input = input.replace(/\u201d/g, right_double_quotes);
  }
  return input;
}

/**
 * Single quotes.
 * By: M. Dichirico
 */
function single_quotes(input)
{
  if (input != '') {
    // left single quote:
    left_single_quote = "&lsquo;";
    input = input.replace(/\u2018/g, left_single_quote);

    // right single quote:
    right_single_quote = "&rsquo;";
    input = input.replace(/\u2019/g, right_single_quote);
  }

  return input;
}

/**
 * Converts MS Word bullet points to Web-friendly bullet points
 * M. Dichirico
 */
function bullet_points(input)
{
  if (input != '') {
    bullet_point = '&bull;';
    input = input.replace(/\u2022/g, bullet_point);
  }
  return input;
}

