function clean(t){
   str = t.toString();

   // convert ms smart quotes
   str = str.replace(/\x92/g,"&rsquo;");
   str = str.replace(/\x93/g,"&rdquo;");
   str = str.replace(/\x94/g,"&ldquo;");

   // convert single and double quote marks
   str = str.replace(/\"/g,"&quot;");
   str = str.replace(/\'/g,"&#39;");

   // grave
   str = str.replace(/\x60/g,"&grave;");

   // Accented e and E
   str = str.replace(/\xC9/g,"&Eacute;");
   str = str.replace(/\xE9/g,"&eacute;");
   
   // Less than, greater than
   str = str.replace(/\</g,"&lt;");
   str = str.replace(/\>/g,"&gt;");

   // convert win, unix, and mac return chars with <BR>
   str = str.replace(/\r\n|\n|\r/g, '<br>');

   // return converted string.
   return(str);
};

function textAreaLimit(textAreaSelector, limit, msgAreaSelector){
	var text = $(textAreaSelector).val(); 
	var textlength = text.length; 
	if(textlength > limit){ 
		$(msgAreaSelector).html('You cannot enter more then '+limit+' characters!'); 
		$(textAreaSelector).val(text.substr(0,limit)); 
		return false; 
	}else{ 
		$(msgAreaSelector).html(''); 
		return true; 
	} 
};

