(function($) {    
	$.fn.tweetstyler = function(o){
		var defaults = {
			//here you define the element you would like to add the final CSS class too. 'li' is recommened since most feeds will contain all their content within an 'li' tag.
			parentElement: "li", 
			openSymbol: "{",// no spaces, spaces will be stripped.
			closeSymbol: "}",// no spaces, spaces will be stripped.
			styleSymbols: ["!","^","_","rb"],// no spaces, spaces will be stripped. Remember to add a class symbol for each class name. Add as many as you need.
			classes: ["TSBold","TSUpper","TSLower","TSRedBack"]// no spaces, spaces will be stripped. Remember to add a class name for each class symbol. Add as many as you need.                        
		};
		$.fn.extend(defaults,o);
		// strip spaces
		defaults.openSymbol = (defaults.openSymbol).replace(/^\s*|\s*$/g,'');
		defaults.closeSymbol = (defaults.closeSymbol).replace(/^\s*|\s*$/g,'');
		for(i=0;i<defaults.styleSymbols.length;i++){
			var ss = defaults.styleSymbols[i];
			ss = ss.replace(/^\s*|\s*$/g,'');
			defaults.styleSymbols[i] = ss;
		}
		return this.each(function(){					  	
			obj = $(this);
			var listItems = $(defaults.parentElement, obj);
			listItems.each(function(){
				var listHTML = $(this).html();
				var posOfOpenSymbol = listHTML.indexOf(defaults.openSymbol);	
				var posOfCloseSymbol = listHTML.indexOf(defaults.closeSymbol);
				if(posOfOpenSymbol < 0 || posOfCloseSymbol < 0){	
				}else{
					//determine the symbol (including braces) for removal
					var removal = listHTML.slice(posOfOpenSymbol ,posOfCloseSymbol + 1);
					//determine the symbol (excluding braces)
					var classSymbol = listHTML.slice(posOfOpenSymbol +1 ,posOfCloseSymbol);
					//put the symbols(s) into an array
					var classSymbolArray = classSymbol.split(",");
					listHTML = listHTML.replace(removal,"");
					//
					$(this).html(listHTML);
					
					//loop once for every class symbol defined
					for(i=0;i<defaults.styleSymbols.length;i++){
						//loop once for every class symbol in the classSymbol array
						for(j=0;j < classSymbolArray.length;j++){
							if(defaults.styleSymbols[i] == classSymbolArray[j]){
								$(this).addClass(defaults.classes[i]);
							}
						}
					}	
				}
			});	
		});	
	};	
})(jQuery);
