(function($) {
 $.fn.typeOutByWord = function(_dur, _callbackFunc) {
	if($(this).data('jquery_plugin_typeOut_timerId')) {
		clearTimeout($(this).data('jquery_plugin_typeOut_timerId'));
	}
	var _this = this;
	var dur = _dur;
	var callbackFunc = _callbackFunc;
	var originalText = _this.text();
	if(_this.data('jquery_plugin_typeOutByWord_originalText')) {
		if(_this.data('jquery_plugin_typeOutByWord_originalText').length > 0) originalText = _this.data('jquery_plugin_typeOutByWord_originalText');
	}
	_this.data('jquery_plugin_typeOutByWord_originalText', originalText);
	var words = originalText.split(" ");
	var outputString = "";
	_this.text(" ");
	_this.show();
	var textCount = 0;
	//var timerId = setTimeout(typeALetterOut, _dur);
	$(this).data('jquery_plugin_typeOut_timerId',setTimeout(typeALetterOut, _dur));
	function typeALetterOut() {
		if(textCount >= words.length) {
			//_this.data('jquery_plugin_typeOutByWord_originalText', '');
			if(callbackFunc) {
				callbackFunc();
			}
		}else {
			outputString = outputString + " " + words[textCount];
			_this.text(outputString);
			textCount++;
			timerId = setTimeout(typeALetterOut, dur);
		}

	}
}})(jQuery);
