/*
 * stripSmartQuotes.js
 * Replaces MS "Smart Quotes" chars with standard ASCII equivalents.
 *
 * Usage:
 *  <textarea onChange="this.value=this.value.stripSmartQuotes()"></textarea>
 *
 * Author: Nick Sarwark (nsarwark@aamc.org)
 */
 
String.prototype.stripSmartQuotes = function (){

	var strippedString = this;
	
	// define the bad characters
	var SMART_DOUBLE_QUOTES    = new RegExp( '[\\u201C\\u201D]', 'g' );
  	var SMART_SINGLE_QUOTES    = new RegExp( '[\\u2018\\u2019]', 'g' );
	var SMART_ELLIPSIS = new RegExp('\\u2026', 'g');
	var SMART_DASHES = new RegExp('[\\u2013\\u2014]', 'g');
	
	strippedString = strippedString.replace(SMART_DOUBLE_QUOTES, '\"');
	strippedString = strippedString.replace(SMART_SINGLE_QUOTES, '\'');
	strippedString = strippedString.replace(SMART_ELLIPSIS, '\.\.\.');
	strippedString = strippedString.replace(SMART_DASHES, '--');
		
	return strippedString;
	
}
 	
 
 